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 cursor moving to an unexpected location after a redo #3416

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

dmaluka
Copy link
Collaborator

@dmaluka dmaluka commented Aug 4, 2024

Remember the cursor location in TextEvent just once - when the original text event happens, so that when we redo after an undo, the cursor is placed at the location where the actual redone modification happens (as
the user would expect), not at the location where the cursor was before the undo (which may be a completely unrelated location and may be far away).

Fixes #3411

Remember the cursor location in TextEvent just once - when the original
text event happens, so that when we redo after an undo, the cursor is
placed at the location where the actual redone modification happens (as
the user would expect), not at the location where the cursor was before
the undo (which may be a completely unrelated location and may be far
away).

Fixes zyedidia#3411
@dmaluka
Copy link
Collaborator Author

dmaluka commented Aug 4, 2024

AFAICS this changing of the remembered cursor location (removed by this PR) was added intentionally in aabc81e. The commit message says just "Fix bugs with undo/redo" so perhaps this te.c = eh.v.cursor was needed to address some real issue, but it's not clear what issue. @zyedidia do you remember maybe?

Copy link
Collaborator

@JoeKar JoeKar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From behavioral point of view it's now comprehensible.

dmaluka added a commit to dmaluka/micro-detectindent that referenced this pull request Aug 9, 2024
Setting options directly in buf.Settings without calling SetOption() or
SetOptionNative() is generally not the best idea, since it may not
trigger the needed side effects. In particular, after
zyedidia/micro#3416, directly setting
`tabstospaces` and `tabsize` causes them not being tracked as locally
overridden per buffer, so if we run the `reload` command, it
unexpectedly replaces the autodetected `tabstospaces` and `tabsize`
settings with the default ones.
@dmaluka dmaluka merged commit 3737979 into zyedidia:master Aug 15, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

Maybe redo should keep cursor where modification happens (not respecting pure line change in redoing)?
2 participants