On 2015-03-10, Christian Brabandt wrote:
> Hi Gary!
>
> On Di, 10 Mär 2015, Gary Johnson wrote:
>
> > When I type 0 (zero) followed by Ctrl-D on a line that's indented by
> > more than one 'shiftwidth', I expect all the indentation of the
> > current line to be deleted and the 0 deleted, as described in ":help
> > i_0_CTRL-D". However, if a CursorHoldI autocommand is defined and
> > 'updatetime' elapses between the typing of the 0 and the typing of
> > the Ctrl-D, then the current line is shifted only one 'shiftwidth'
> > to the left and the 0 is not deleted.
>
> This happens, because in edit mode, Vim remembers the last entered char.
> In the case of entering ctrl-d in insert mode, this is used to decide
> whether to remove all indent or only one level. Now when the CursorHold
> kicks in, the last received char when processing the Ctrl-D command will
> then be K_CURSORHOLD and not the '0'.
>
> Here is a patch:
> diff --git a/src/edit.c b/src/edit.c
> --- a/src/edit.c
> +++ b/src/edit.c
> @@ -757,7 +757,8 @@ edit(cmdchar, startln, count)
> /*
> * Get a character for Insert mode. Ignore K_IGNORE.
> */
> - lastc = c; /* remember previous char for CTRL-D
> */
> + if (c != K_CURSORHOLD)
> + lastc = c; /* remember previous char for CTRL-D
> */
> do
> {
> c = safe_vgetc();
Applied and verified. Thank you!
Regards,
Gary
--
--
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.