Restore cursor buffer position after removing trailing newlines #21

Merged
merged 5 commits into from Mar 5, 2014

Conversation

Projects
None yet
2 participants
Contributor

watsonian commented Mar 5, 2014

This ensures that the cursor won't move when it's on the last line, no trailing newline exists, and it adds a trailing newline. Prior to this change the cursor would move to the new line that was added.

Fixes #17.

@watsonian watsonian Restore cursor buffer position after removing trailing newlines. 3edf7a9
Contributor

watsonian commented Mar 5, 2014

@probablycorey What do you think of this solution? I think it's ready to go pending review.

Owner

probablycorey commented Mar 5, 2014

We probably want to preserve the selections and not just the cursor. I'll write up a new spec for this.

Owner

probablycorey commented Mar 5, 2014

If this looks good @watsonian I'll merge it and bump the version!

Contributor

watsonian commented Mar 5, 2014

Nice catch! Didn't even occur to me that there may be a selection when this happens.

Contributor

watsonian commented Mar 5, 2014

👍 🚢

@probablycorey probablycorey added a commit that referenced this pull request Mar 5, 2014

@probablycorey probablycorey Merge pull request #21 from atom/fix-trailing-newline-cursor-shift
Restore cursor buffer position after removing trailing newlines
816afbd

@probablycorey probablycorey merged commit 816afbd into master Mar 5, 2014

probablycorey deleted the fix-trailing-newline-cursor-shift branch Mar 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment