]> granicus.if.org Git - vim/commitdiff
patch 8.2.2014: using CTRL-O in a prompt buffer moves cursor to start v8.2.2014
authorBram Moolenaar <Bram@vim.org>
Thu, 19 Nov 2020 17:46:25 +0000 (18:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 19 Nov 2020 17:46:25 +0000 (18:46 +0100)
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)

src/job.c
src/testdir/test_prompt_buffer.vim
src/version.c

index 5876c28cb0c361f039fc9014d4cc85da5fd23dad..16fc7c767bb7be86a5bd5a6a4344d8ed88d33cc3 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -1628,7 +1628,7 @@ init_prompt(int cmdchar_todo)
 
     if (cmdchar_todo == 'A')
        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);
     // Make sure the cursor is in a valid position.
     check_cursor();
index 00b97f8c86cc36e5e0a756edee7bcebe07f39cc0..2a1ae67f57e778d5a84b30558d68781f68f2bfd0 100644 (file)
@@ -85,9 +85,12 @@ func Test_prompt_editing()
   call term_sendkeys(buf, left . left . left . bs . '-')
   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>"
   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 WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
index 3f5cd797cfcb54bb2345f981740a64b2c9793736..55dcf0d99796dd316a8611a7f8dcb89aa1999711 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2014,
 /**/
     2013,
 /**/