@@ -1245,27 +1245,50 @@ def test_em_set_mark_and_em_exchange_mark
12451245 assert_line_around_cursor ( 'aaa bbb ccc ddd' , '' )
12461246 input_keys ( "\C -a\e F\e F" )
12471247 assert_line_around_cursor ( 'aaa bbb' , ' ccc ddd' )
1248- assert_equal ( nil , @line_editor . instance_variable_get ( :@mark_pointer ) )
1248+ assert_equal ( nil , @line_editor . instance_variable_get ( :@mark_position ) )
12491249 input_keys ( "\x00 " ) # C-Space
12501250 assert_line_around_cursor ( 'aaa bbb' , ' ccc ddd' )
1251- assert_equal ( [ 7 , 0 ] , @line_editor . instance_variable_get ( :@mark_pointer ) )
1251+ assert_equal ( [ 0 , 7 ] , @line_editor . instance_variable_get ( :@mark_position ) )
12521252 input_keys ( "\C -a" )
12531253 assert_line_around_cursor ( '' , 'aaa bbb ccc ddd' )
1254- assert_equal ( [ 7 , 0 ] , @line_editor . instance_variable_get ( :@mark_pointer ) )
1254+ assert_equal ( [ 0 , 7 ] , @line_editor . instance_variable_get ( :@mark_position ) )
12551255 input_key_by_symbol ( :em_exchange_mark )
12561256 assert_line_around_cursor ( 'aaa bbb' , ' ccc ddd' )
1257- assert_equal ( [ 0 , 0 ] , @line_editor . instance_variable_get ( :@mark_pointer ) )
1257+ assert_equal ( [ 0 , 0 ] , @line_editor . instance_variable_get ( :@mark_position ) )
12581258 end
12591259
12601260 def test_em_exchange_mark_without_mark
12611261 input_keys ( 'aaa bbb ccc ddd' )
12621262 assert_line_around_cursor ( 'aaa bbb ccc ddd' , '' )
12631263 input_keys ( "\C -a\e f" )
12641264 assert_line_around_cursor ( 'aaa' , ' bbb ccc ddd' )
1265- assert_equal ( nil , @line_editor . instance_variable_get ( :@mark_pointer ) )
1265+ assert_equal ( nil , @line_editor . instance_variable_get ( :@mark_position ) )
12661266 input_key_by_symbol ( :em_exchange_mark )
12671267 assert_line_around_cursor ( 'aaa' , ' bbb ccc ddd' )
1268- assert_equal ( nil , @line_editor . instance_variable_get ( :@mark_pointer ) )
1268+ assert_equal ( nil , @line_editor . instance_variable_get ( :@mark_position ) )
1269+ end
1270+
1271+ def test_em_exchange_mark_multibyte
1272+ input_keys ( "aaaaaaaaaaあああああ" )
1273+ input_keys ( "\C -b\C -b" )
1274+ assert_line_around_cursor ( 'aaaaaaaaaaあああ' , 'ああ' )
1275+ input_keys ( "\x00 " ) # C-Space
1276+ input_keys ( "\C -e\C -w" )
1277+ input_keys ( "ああbbbbbああああああ" )
1278+ input_key_by_symbol ( :em_exchange_mark )
1279+ assert_line_around_cursor ( 'ああbbbbbあああ' , 'あああ' )
1280+ end
1281+
1282+ def test_em_exchange_mark_line_disappear
1283+ input_key_by_symbol ( :insert_multiline_text , char : "aaa\n bbb\n ccc" )
1284+ input_keys ( "\C -b\C -b" )
1285+ input_keys ( "\x00 " ) # C-Space
1286+ assert_line_around_cursor ( 'c' , 'cc' )
1287+ input_keys ( "\C -a\C -h\C -p\C -a" )
1288+ assert_line_around_cursor ( '' , 'aaa' )
1289+ input_key_by_symbol ( :em_exchange_mark )
1290+ # If mark line does not exist, moves to the end of the input
1291+ assert_line_around_cursor ( 'bbbccc' , '' )
12691292 end
12701293
12711294 def test_modify_lines_with_wrong_rs
0 commit comments