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 and redo should restore indentation #793

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Dec 10, 2024

Undo and redo should not perform auto indentation. It should not change the indentation. Instead, it should restore previous indentation and revert to the previous state.

irb(main):001>

Paste " 1\n 2"

irb(main):001>   1
irb(main):002>   2

Paste " 1\n 2"

irb(main):001>   1
irb(main):002>   2  1
irb(main):003>   2

Undo

before
irb(main):001>   1
irb(main):002> 2

after
irb(main):001>   1
irb(main):002>   2

Redo

before
irb(main):001>   1
irb(main):002>   2  1
irb(main):003> 2

after
irb(main):001>   1
irb(main):002>   2  1
irb(main):003>   2

Undo and redo should not perform auto indentation. It should not change the indentation. Instead, it should restore previous indentation.
@tompng tompng force-pushed the undo_redo_restores_indentation branch from b50e7ad to c7b5fe7 Compare December 10, 2024 14:48
@@ -2368,24 +2356,23 @@ def finish
@config.editing_mode = :vi_insert
end

private def undo(_key)
private def move_undo_redo(direction)
@undoing = true
Copy link
Member

Choose a reason for hiding this comment

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

Now it represents both undo and redo. How about changing it to restoring?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! updated

Copy link
Member

@ima1zumi ima1zumi left a comment

Choose a reason for hiding this comment

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

LGTM!

@ima1zumi ima1zumi merged commit 6355a6e into ruby:master Dec 12, 2024
40 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Dec 12, 2024
(ruby/reline#793)

* Undo and redo should restore indentation

Undo and redo should not perform auto indentation. It should not change the indentation. Instead, it should restore previous indentation.

* Rename ivar undoing(undoing or redoing) to restoring

ruby/reline@6355a6e0b2
@tompng tompng deleted the undo_redo_restores_indentation branch December 16, 2024 06:05
@ima1zumi ima1zumi added the bug Something isn't working label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants