mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.2014: using CTRL-O in a prompt buffer moves cursor to start
Problem: Using CTRL-O in a prompt buffer moves cursor to start of the line.
Solution: Do not move the cursor when restarting edit. (closes vim/vim#7330)
ee8b787bcd
Test_prompt_editing is skipped, so edit the Lua test in prompt_buffer_spec.
This commit is contained in:
parent
c2d0a1041e
commit
d6258a9bad
@ -1686,7 +1686,7 @@ static void init_prompt(int cmdchar_todo)
|
|||||||
if (cmdchar_todo == 'A') {
|
if (cmdchar_todo == 'A') {
|
||||||
coladvance(MAXCOL);
|
coladvance(MAXCOL);
|
||||||
}
|
}
|
||||||
if (cmdchar_todo == 'I' || curwin->w_cursor.col <= (int)STRLEN(prompt)) {
|
if (curwin->w_cursor.col < (colnr_T)STRLEN(prompt)) {
|
||||||
curwin->w_cursor.col = STRLEN(prompt);
|
curwin->w_cursor.col = STRLEN(prompt);
|
||||||
}
|
}
|
||||||
// Make sure the cursor is in a valid position.
|
// Make sure the cursor is in a valid position.
|
||||||
|
@ -89,9 +89,12 @@ func Test_prompt_editing()
|
|||||||
call term_sendkeys(buf, left . left . left . bs . '-')
|
call term_sendkeys(buf, left . left . left . bs . '-')
|
||||||
call WaitForAssert({-> assert_equal('cmd: -hel', term_getline(buf, 1))})
|
call WaitForAssert({-> assert_equal('cmd: -hel', term_getline(buf, 1))})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, "\<C-O>lz")
|
||||||
|
call WaitForAssert({-> assert_equal('cmd: -hzel', term_getline(buf, 1))})
|
||||||
|
|
||||||
let end = "\<End>"
|
let end = "\<End>"
|
||||||
call term_sendkeys(buf, end . "x")
|
call term_sendkeys(buf, end . "x")
|
||||||
call WaitForAssert({-> assert_equal('cmd: -helx', term_getline(buf, 1))})
|
call WaitForAssert({-> assert_equal('cmd: -hzelx', term_getline(buf, 1))})
|
||||||
|
|
||||||
call term_sendkeys(buf, "\<C-U>exit\<CR>")
|
call term_sendkeys(buf, "\<C-U>exit\<CR>")
|
||||||
call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
|
call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
|
||||||
|
@ -125,9 +125,22 @@ describe('prompt buffer', function()
|
|||||||
~ |
|
~ |
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
|
feed("<C-O>lz")
|
||||||
|
screen:expect([[
|
||||||
|
% -hz^el |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
[Prompt] [+] |
|
||||||
|
other buffer |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
]])
|
||||||
feed("<End>x")
|
feed("<End>x")
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
% -helx^ |
|
% -hzelx^ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
|
Loading…
Reference in New Issue
Block a user