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

Undo does not work with [ENTER] #307

Open
salamander2 opened this issue Dec 18, 2023 · 2 comments
Open

Undo does not work with [ENTER] #307

salamander2 opened this issue Dec 18, 2023 · 2 comments
Labels

Comments

@salamander2
Copy link

salamander2 commented Dec 18, 2023

If you already know about this bug with undo [CTRL-Z] just ignore it, close it.

  1. Type: I am going to the store
  2. Make these changes: I am going to the bank[ENTER] and the store
  3. The text now looks like this:
    I am going to the bank
    and the store.
  4. Press [CTRL-Z] repeatedly to undo the changes made in step 2.
  5. The letters typed will be removed, BUT NOT THE [ENTER] / newline
  6. When you undo everything, the text looks like this:
    I am going to
    the store.

It should be back to one line if the undo was working perfectly. Instead, we're left with two lines.

@davidbannon
Copy link
Member

I am sorry Salamander, I must have missed this report. Only just found it now.
Yes, I can confirm it too.
Just sent Debian version 0.38 and could so easily have fixed this bug.
Will try to have it fixed for next release.
Davo

@davidbannon
Copy link
Member

OK, bit worried about this. Can confirm Salamander's report. Enter is not recorded in the undo stack because it does not generate a suitable keydown event. KMemo grabs them because Enter is not recorded there as a character but as a new block, altering the structure. So, this sounds like special code to process an Enter press -

  • Record it as a new type of item, 'Enter' on the undo stack, record SelectionIndex (of new block ? Maybe faster to record block no ?). Will require new field in Undo stack ? How else can I mark different behavior ?
  • On Undo, merge the two blocks that were separated by the Enter. Or delete new block if empty (as many Enter presses will be).
  • Restore cursor.

Quite a bit of extra code happening while user types, must ensure benefit matches that potential slow down. Further research is indicated ....

Davo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants