To: vim_dev@googlegroups.com Subject: Patch 8.0.1787 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1787 Problem: Cannot insert the whole cursor line. Solution: Make CTRL-R CTRL-L work. (Andy Massimino, closes #2857) Files: runtime/doc/cmdline.txt, src/ex_getln.c, src/ops.c, src/testdir/test_cmdline.vim *** ../vim-8.0.1786/runtime/doc/cmdline.txt 2017-09-10 18:16:16.511727661 +0200 --- runtime/doc/cmdline.txt 2018-05-01 19:10:26.615060740 +0200 *************** *** 175,186 **** --- 175,188 ---- CTRL-R CTRL-P *c_CTRL-R_CTRL-P* *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,199 **** *c_CTRL-R_CTRL-R* *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} 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), --- 194,201 ---- *c_CTRL-R_CTRL-R* *c__* *c_CTRL-R_CTRL-O* *c__* ! 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), *************** *** 229,237 **** the clipboard. |modeless-selection| If there is no selection CTRL-Y is inserted as a character. ! CTRL-J *c_CTRL-J* *c_* *c_* *c_CR* or start entered command ! *c_* *c_Esc* When typed and 'x' not present in 'cpoptions', quit Command-line mode without executing. In macros or when 'x' present in 'cpoptions', start entered command. --- 231,240 ---- the clipboard. |modeless-selection| If there is no selection CTRL-Y is inserted as a character. ! CTRL-M or CTRL-J *c_CTRL-M* *c_CTRL-J* *c_* *c_* *c_CR* or start entered command ! ! CTRL-[ *c_CTRL-[* *c_* *c_Esc* When typed and 'x' not present in 'cpoptions', quit Command-line mode without executing. In macros or when 'x' present in 'cpoptions', start entered command. *** ../vim-8.0.1786/src/ex_getln.c 2018-04-28 13:56:04.831260649 +0200 --- src/ex_getln.c 2018-05-01 19:10:26.619060714 +0200 *************** *** 3299,3305 **** /* 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)) return FAIL; /* A register containing CTRL-R can cause an endless loop. Allow using --- 3299,3306 ---- /* 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 && regname != Ctrl_L ! && !valid_yank_reg(regname, FALSE)) return FAIL; /* A register containing CTRL-R can cause an endless loop. Allow using *** ../vim-8.0.1786/src/ops.c 2018-04-30 17:20:58.937028966 +0200 --- src/ops.c 2018-05-01 19:10:26.619060714 +0200 *************** *** 1573,1578 **** --- 1573,1586 ---- *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; *** ../vim-8.0.1786/src/testdir/test_cmdline.vim 2018-04-07 19:09:05.791413434 +0200 --- src/testdir/test_cmdline.vim 2018-05-01 19:10:26.619060714 +0200 *************** *** 306,311 **** --- 306,314 ---- 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', @:) *** ../vim-8.0.1786/src/version.c 2018-05-01 18:47:52.992188456 +0200 --- src/version.c 2018-05-01 19:11:38.106599688 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1787, /**/ -- "Shoot for the moon. Even if you miss, you'll land among the stars." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///