call s:close_windows()
endfunc
+" Test that cursor is drawn at correct position after an operator when
+" 'linebreak' is enabled.
func Test_linebreak_reset_restore()
CheckScreendump
+ " f_wincol() calls validate_cursor()
let lines =<< trim END
- vim9script
- &linebreak = true
- &showcmd = true
- &showmode = false
- ('a'->repeat(&columns - 10) .. ' ' .. 'b'->repeat(10) .. ' c')->setline(1)
+ set linebreak showcmd noshowmode formatexpr=wincol()-wincol()
+ call setline(1, repeat('a', &columns - 10) .. ' bbbbbbbbbb c')
END
call writefile(lines, 'XlbrResetRestore', 'D')
let buf = RunVimInTerminal('-S XlbrResetRestore', {'rows': 8})
- call term_sendkeys(buf, '$v$s')
+ call term_sendkeys(buf, '$v$')
+ call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])})
+ call term_sendkeys(buf, 'zo')
+ call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])})
+
+ call term_sendkeys(buf, '$v$')
+ call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])})
+ call term_sendkeys(buf, 'gq')
+ call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])})
+
+ call term_sendkeys(buf, "$\<C-V>$")
+ call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])})
+ call term_sendkeys(buf, 'I')
+ call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])})
+
+ call term_sendkeys(buf, "\<Esc>$v$")
+ call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])})
+ call term_sendkeys(buf, 's')
+ call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])})
call VerifyScreenDump(buf, 'Test_linebreak_reset_restore_1', {})
+ " clean up
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
endfunc
exe 'bwipe!' buf2
endfunc
-" Test that cursor is drawn at correct position after an operator in Visual
-" mode when 'linebreak' and 'showcmd' are enabled.
-func Test_visual_operator_with_linebreak()
- CheckRunVimInTerminal
-
- let lines =<< trim END
- set linebreak showcmd noshowmode
- call setline(1, repeat('a', &columns - 10) .. ' bbbbbbbbbb c')
- END
- call writefile(lines, 'XTest_visual_op_linebreak', 'D')
-
- let buf = RunVimInTerminal('-S XTest_visual_op_linebreak', {'rows': 6})
-
- call term_sendkeys(buf, '$v$')
- call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])})
- call term_sendkeys(buf, 'zo')
- call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])})
-
- call term_sendkeys(buf, "$\<C-V>$")
- call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])})
- call term_sendkeys(buf, 'I')
- call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])})
-
- call term_sendkeys(buf, "\<Esc>$v$")
- call WaitForAssert({-> assert_equal(13, term_getcursor(buf)[1])})
- call term_sendkeys(buf, 's')
- call WaitForAssert({-> assert_equal(12, term_getcursor(buf)[1])})
-
- " clean up
- call term_sendkeys(buf, "\<Esc>")
- call StopVimInTerminal(buf)
-endfunc
-
" vim: shiftwidth=2 sts=2 expandtab