Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cursor movements on long lines in editor #521

Merged
merged 4 commits into from
Jul 26, 2023
Merged

Fix cursor movements on long lines in editor #521

merged 4 commits into from
Jul 26, 2023

Conversation

vinc
Copy link
Owner

@vinc vinc commented Jul 24, 2023

This PR fix a couple of bugs happening on lines larger than 80 or 160 chars in the editor during cursor movements.

@vinc
Copy link
Owner Author

vinc commented Jul 24, 2023

Moving right past the end of the screen (that is 80 chars wide) on a line that was longer than 160 chars would make the cursor jump 80 chars too far on the right and disappear after 160 chars (2x80). Same issue when going left after 160 chars. The issue wasn't happening when adding chars to the line.

@vinc
Copy link
Owner Author

vinc commented Jul 24, 2023

Moving from a long line of more than 80 chars to a shorter line but still more than 80 chars would not move the cursor to the end of the line, or to the left of the screen if the line is not visible, but instead the cursor would move 80 chars past the end of the line.

@vinc
Copy link
Owner Author

vinc commented Jul 25, 2023

Found another bug: when we want to move the cursor from the end of a long line (> 80 chars) to a line that is shorter than the current screen offset, the editor will move the cursor to the left of the screen, but if we insert a char there, it's past the end of the line and will cause a panic. We need to change the editor to move the cursor to the end of the shorter line and update the offset.

@vinc vinc changed the title Fix cursor moves on long lines in editor Fix cursor movements on long lines in editor Jul 25, 2023
@vinc vinc marked this pull request as ready for review July 26, 2023 07:49
@vinc vinc merged commit cd41710 into trunk Jul 26, 2023
@vinc vinc deleted the fix/editor-cursor branch July 26, 2023 07:49
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.

1 participant