summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2024-12-13 01:40:03 +0900
committergit <svn-admin@ruby-lang.org>2024-12-12 16:40:08 +0000
commit300be2b192a16c064d4e1c9203feda8df6a391fc (patch)
tree0d7b8d070e1e25f228f738a9a6839464a7147857 /test
parent776ec521480d9523732b96c55af4addfdd007e61 (diff)
[ruby/reline] Undo and redo should restore indentation
(https://github.com/ruby/reline/pull/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 https://github.com/ruby/reline/commit/6355a6e0b2
Diffstat (limited to 'test')
-rw-r--r--test/reline/test_key_actor_emacs.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/reline/test_key_actor_emacs.rb b/test/reline/test_key_actor_emacs.rb
index 9fd19f6079..4aea3a6547 100644
--- a/test/reline/test_key_actor_emacs.rb
+++ b/test/reline/test_key_actor_emacs.rb
@@ -1676,6 +1676,20 @@ class Reline::KeyActor::EmacsTest < Reline::TestCase
assert_line_around_cursor('3', '')
end
+ def test_undo_redo_restores_indentation
+ @line_editor.multiline_on
+ @line_editor.confirm_multiline_termination_proc = proc {}
+ input_keys(" 1", false)
+ assert_whole_lines([' 1'])
+ input_keys("2", false)
+ assert_whole_lines([' 12'])
+ @line_editor.auto_indent_proc = proc { 2 }
+ input_keys("\C-_", false)
+ assert_whole_lines([' 1'])
+ input_keys("\M-\C-_", false)
+ assert_whole_lines([' 12'])
+ end
+
def test_redo_with_many_times
str = "a" + "b" * 98 + "c"
input_keys(str, false)