mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
e6429ad047
commit
564aadce62
2 changed files with 21 additions and 0 deletions
|
@ -2342,6 +2342,7 @@ class Reline::LineEditor
|
||||||
alias_method :set_mark, :em_set_mark
|
alias_method :set_mark, :em_set_mark
|
||||||
|
|
||||||
private def em_exchange_mark(key)
|
private def em_exchange_mark(key)
|
||||||
|
return unless @mark_pointer
|
||||||
new_pointer = [@byte_pointer, @line_index]
|
new_pointer = [@byte_pointer, @line_index]
|
||||||
@previous_line_index = @line_index
|
@previous_line_index = @line_index
|
||||||
@byte_pointer, @line_index = @mark_pointer
|
@byte_pointer, @line_index = @mark_pointer
|
||||||
|
|
|
@ -1926,6 +1926,26 @@ class Reline::KeyActor::Emacs::Test < Reline::TestCase
|
||||||
assert_equal([0, 0], @line_editor.instance_variable_get(:@mark_pointer))
|
assert_equal([0, 0], @line_editor.instance_variable_get(:@mark_pointer))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_em_exchange_mark_without_mark
|
||||||
|
input_keys('aaa bbb ccc ddd')
|
||||||
|
assert_byte_pointer_size('aaa bbb ccc ddd')
|
||||||
|
assert_cursor(15)
|
||||||
|
assert_cursor_max(15)
|
||||||
|
assert_line('aaa bbb ccc ddd')
|
||||||
|
input_keys("\C-a\M-f", false)
|
||||||
|
assert_byte_pointer_size('aaa')
|
||||||
|
assert_cursor(3)
|
||||||
|
assert_cursor_max(15)
|
||||||
|
assert_line('aaa bbb ccc ddd')
|
||||||
|
assert_equal(nil, @line_editor.instance_variable_get(:@mark_pointer))
|
||||||
|
input_key_by_symbol(:em_exchange_mark)
|
||||||
|
assert_byte_pointer_size('aaa')
|
||||||
|
assert_cursor(3)
|
||||||
|
assert_cursor_max(15)
|
||||||
|
assert_line('aaa bbb ccc ddd')
|
||||||
|
assert_equal(nil, @line_editor.instance_variable_get(:@mark_pointer))
|
||||||
|
end
|
||||||
|
|
||||||
def test_modify_lines_with_wrong_rs
|
def test_modify_lines_with_wrong_rs
|
||||||
verbose, $VERBOSE = $VERBOSE, nil
|
verbose, $VERBOSE = $VERBOSE, nil
|
||||||
original_global_slash = $/
|
original_global_slash = $/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue