# HG changeset patch # User Christian Brabandt # Date 1525195806 -7200 # Node ID 1f95ec5de2386ee7cd87b479b247ab2e1345c8a0 # Parent 8935ed22349cf1b0d0f9e25cafaabc095033ae0f patch 8.0.1787: cannot insert the whole cursor line commit https://github.com/vim/vim/commit/e2c8d8392684a940cc5608acc73ff47486bd7b92 Author: Bram Moolenaar Date: Tue May 1 19:24:03 2018 +0200 patch 8.0.1787: cannot insert the whole cursor line Problem: Cannot insert the whole cursor line. Solution: Make CTRL-R CTRL-L work. (Andy Massimino, closes https://github.com/vim/vim/issues/2857) diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -175,12 +175,14 @@ CTRL-R CTRL-F *c_CTRL-R_CTRL-F* *c__* CTRL-R CTRL-W *c_CTRL-R_CTRL-W* *c__* CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c__* +CTRL-R CTRL-L *c_CTRL-R_CTRL-L* *c__* Insert the object under the cursor: CTRL-F the Filename under the cursor CTRL-P the Filename under the cursor, expanded with 'path' as in |gf| CTRL-W the Word under the cursor CTRL-A the WORD under the cursor; see |WORD| + CTRL-L the line under the cursor When 'incsearch' is set the cursor position at the end of the currently displayed match is used. With CTRL-W the part of @@ -192,8 +194,8 @@ CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c__* *c_CTRL-R_CTRL-O* *c__* -CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A} -CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A} +CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} +CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} Insert register or object under the cursor. Works like |c_CTRL-R| but inserts the text literally. For example, if register a contains "xy^Hz" (where ^H is a backspace), diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -3299,7 +3299,8 @@ cmdline_paste( /* check for valid regname; also accept special characters for CTRL-R in * the command line */ if (regname != Ctrl_F && regname != Ctrl_P && regname != Ctrl_W - && regname != Ctrl_A && !valid_yank_reg(regname, FALSE)) + && regname != Ctrl_A && regname != Ctrl_L + && !valid_yank_reg(regname, FALSE)) return FAIL; /* A register containing CTRL-R can cause an endless loop. Allow using diff --git a/src/ops.c b/src/ops.c --- a/src/ops.c +++ b/src/ops.c @@ -1573,6 +1573,14 @@ get_spec_reg( *allocated = TRUE; return TRUE; + case Ctrl_L: /* Line under cursor */ + if (!errmsg) + return FALSE; + + *argp = ml_get_buf(curwin->w_buffer, + curwin->w_cursor.lnum, FALSE); + return TRUE; + case '_': /* black hole: always empty */ *argp = (char_u *)""; return TRUE; diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -306,6 +306,9 @@ func Test_paste_in_cmdline() call feedkeys("ft:aaa \\ bbb\\"\", 'tx') call assert_equal('"aaa /tmp/some bbb', @:) + call feedkeys(":aaa \\ bbb\\"\", 'tx') + call assert_equal('"aaa '.getline(1).' bbb', @:) + set incsearch call feedkeys("fy:aaa veryl\\ bbb\\"\", 'tx') call assert_equal('"aaa verylongword bbb', @:) diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1787, +/**/ 1786, /**/ 1785,