Describe the bug
When typing in a file in NEST+, if you attempt to press U or Ctrl+R in NORMAL mode, (where U is undo and Ctrl+R is redo), and then you click any of the up, down left or right arrow keys, the viewport will position itself to the top of the file.
NOTE: To swap betweenNORMAL and INSERT mode, simply press Esc. Please reference the docs in the README.md if you are not familiar with vim motions.
To Reproduce
Steps to reproduce the behavior:
- Go to NEST+
- Open any file
- Scroll down to any line and begin typing
- Type
U in NORMAL mode to Undo and consequently type Ctrl+R to redo an undone state
- Notice how the cursor position resets to the top of the file no matter waht
NOTE: You can also simply press U when typing and press the arrow keys to see this bug, though it should be noted that this should not be the case for either redo or undo keybinds.
It seems that our view port can't find where our cursor is when we delete a line and then try to undo or redo that movement.
Expected behavior
The viewport should keep us at whatever line was edited . So if I delete a line at position 85 in our file, and then I undo that deletion, it should put me back at line 85 or the cursor_pos before doing U or Ctrl+R
Terminal(s):
- Kitty
- iTerm2
- Alacritty
- macOS terminal
Additional context
Note how cursor_pos and relevant variables are stored and tracked for commands like dd or de. We can probably implement something similar to this where our cursor position is stored and retained when all commands are called, including U and Ctrl+R