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 undo/redo cursor positions #70

Open
pythonesque opened this issue Dec 29, 2014 · 7 comments
Open

Fix undo/redo cursor positions #70

pythonesque opened this issue Dec 29, 2014 · 7 comments
Milestone

Comments

@pythonesque
Copy link
Contributor

It seems like the "after" cursor isn't being set correctly currently, so when you redo the cursor ends up in the wrong place (i.e. not the place it was before the edit began). Seems like this should be an easy fix.

@pythonesque
Copy link
Contributor Author

Also, it looks like the "fix undo/redo across pages" fix was reverted (or at least, it no longer appears to be working, as the screen doesn't scroll properly).

@withoutboats
Copy link
Contributor

"when you redo the cursor ends up in the wrong place (i.e. not the place it was before the edit began)."

Is this actually the wrong place? It ends up where the redo occurred, which is the same behavior that I get in gedit and vim (my vimrc is unmodified from whatever is installed on Ubuntu 14.04). It is trivial to change (just reset the end_point when the buffer's undo and redo methods are handling the transaction), but I'm not sure what we want.

The other change is also trivial, I'll push a fix. EDIT: Of course, not actually trivial. But I'll roll that fix into fixing horizontal scrolling.

@pythonesque
Copy link
Contributor Author

Hm, you seem to be right about vim's default behavior. It intuitively feels wrong to me (shouldn't redoing put your cursor where it was after the edit, not before it?) but maybe I am the one who's wrong here.

@withoutboats
Copy link
Contributor

It does put the cursor where it was after the edit, just not after the additional actions of shifting the cursor's position. When we create transactions that include larger blocks than single insertions and removals, we can incorporate cursor movements into the transaction (probably optionally).

@pythonesque
Copy link
Contributor Author

Cursor movements were already incorporated into the transaction before, so this is a behavior change for sure. But I can definitely understand the perspective that they aren't part of the edit.

@gchp
Copy link
Owner

gchp commented Jan 8, 2015

Still seeing some weird behaviour with this.

  • open a file
  • enter the characters "test"
  • press Ctrl-z to undo
  • press Ctrl-y to redo

The cursor should be positioned like so: tes|t
Instead, it is positioned like this: te|st.

Seems off by one every time.

@gchp
Copy link
Owner

gchp commented Jan 8, 2015

Perhaps the wrong value is being stored in transaction.end_point?

@gchp gchp added this to the 0.2.0 milestone Jul 16, 2016
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

No branches or pull requests

3 participants