]> granicus.if.org Git - vim/commitdiff
patch 8.0.1787: cannot insert the whole cursor line v8.0.1787
authorBram Moolenaar <Bram@vim.org>
Tue, 1 May 2018 17:24:03 +0000 (19:24 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 1 May 2018 17:24:03 +0000 (19:24 +0200)
Problem:    Cannot insert the whole cursor line.
Solution:   Make CTRL-R CTRL-L work. (Andy Massimino, closes #2857)

runtime/doc/cmdline.txt
src/ex_getln.c
src/ops.c
src/testdir/test_cmdline.vim
src/version.c

index d87d4fe957621c8ad910189468ad3380c3a14dfa..25577a2b6ae57e0e29db586d05a502b354c57346 100644 (file)
@@ -175,12 +175,14 @@ CTRL-R CTRL-F                             *c_CTRL-R_CTRL-F* *c_<C-R>_<C-F>*
 CTRL-R CTRL-P                          *c_CTRL-R_CTRL-P* *c_<C-R>_<C-P>*
 CTRL-R CTRL-W                          *c_CTRL-R_CTRL-W* *c_<C-R>_<C-W>*
 CTRL-R CTRL-A                          *c_CTRL-R_CTRL-A* *c_<C-R>_<C-A>*
+CTRL-R CTRL-L                          *c_CTRL-R_CTRL-L* *c_<C-R>_<C-L>*
                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-R>_<C-A>*
 
                                        *c_CTRL-R_CTRL-R* *c_<C-R>_<C-R>*
                                        *c_CTRL-R_CTRL-O* *c_<C-R>_<C-O>*
-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),
index 64914aa672e6f69c53c69e1d38e02931c67b1369..0124098da5195cee19989b4bd25e327519b9b47c 100644 (file)
@@ -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
index 0902b04797cf29697687b9e09262152b4b1ce9f1..9af466b3f31a8a728746e007f37e197744270e25 100644 (file)
--- 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;
index ff0756c392c3ee203dab83ad08851988a6d2a5e3..a79f2761cbe634c815985175d9a9fa7786ed7a8e 100644 (file)
@@ -306,6 +306,9 @@ func Test_paste_in_cmdline()
   call feedkeys("ft:aaa \<C-R>\<C-F> bbb\<C-B>\"\<CR>", 'tx')
   call assert_equal('"aaa /tmp/some bbb', @:)
 
+  call feedkeys(":aaa \<C-R>\<C-L> bbb\<C-B>\"\<CR>", 'tx')
+  call assert_equal('"aaa '.getline(1).' bbb', @:)
+
   set incsearch
   call feedkeys("fy:aaa veryl\<C-R>\<C-W> bbb\<C-B>\"\<CR>", 'tx')
   call assert_equal('"aaa verylongword bbb', @:)
index 52b54368d84b6c84de022d737c78e36b7845c172..19b83acf41784c07ef0b4ac87807547464736eb6 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1787,
 /**/
     1786,
 /**/