1
0
forked from aniani/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 #7330)
This commit is contained in:
Bram Moolenaar
2020-11-19 18:46:25 +01:00
parent 79cdf80bed
commit ee8b787bcd
3 changed files with 7 additions and 2 deletions

View File

@@ -1628,7 +1628,7 @@ init_prompt(int cmdchar_todo)
if (cmdchar_todo == 'A') if (cmdchar_todo == 'A')
coladvance((colnr_T)MAXCOL); coladvance((colnr_T)MAXCOL);
if (cmdchar_todo == 'I' || curwin->w_cursor.col <= (int)STRLEN(prompt)) if (curwin->w_cursor.col < (int)STRLEN(prompt))
curwin->w_cursor.col = (int)STRLEN(prompt); curwin->w_cursor.col = (int)STRLEN(prompt);
// Make sure the cursor is in a valid position. // Make sure the cursor is in a valid position.
check_cursor(); check_cursor();

View File

@@ -85,9 +85,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))})

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2014,
/**/ /**/
2013, 2013,
/**/ /**/