File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -2342,6 +2342,7 @@ def finish
2342
2342
alias_method :set_mark , :em_set_mark
2343
2343
2344
2344
private def em_exchange_mark ( key )
2345
+ return unless @mark_pointer
2345
2346
new_pointer = [ @byte_pointer , @line_index ]
2346
2347
@previous_line_index = @line_index
2347
2348
@byte_pointer , @line_index = @mark_pointer
Original file line number Diff line number Diff line change @@ -1926,6 +1926,26 @@ def test_em_set_mark_and_em_exchange_mark
1926
1926
assert_equal ( [ 0 , 0 ] , @line_editor . instance_variable_get ( :@mark_pointer ) )
1927
1927
end
1928
1928
1929
+ def test_em_exchange_mark_without_mark
1930
+ input_keys ( 'aaa bbb ccc ddd' )
1931
+ assert_byte_pointer_size ( 'aaa bbb ccc ddd' )
1932
+ assert_cursor ( 15 )
1933
+ assert_cursor_max ( 15 )
1934
+ assert_line ( 'aaa bbb ccc ddd' )
1935
+ input_keys ( "\C -a\M -f" , false )
1936
+ assert_byte_pointer_size ( 'aaa' )
1937
+ assert_cursor ( 3 )
1938
+ assert_cursor_max ( 15 )
1939
+ assert_line ( 'aaa bbb ccc ddd' )
1940
+ assert_equal ( nil , @line_editor . instance_variable_get ( :@mark_pointer ) )
1941
+ input_key_by_symbol ( :em_exchange_mark )
1942
+ assert_byte_pointer_size ( 'aaa' )
1943
+ assert_cursor ( 3 )
1944
+ assert_cursor_max ( 15 )
1945
+ assert_line ( 'aaa bbb ccc ddd' )
1946
+ assert_equal ( nil , @line_editor . instance_variable_get ( :@mark_pointer ) )
1947
+ end
1948
+
1929
1949
def test_modify_lines_with_wrong_rs
1930
1950
verbose , $VERBOSE = $VERBOSE, nil
1931
1951
original_global_slash = $/
You can’t perform that action at this time.
0 commit comments