comparison src/testdir/test_gui.vim @ 30120:eb534258bdaf v9.0.0396

patch 9.0.0396: :findrepl does not escape '&' and '~' properly Commit: https://github.com/vim/vim/commit/2834ebdee473c838e50e60d0aa160f0e62fc8ef9 Author: matveyt <matthewtarasov@yandex.ru> Date: Tue Sep 6 17:00:15 2022 +0100 patch 9.0.0396: :findrepl does not escape '&' and '~' properly Problem: :findrepl does not escape '&' and '~' properly. Solution: Escape depending on the value of 'magic'. (closes https://github.com/vim/vim/issues/11067)
author Bram Moolenaar <Bram@vim.org>
date Tue, 06 Sep 2022 18:15:03 +0200
parents 13b02c1ea0f7
children 6d0056cc21a0
comparison
equal deleted inserted replaced
30119:80f7a582451b 30120:eb534258bdaf
1578 call cursor(1, 1) 1578 call cursor(1, 1)
1579 let args = #{find_text: 'TWO', repl_text: 'two', flags: 0x1C, forward: 1} 1579 let args = #{find_text: 'TWO', repl_text: 'two', flags: 0x1C, forward: 1}
1580 call test_gui_event('findrepl', args) 1580 call test_gui_event('findrepl', args)
1581 call assert_equal(['ONE two ONE', 'Twoo ONE two ONEo'], getline(1, '$')) 1581 call assert_equal(['ONE two ONE', 'Twoo ONE two ONEo'], getline(1, '$'))
1582 1582
1583 " Replace all instances with sub-replace specials
1584 call cursor(1, 1)
1585 let args = #{find_text: 'ONE', repl_text: '&~&', flags: 0x4, forward: 1}
1586 call test_gui_event('findrepl', args)
1587 call assert_equal(['&~& two &~&', 'Twoo &~& two &~&o'], getline(1, '$'))
1588
1583 " Invalid arguments 1589 " Invalid arguments
1584 call assert_false(test_gui_event('findrepl', {})) 1590 call assert_false(test_gui_event('findrepl', {}))
1585 let args = #{repl_text: 'a', flags: 1, forward: 1} 1591 let args = #{repl_text: 'a', flags: 1, forward: 1}
1586 call assert_false(test_gui_event('findrepl', args)) 1592 call assert_false(test_gui_event('findrepl', args))
1587 let args = #{find_text: 'a', flags: 1, forward: 1} 1593 let args = #{find_text: 'a', flags: 1, forward: 1}