Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Autoscroll to cursor on undo - #2851

Merged
nathansobo merged 1 commit into
masterfrom
ns-react-autoscroll-on-undo
Jul 7, 2014
Merged

nathansobo merged 1 commit into
masterfrom
ns-react-autoscroll-on-undo

Conversation

@nathansobo

Copy link
Copy Markdown
Contributor

Fixes #2815

This commit changes our autoscroll strategy for cursors significantly.

Originally, we were autoscrolling whenever the cursor's marker changed
positions. This worked well, except we didn't end up autoscrolling when
the user attempted to move the cursor to an invalid position, such as
moving down at the end of the buffer, due to the fact that the marker
wouldn't change.

Then, we moved to always requesting an autoscroll whenever a position
change was requested via Cursor::changePosition. This missed out on
moving the cursor when inserting text, so we then also added an explicit
autoscroll call when inserting text.

This had the problem of not autoscrolling due to undo. So finally, this
solution combines explicit autoscroll in ::changePosition to capture
intent, as well as implicit autoscrolling whenever the cursor's marker
position changes due to a textual change in the buffer. This captures
undo/redo correctly.

Fixes #2815

This commit changes our autoscroll strategy for cursors significantly.

Originally, we were autoscrolling whenever the cursor's marker changed
positions. This worked well, except we didn't end up autoscrolling when
the user *attempted* to move the cursor to an invalid position, such as
moving down at the end of the buffer, due to the fact that the marker
wouldn't change.

Then, we moved to always requesting an autoscroll whenever a position
change was requested via Cursor::changePosition. This missed out on
moving the cursor when inserting text, so we then also added an explicit
autoscroll call when inserting text.

This had the problem of not autoscrolling due to undo. So finally, this
solution combines explicit autoscroll in ::changePosition to capture
intent, as well as implicit autoscrolling whenever the cursor's marker
position changes due to a textual change in the buffer. This captures
undo/redo correctly.
nathansobo pushed a commit that referenced this pull request Jul 7, 2014
@nathansobo
nathansobo merged commit f1b7f9c into master Jul 7, 2014
@nathansobo
nathansobo deleted the ns-react-autoscroll-on-undo branch July 7, 2014 21:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not autoscrolling when cursor moves due to undo

1 participant