Skip to content

Conversation

@dmaluka
Copy link
Collaborator

@dmaluka dmaluka commented Apr 14, 2024

After reloading a file that has been externally modified, the buffer view may become invalid: the displayed subset of lines of the file may no longer exist, since the file may have been truncated. So relocate the buffer view in this case.

In particular, this fixes crashes caused by out of bounds accesses to the line array by displayBuffer() trying to display no longer existing lines (reported in #742 (comment))

Fixes #742

After reloading a file that has been externally modified, the buffer
view may become invalid: the displayed subset of lines of the file may
no longer exist, since the file may have been truncated. So relocate the
buffer view in this case.

In particular, this fixes crashes caused by out of bounds accesses to
the line array by displayBuffer() trying to display no longer existing
lines.
@JoeKar
Copy link
Collaborator

JoeKar commented Apr 18, 2024

The relocation now really takes place, which is a great improvement, but...

However, if the user's click lands within a region that falls outside the bounds of the file after the reload (because the external modification reduced its size), a crash occurs.

...in the moment a mouse click is performed into a second instance of micro you can't scroll up or down, till you perform a second click somewhere. The latter one will create unintended selections too. In the moment the first click is performed to the title bar of the terminal, in which micro is displayed, then scrolling via mouse is possible again.
So we definitely have solved the most of the initial problems, but didn't restored the full functionality in this scenario yet.

@dmaluka
Copy link
Collaborator Author

dmaluka commented Apr 18, 2024

Yes, I noticed this too. It is the first of 3 example issues I described in #3251.

@JoeKar
Copy link
Collaborator

JoeKar commented Apr 19, 2024

Great, then it's already tracked. 👍

@dmaluka dmaluka merged commit 5510317 into zyedidia:master Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Micro encountered an error: runtime error: index out of range

2 participants