diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c index d2f9f17cc0..995422276b 100644 --- a/src/nvim/drawline.c +++ b/src/nvim/drawline.c @@ -1700,7 +1700,10 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b if (wp == cmdwin_win) { // Draw the cmdline character. - draw_col_fill(&wlv, schar_from_ascii(cmdwin_type), 1, win_hl_attr(wp, HLF_AT)); + draw_col_fill(&wlv, + schar_from_ascii(wlv.row == wlv.startrow ? cmdwin_type : ' '), + 1, + wlv.row == wlv.startrow ? win_hl_attr(wp, HLF_AT) : 0); } if (wlv.filler_todo > 0) { diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 52873ed52b..2278ba2494 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4688,6 +4688,7 @@ static int open_cmdwin(void) exmode_active = false; State = MODE_NORMAL; + check_cursor(curwin); setmouse(); clear_showcmd(); diff --git a/test/functional/legacy/cmdwin_spec.lua b/test/functional/legacy/cmdwin_spec.lua index d3050c861e..8521ab5bc1 100644 --- a/test/functional/legacy/cmdwin_spec.lua +++ b/test/functional/legacy/cmdwin_spec.lua @@ -77,4 +77,21 @@ describe('cmdwin', function() ]]) end end) + + -- oldtest: Test_cmdwin_no_prefix_on_wrapped_line() + it('prefix char is not drawn on wrapped screen line', function() + local screen = Screen.new(40, 12) + local cmd = 'echo "' .. ('a'):rep(40 - 8) .. '"XYZ' + feed(':' .. cmd .. '') + screen:expect([[ + | + {1:~ }| + {2:[No Name] }| + {1::}echo "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"| + XY^Z | + {1:~ }|*5 + {3:[Command Line] }| + | + ]]) + end) end) diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 5123dcb541..c59f43de15 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -255,7 +255,7 @@ local function test_cmdline(linegrid) screen:expect([[ | {2:[No Name] }| - {1::}make^ | + {1::}mak^e | {3:[Command Line] }| | ]]) @@ -266,7 +266,7 @@ local function test_cmdline(linegrid) grid = [[ | {2:[No Name] }| - {1::}make^ | + {1::}mak^e | {3:[Command Line] }| | ]], @@ -281,7 +281,7 @@ local function test_cmdline(linegrid) grid = [[ | {2:[No Name] }| - {1::}make^ | + {1::}mak^e | {3:[Command Line] }| | ]], @@ -297,7 +297,7 @@ local function test_cmdline(linegrid) grid = [[ | {2:[No Name] }| - {1::}make^ | + {1::}mak^e | {3:[Command Line] }| | ]], diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 4b69fb62ff..a1c9cfd846 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -4424,7 +4424,7 @@ describe('builtin popupmenu', function() | {2:[No Name] }| {1::}sign define | - {1::}sign define^ | + {1::}sign defin^e | {1:~ }|*4 {3:[Command Line] }| :sign define | diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 99efd781f8..bc2827ddfc 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -2888,59 +2888,72 @@ func Test_wildmenu_pum() [CODE] call writefile(commands, 'Xtest', 'D') - let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) + let rows = 10 + let buf = RunVimInTerminal('-S Xtest', #{rows: rows}) call term_sendkeys(buf, ":sign \") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define') + 1)], g:test_timeout, ((rows - 1), '\ call term_sendkeys(buf, "\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign list') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_02', {}) " going down the popup menu using call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign place') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_03', {}) " going up the popup menu using call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign list') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_04', {}) " going up the popup menu using call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign jump') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_05', {}) " pressing should end completion and go back to the original match call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign ') + 1)], g:test_timeout, ((rows - 1), '\~\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_06', {}) " pressing should select the current match and end completion call term_sendkeys(buf, "\\\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign unplace') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_07', {}) " With 'wildmode' set to 'longest,full', completing a match should display " the longest match, the wildmenu should not be displayed. call term_sendkeys(buf, ":\set wildmode=longest,full\") - call TermWait(buf) call term_sendkeys(buf, ":sign u\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign un') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_08', {}) " pressing should display the wildmenu call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign undefine') + 1)], g:test_timeout, ((rows - 1), '\ second time should select the next entry in the menu call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign unplace') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {}) call term_sendkeys(buf, ":\set wildmode=full\") " showing popup menu in different columns in the cmdline call term_sendkeys(buf, ":sign define \") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define culhl=') + 1)], g:test_timeout, ((rows - 1), '\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define culhl= culhl=') + 1)], g:test_timeout, ((rows - 1), '\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define culhl= culhl= culhl=') + 1)], g:test_timeout, ((rows - 1), '\e Xnamedi\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':e Xnamedir/XdirA/') + 1)], g:test_timeout, ((rows - 1), '\ on a directory name should go into that directory call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':e Xnamedir/XdirA/XdirB/') + 1)], g:test_timeout, ((rows - 1), '\ on a directory name should go to the parent directory call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':e Xnamedir/XdirA/') + 1)], g:test_timeout, ((rows - 1), '\ when the popup menu is displayed should list all the - " matches but the popup menu should still remain + " matches but the popup menu should still remain (FIXME: the menu goes away) call term_sendkeys(buf, "\sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define jump list place undefine unplace') + 1)], g:test_timeout, ((rows - 1), '\~\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_17', {}) " Pressing when the popup menu is displayed should remove the popup " menu call term_sendkeys(buf, "\sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define') + 1)], g:test_timeout, ((rows - 1), '^define$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_18', {}) " Pressing should open the popup menu with the last entry selected call term_sendkeys(buf, "\\:sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign undefine') + 1)], g:test_timeout, ((rows - 1), '\ should close the popup menu and cancel the cmd line call term_sendkeys(buf, "\\:sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [1, 1], g:test_timeout, (rows, '^$'), ((rows - 1), '^\~\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_20', {}) " Typing a character when the popup is open, should close the popup call term_sendkeys(buf, ":sign \x") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign definex') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_21', {}) " When the popup is open, entering the cmdline window should close the popup call term_sendkeys(buf, "\sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [6, strlen(':sign define')], g:test_timeout, (rows, '^You discovered the command-line window! You can close it with ":q"\.')) + call WaitFor({buf_ -> {-> term_scrape(buf, 6)->slice(1, 5)->filter({_, v -> v.fg == '#af5f00'})->len() == 4}}(buf), g:test_timeout) call VerifyScreenDump(buf, 'Test_wildmenu_pum_22', {}) call term_sendkeys(buf, ":q\") " After the last popup menu item, should show the original string call term_sendkeys(buf, ":sign u\\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign u') + 1)], g:test_timeout, ((rows - 1), '\bu\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':bufdo') + 1)], g:test_timeout, ((rows - 1), '\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':bufdo') + 0)], g:test_timeout, ((rows - 1), '\~\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_25', {}) " Pressing should remove the popup menu and erase the last character call term_sendkeys(buf, "\\sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign defin') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_26', {}) " Pressing should remove the popup menu and erase the previous word call term_sendkeys(buf, "\\sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign ') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_27', {}) " Pressing should remove the popup menu and erase the entire line call term_sendkeys(buf, "\\sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_28', {}) " Using to cancel the popup menu and then pressing should recall " the cmdline from history call term_sendkeys(buf, "sign xyz\:sign \\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign xyz') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_29', {}) " Check that when "longest" produces no result, "list" works call term_sendkeys(buf, "\set wildmode=longest,list\") call term_sendkeys(buf, ":cn\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':cn') + 1)], g:test_timeout, ((rows - 1), '\") call VerifyScreenDump(buf, 'Test_wildmenu_pum_30', {}) call term_sendkeys(buf, "s") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':cns') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_31', {}) " Tests a directory name contained full-width characters. @@ -3033,35 +3066,41 @@ func Test_wildmenu_pum() call term_sendkeys(buf, "\set wildmode&\") call term_sendkeys(buf, ":\e Xnamedir/あいう/\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strwidth(':e Xnamedir/あいう/123') + 1)], g:test_timeout, ((rows - 1), '\ when the popup menu is displayed should list all the " matches and pressing a key after that should remove the popup menu call term_sendkeys(buf, "\set wildmode=full\") call term_sendkeys(buf, ":sign \\x") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define jump list place undefine unplacex') + 1)], g:test_timeout, ((rows - 1), '\~\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_33', {}) " Pressing when the popup menu is displayed should list all the " matches and pressing after that should move the cursor call term_sendkeys(buf, "\abc\") call term_sendkeys(buf, ":sign \\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define jump list place undefine unplace') + 0)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_34', {}) " When displays a lot of matches (screen scrolls), all the matches " should be displayed correctly on the screen. call term_sendkeys(buf, "\\Tcmd \\\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(' aaa') + 0)], g:test_timeout, (rows, '^\saaaa$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_35', {}) " After using to expand all the filename matches, pressing " should not open the popup menu again. call term_sendkeys(buf, "\\:cd Xnamedir/XdirA\") call term_sendkeys(buf, ":e \\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':e XdirB/ XfileB') + 1)], g:test_timeout, ((rows - 1), '\~\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_36', {}) call term_sendkeys(buf, "\\:cd -\") " After using to expand all the matches, pressing used to " crash Vim call term_sendkeys(buf, ":sign \\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define jump list place undefine unplace') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_37', {}) " After removing the pum the command line is redrawn @@ -3069,6 +3108,7 @@ func Test_wildmenu_pum() call term_sendkeys(buf, ":edit bar\") call term_sendkeys(buf, ":ls\") call term_sendkeys(buf, ":com\ ") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':comclear ') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_38', {}) call term_sendkeys(buf, "\\") @@ -3076,50 +3116,65 @@ func Test_wildmenu_pum() call term_sendkeys(buf, ":call SetupStatusline()\") call term_sendkeys(buf, ":si\") call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [1, 1], g:test_timeout, ((rows - 1), '^status\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_39', {}) " Esc still works to abort the command when 'tabline' is set call term_sendkeys(buf, ":call SetupTabline()\") call term_sendkeys(buf, ":si\") call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [2, 1], g:test_timeout, ((rows - 1), '^bar\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_40', {}) " popup is cleared also when 'lazyredraw' is set call term_sendkeys(buf, ":set showtabline=1 laststatus=1 lazyredraw\") call term_sendkeys(buf, ":call DoFeedKeys()\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':abbreviate') + 1)], g:test_timeout, ((rows - 1), '\") " Pressing should scroll the menu downward call term_sendkeys(buf, ":sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign undefine') + 1)], g:test_timeout, ((rows - 1), '\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign unplace') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_43', {}) call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign ') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_44', {}) call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_45', {}) call term_sendkeys(buf, "\sign \\\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign unplace') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_46', {}) " Pressing should scroll the menu upward call term_sendkeys(buf, "\sign \\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign ') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_47', {}) call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign unplace') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_48', {}) call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign jump') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_49', {}) call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign define') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_50', {}) " pressing to end completion should work in middle of the line too call term_sendkeys(buf, "\:set wildchazz\\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':set wildcharzz') - 1)], g:test_timeout, ((rows - 1), '\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':set wildchazz') - 1)], g:test_timeout, ((rows - 1), '\~\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_52', {}) " pressing should select the current match and end completion call term_sendkeys(buf, "\:set wildchazz\\\\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':set wildcharzz') - 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_53', {}) call term_sendkeys(buf, "\:set showtabline& laststatus& lazyredraw&\") @@ -3127,58 +3182,66 @@ func Test_wildmenu_pum() " "longest:list" shows list whether it finds a candidate or not call term_sendkeys(buf, ":set wildmode=longest:list,full wildoptions&\") call term_sendkeys(buf, ":cn\") - call TermWait(buf, 50) + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':cn') + 1)], g:test_timeout, ((rows - 1), '\") - call TermWait(buf, 50) + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':cnewer') + 1)], g:test_timeout, ((rows - 1), '\:sign u\") - call TermWait(buf, 50) + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign un') + 1)], g:test_timeout, ((rows - 1), '\:set wildmode=longest:full,full\") call term_sendkeys(buf, ":sign u\") - call TermWait(buf, 50) + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign un') + 1)], g:test_timeout, ((rows - 1), '\") - call TermWait(buf, 50) + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign undefine') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_59', {}) call term_sendkeys(buf, "\:cn\") - call TermWait(buf, 50) + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':cn') + 1)], g:test_timeout, ((rows - 1), '\") - call TermWait(buf, 50) + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':cnewer') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_61', {}) " If "longest,full" finds a candidate, wildmenu is not shown call term_sendkeys(buf, "\:set wildmode=longest,full\") call term_sendkeys(buf, ":sign u\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign un') + 1)], g:test_timeout, ((rows - 1), '\~\s\+$')) call VerifyScreenDump(buf, 'Test_wildmenu_pum_62', {}) " Subsequent wildchar shows wildmenu call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign undefine') + 1)], g:test_timeout, ((rows - 1), '\:set wildmode=longest,noselect\") call term_sendkeys(buf, ":cn\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':cn') + 1)], g:test_timeout, ((rows - 1), '\:set wildmode=longest,full\") call term_sendkeys(buf, ":set wildoptions=pum\") call term_sendkeys(buf, ":sign un\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign undefine') + 1)], g:test_timeout, ((rows - 1), '\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign unplace') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {}) " Similarly for "longest,noselect:full" call term_sendkeys(buf, "\:set wildmode=longest,noselect:full\") call term_sendkeys(buf, ":sign un\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign un') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_65', {}) call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign undefine') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_09', {}) call term_sendkeys(buf, "\") + call WaitForTermCurPosAndLinesToMatch(buf, [rows, (strlen(':sign unplace') + 1)]) call VerifyScreenDump(buf, 'Test_wildmenu_pum_10', {}) call term_sendkeys(buf, "\\") diff --git a/test/old/testdir/test_cmdwin.vim b/test/old/testdir/test_cmdwin.vim index 1e68c04975..75ed96bcd3 100644 --- a/test/old/testdir/test_cmdwin.vim +++ b/test/old/testdir/test_cmdwin.vim @@ -234,4 +234,38 @@ func Test_cmdwin_showcmd() call StopVimInTerminal(buf) endfunc +func Test_cmdwin_cursor_position() + " When the cmdline fills the screen width exactly, pressing CTRL-F to open + " the cmdwin should place the cursor on the last character, not past it. + let cmd = 'echo "' .. repeat('a', &columns - 8) .. '"' + call assert_equal(&columns - 1, len(cmd)) + let g:cmdwin_col = 0 + let g:cmdwin_line = '' + call feedkeys(':' .. cmd .. "\" .. + \ ":let g:cmdwin_col = col('.')\" .. + \ ":let g:cmdwin_line = getline('.')\" .. + \ ":q\", 'x!') + call assert_equal(len(cmd), g:cmdwin_col) + call assert_equal(cmd, g:cmdwin_line) + unlet g:cmdwin_col g:cmdwin_line +endfunc + +func Test_cmdwin_no_prefix_on_wrapped_line() + CheckScreendump + + let lines =<< trim END + augroup vimHints | au! | augroup END + END + call writefile(lines, 'Xcmdwin_wrap', 'D') + + let buf = RunVimInTerminal('-S Xcmdwin_wrap', #{rows: 12, cols: 40}) + let cmd = 'echo "' .. repeat('a', 40 - 8) .. '"XYZ' + call term_sendkeys(buf, ':' .. cmd .. "\") + call TermWait(buf, 100) + call VerifyScreenDump(buf, 'Test_cmdwin_wrap_prefix', {}) + + call term_sendkeys(buf, ":q\") + call StopVimInTerminal(buf) +endfunc + " vim: shiftwidth=2 sts=2 expandtab