# HG changeset patch # User Bram Moolenaar # Date 1605808805 -3600 # Node ID 3f04c2cf0cedfda9562a344575786569a847dadd # Parent f5066b74b9af078006f3de10d2f3c39c33e18ae7 patch 8.2.2014: using CTRL-O in a prompt buffer moves cursor to start Commit: https://github.com/vim/vim/commit/ee8b787bcd15f63a938243770065e704c9b5c85f Author: Bram Moolenaar Date: Thu Nov 19 18:46:25 2020 +0100 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 https://github.com/vim/vim/issues/7330) diff --git a/src/job.c b/src/job.c --- 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(); diff --git a/src/testdir/test_prompt_buffer.vim b/src/testdir/test_prompt_buffer.vim --- a/src/testdir/test_prompt_buffer.vim +++ b/src/testdir/test_prompt_buffer.vim @@ -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, "\lz") + call WaitForAssert({-> assert_equal('cmd: -hzel', term_getline(buf, 1))}) + let 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, "\exit\") call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))}) diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2014, +/**/ 2013, /**/ 2012,