japanoise / emsys

ersatz-emacs text editor
MIT License
3 stars 2 forks source link

Rewrite of editorSetScxScy, editorScroll and editorDrawRows #39

Closed nicholascarroll closed 1 month ago

nicholascarroll commented 1 month ago

Rewrite of editorSetScxScy, editorScroll and editorDrawRow

nicholascarroll commented 1 month ago

PR #36 implemented toggle-truncate-lines. In doing this I introduced bug/s which manifest when you have very long lines in wrapped mode: you can't get to the last line of the file with down arrow or M->. Page up/down work perfectly though and exactly the same as Emacs. Trying to fix this I got the distinct impression that I was overcomplicating things. I decided the best approach was to:

  1. retreat to code that was there before PR #36 for the case that the lines are wrapped and in each relevant function have an if (truncate_lines == 1). Therefore @japanoise when you review this PR, compare to the version of main.c that you had before PR #36 - commit 40a7316. Then you will be able to follow more easily how toggle-truncate-lines code is introduced.
  2. Do the Emacs style page up/down later: the emsys page up/down advances the cursor a whole page which is not correct: the cursor should only move as much as need be to appear in the new page. But I will do that later once we have settled down on toggle-truncate-lines and made sure it is all ticketyboo. Enhancement #40.

A consequence of this is that Visual Mark had to come out of editorDrawRows for the time being. Both Visual Mark and Emacs style page up/down are implemented in my visual-mark branch.

japanoise commented 1 month ago

@nicholascarroll anything more to do here?