Am 2014-04-20 13:37, schrieb Pine Wu:
Hello Vim devs:
The online doc (7.3) says "send bugs to [email protected]", but in my vim
7.4 it says unless it's security issue just post it here. So here I am
:-)
As for i_Ctrl-U, vim doc says:
Delete all entered characters in the current line (see i_backspacing
about joining lines).
That is the case when you don't use arrow keys to move the cursor
e.g.
For a line:
vim
You type a, vim, Ctrl-U, what's left is
vim
That is what you'd expect, but
If you type a, vim, <Left-Arrow>, the line would be
vimvim
Then Ctrl-U
All text before cursor would be deleted, what's left is
m
I was expecting vim or vimm
I was going to say, for me the first result wouldn't be expected. While
the second one was.
Turns out, I have mapped Ctrl-U to break the undo sequence (to be able
to undo an accidental Ctrl-U)
and this results in always deleting until the first column, and for the
same reason, pressing
arrow keys results in that unexpected manner.
Turns out, because of patch 7.4.183, a fix is really simple, something
like the attached patch.
(I'll try to update that patch to include a test later today).
Interestingly, this has gotten unnoticed for so long. It seems Ctrl-U in
insert mode is
just such an mysteric command, that one always expects it to be doing
the wrong thing ;)
Best,
Christian
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/edit.c b/src/edit.c
--- a/src/edit.c
+++ b/src/edit.c
@@ -8760,8 +8760,8 @@ ins_bs(c, mode, inserted_space_p)
((curwin->w_cursor.lnum == 1 && curwin->w_cursor.col == 0)
|| (!can_bs(BS_START)
&& (arrow_used
- || (curwin->w_cursor.lnum == Insstart.lnum
- && curwin->w_cursor.col <= Insstart.col)))
+ || (curwin->w_cursor.lnum == Insstart_orig.lnum
+ && curwin->w_cursor.col <= Insstart_orig.col)))
|| (!can_bs(BS_INDENT) && !arrow_used && ai_col > 0
&& curwin->w_cursor.col <= ai_col)
|| (!can_bs(BS_EOL) && curwin->w_cursor.col == 0))))
@@ -8812,8 +8812,8 @@ ins_bs(c, mode, inserted_space_p)
*/
if (curwin->w_cursor.col == 0)
{
- lnum = Insstart.lnum;
- if (curwin->w_cursor.lnum == Insstart.lnum
+ lnum = Insstart_orig.lnum;
+ if (curwin->w_cursor.lnum == Insstart_orig.lnum
#ifdef FEAT_RIGHTLEFT
|| revins_on
#endif
@@ -8822,8 +8822,8 @@ ins_bs(c, mode, inserted_space_p)
if (u_save((linenr_T)(curwin->w_cursor.lnum - 2),
(linenr_T)(curwin->w_cursor.lnum + 1)) == FAIL)
return FALSE;
- --Insstart.lnum;
- Insstart.col = MAXCOL;
+ --Insstart_orig.lnum;
+ Insstart_orig.col = MAXCOL;
}
/*
* In replace mode:
@@ -8981,9 +8981,9 @@ ins_bs(c, mode, inserted_space_p)
while (vcol < want_vcol)
{
/* Remember the first char we inserted */
- if (curwin->w_cursor.lnum == Insstart.lnum
- && curwin->w_cursor.col < Insstart.col)
- Insstart.col = curwin->w_cursor.col;
+ if (curwin->w_cursor.lnum == Insstart_orig.lnum
+ && curwin->w_cursor.col < Insstart_orig.col)
+ Insstart_orig.col = curwin->w_cursor.col;
#ifdef FEAT_VREPLACE
if (State & VREPLACE_FLAG)
@@ -9071,8 +9071,8 @@ ins_bs(c, mode, inserted_space_p)
revins_on ||
#endif
(curwin->w_cursor.col > mincol
- && (curwin->w_cursor.lnum != Insstart.lnum
- || curwin->w_cursor.col != Insstart.col)));
+ && (curwin->w_cursor.lnum != Insstart_orig.lnum
+ || curwin->w_cursor.col != Insstart_orig.col)));
did_backspace = TRUE;
}
#ifdef FEAT_SMARTINDENT
@@ -9090,9 +9090,9 @@ ins_bs(c, mode, inserted_space_p)
AppendCharToRedobuff(c);
/* If deleted before the insertion point, adjust it */
- if (curwin->w_cursor.lnum == Insstart.lnum
- && curwin->w_cursor.col < Insstart.col)
- Insstart.col = curwin->w_cursor.col;
+ if (curwin->w_cursor.lnum == Insstart_orig.lnum
+ && curwin->w_cursor.col < Insstart_orig.col)
+ Insstart_orig.col = curwin->w_cursor.col;
/* vi behaviour: the cursor moves backward but the character that
* was there remains visible