mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 9.1.0015: i_CTRL-R- no longer works in replace mode
Problem: i_CTRL-R- no longer works in replace mode Solution: delete characters in replace mode before putting, add a test, add a bit warning into the documentation, that i_CTRL-R-P/O is not supported in Replace mode for now fixes: #13792 closes: #13816 Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*insert.txt* For Vim version 9.1. Last change: 2022 Sep 30
|
*insert.txt* For Vim version 9.1. Last change: 2024 Jan 04
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -168,22 +168,22 @@ CTRL-R CTRL-O {register} *i_CTRL-R_CTRL-O*
|
|||||||
auto-indent. Does the same as pasting with the mouse
|
auto-indent. Does the same as pasting with the mouse
|
||||||
|<MiddleMouse>|. When the register is linewise this will
|
|<MiddleMouse>|. When the register is linewise this will
|
||||||
insert the text above the current line, like with `P`.
|
insert the text above the current line, like with `P`.
|
||||||
Does not replace characters!
|
|
||||||
The '.' register (last inserted text) is still inserted as
|
The '.' register (last inserted text) is still inserted as
|
||||||
typed.
|
typed.
|
||||||
After this command, the '.' register contains the command
|
After this command, the '.' register contains the command
|
||||||
typed and not the text. I.e., the literals "^R^O" and not the
|
typed and not the text. I.e., the literals "^R^O" and not the
|
||||||
text from the register.
|
text from the register.
|
||||||
|
Does not replace characters in |Replace-mode|!
|
||||||
|
|
||||||
CTRL-R CTRL-P {register} *i_CTRL-R_CTRL-P*
|
CTRL-R CTRL-P {register} *i_CTRL-R_CTRL-P*
|
||||||
Insert the contents of a register literally and fix the
|
Insert the contents of a register literally and fix the
|
||||||
indent, like |[<MiddleMouse>|.
|
indent, like |[<MiddleMouse>|.
|
||||||
Does not replace characters!
|
|
||||||
The '.' register (last inserted text) is still inserted as
|
The '.' register (last inserted text) is still inserted as
|
||||||
typed.
|
typed.
|
||||||
After this command, the '.' register contains the command
|
After this command, the '.' register contains the command
|
||||||
typed and not the text. I.e., the literals "^R^P" and not the
|
typed and not the text. I.e., the literals "^R^P" and not the
|
||||||
text from the register.
|
text from the register.
|
||||||
|
Does not replace characters in |Replace-mode|!
|
||||||
|
|
||||||
*i_CTRL-T*
|
*i_CTRL-T*
|
||||||
CTRL-T Insert one shiftwidth of indent at the start of the current
|
CTRL-T Insert one shiftwidth of indent at the start of the current
|
||||||
|
@@ -828,9 +828,22 @@ insert_reg(
|
|||||||
{
|
{
|
||||||
if (regname == '-')
|
if (regname == '-')
|
||||||
{
|
{
|
||||||
|
int dir = BACKWARD;
|
||||||
|
if ((State & REPLACE_FLAG) != 0)
|
||||||
|
{
|
||||||
|
pos_T curpos;
|
||||||
|
u_save_cursor();
|
||||||
|
del_bytes((long)STRLEN(y_current->y_array[0]), TRUE, FALSE);
|
||||||
|
curpos = curwin->w_cursor;
|
||||||
|
if (oneright() == FAIL)
|
||||||
|
// hit end of line, need to put forward (after the current position)
|
||||||
|
dir = FORWARD;
|
||||||
|
curwin->w_cursor = curpos;
|
||||||
|
}
|
||||||
|
|
||||||
AppendCharToRedobuff(Ctrl_R);
|
AppendCharToRedobuff(Ctrl_R);
|
||||||
AppendCharToRedobuff(regname);
|
AppendCharToRedobuff(regname);
|
||||||
do_put(regname, NULL, BACKWARD, 1L, PUT_CURSEND);
|
do_put(regname, NULL, dir, 1L, PUT_CURSEND);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stuffescaped(y_current->y_array[i], literally);
|
stuffescaped(y_current->y_array[i], literally);
|
||||||
|
@@ -4181,4 +4181,4 @@ func Test_brace_single_line()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
|
||||||
|
@@ -946,4 +946,24 @@ func Test_register_y_append_reset()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_insert_small_delete_replace_mode()
|
||||||
|
new
|
||||||
|
call setline(1, ['foo', 'bar', 'foobar', 'bar'])
|
||||||
|
let @-='foo'
|
||||||
|
call cursor(2, 1)
|
||||||
|
exe ":norm! R\<C-R>-\<C-R>-"
|
||||||
|
call assert_equal('foofoo', getline(2))
|
||||||
|
call cursor(3, 1)
|
||||||
|
norm! D
|
||||||
|
call assert_equal(['foo', 'foofoo', '', 'bar'], getline(1, 4))
|
||||||
|
call cursor(4, 2)
|
||||||
|
exe ":norm! R\<C-R>-ZZZZ"
|
||||||
|
call assert_equal(['foo', 'foofoo', '', 'bfoobarZZZZ'], getline(1, 4))
|
||||||
|
call cursor(1, 1)
|
||||||
|
let @-=''
|
||||||
|
exe ":norm! R\<C-R>-ZZZ"
|
||||||
|
call assert_equal(['ZZZ', 'foofoo', '', 'bfoobarZZZZ'], getline(1, 4))
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -704,6 +704,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
15,
|
||||||
/**/
|
/**/
|
||||||
14,
|
14,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user