8000 Using CTRL+Z to undo text writes will override the last known line position when making newlines · Issue #184 · system2k/NodeWorldOfText · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Using CTRL+Z to undo text writes will override the last known line position when making newlines #184

New issue

Have a question about this pr 8000 oject? 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

Open
system2k opened this issue Nov 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@system2k
Copy link
Owner
system2k commented Nov 2, 2024

Quote from itac85v2:

So if I type "abc" and press enter, I'll start one line below the "a" (as expected).
Then, if I were to type "abcdefg" and undo the "fg", pressing enter will leave me one line where the "f" originally was, and not beneath the "a".

Further bug report which may be related:

the very top row on the paste preview is sometimes shifted right by 1 cell. clicking to paste will also have this issue.
can't find how to reproduce, it just happens sometimes
pressing esc and redoing the paste preview will almost always fix it

@system2k system2k added the bug Something isn't working label Nov 2, 2024
@ITAC85v2
Copy link

After looking into the code, this seems to be less of a bug and more of an enhancement. Currently, the client will override verticalEnterPos to whatever X coordinate that the character that was undone is located at, caused by a call to moveCursor() in the undoWrite function. This works fine in most cases, but in some cases this is a bit of an annoying behavior.

A proposed fix to this would be:

  • When undoing, first check what coordinates the character to undo is located at, and what coordinates the cursor is currently located in
  • If:
    • the undone character is currently visible on-screen,
    • AND the undone character's X coordinate is not less than the value of verticalEnterPos,
  • then we do not override the value of verticalEnterPos.
  • If at least one of these conditions aren't met, it should still override the saved verticalEnterPos value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
0