Steps to reproduce:
Edit a file with the following contents (each of the 4 lines contains
a tab character followed by 8 spaces):
#v+
#v-
Perform the following steps:
:set ts=8 listchars=tab:>- list
:digraphs ta 9
Go to the first space in the line. Enter the following sequence of
keystrokes:
gR<C-v><Tab><Esc>j0l.j0lgR<C-k>ta<Esc>j0l.
Vim will show:
#v+
>------- -------
>------->-------
>------- -------
>------->-------
#v-
while it should:
#v+
>------->-------
>------->-------
>------->-------
>------->-------
#v-
The attached patch fixes the problem. Additionally a redundant call to
edit_unputchar() is removed.
--
Cheers,
Lech
--
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
diff --git a/src/edit.c b/src/edit.c
index ad146c8..e1baaea 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1553,12 +1553,16 @@ ins_redraw(ready)
ins_ctrl_v()
{
int c;
+ int putcharPerformed = FALSE;
/* may need to redraw when no more chars available now */
ins_redraw(FALSE);
if (redrawing() && !char_avail())
+ {
edit_putchar('^', TRUE);
+ putcharPerformed = TRUE;
+ }
AppendToRedobuff((char_u *)CTRL_V_STR); /* CTRL-V */
#ifdef FEAT_CMDL_INFO
@@ -1566,8 +1570,9 @@ ins_ctrl_v()
#endif
c = get_literal();
- edit_unputchar(); /* when line fits in 'columns' the '^' is at the start
- of the next line and will not be redrawn */
+ if (putcharPerformed)
+ edit_unputchar(); /* when line fits in 'columns' the '^' is at the
+ * start of the next line and will not be redrawn */
#ifdef FEAT_CMDL_INFO
clear_showcmd();
#endif
@@ -9637,6 +9642,7 @@ ins_digraph()
{
int c;
int cc;
+ int putcharPerformed = FALSE;
pc_status = PC_STATUS_UNSET;
if (redrawing() && !char_avail())
@@ -9645,6 +9651,7 @@ ins_digraph()
ins_redraw(FALSE);
edit_putchar('?', TRUE);
+ putcharPerformed = TRUE;
#ifdef FEAT_CMDL_INFO
add_to_showcmd_c(Ctrl_K);
#endif
@@ -9661,8 +9668,9 @@ ins_digraph()
c = plain_vgetc();
--no_mapping;
--allow_keys;
- edit_unputchar(); /* when line fits in 'columns' the '?' is at the start
- of the next line and will not be redrawn */
+ if (putcharPerformed)
+ edit_unputchar(); /* when line fits in 'columns' the '?' is at the
+ * start of the next line and will not be redrawn */
if (IS_SPECIAL(c) || mod_mask) /* special key */
{
@@ -9674,6 +9682,7 @@ ins_digraph()
}
if (c != ESC)
{
+ putcharPerformed = FALSE;
if (redrawing() && !char_avail())
{
/* may need to redraw when no more chars available now */
@@ -9681,11 +9690,9 @@ ins_digraph()
if (char2cells(c) == 1)
{
- /* first remove the '?', otherwise it's restored when typing
- * an ESC next */
- edit_unputchar();
ins_redraw(FALSE);
edit_putchar(c, TRUE);
+ putcharPerformed = TRUE;
}
#ifdef FEAT_CMDL_INFO
add_to_showcmd_c(c);
@@ -9696,8 +9703,10 @@ ins_digraph()
cc = plain_vgetc();
--no_mapping;
--allow_keys;
- edit_unputchar(); /* when line fits in 'columns' the '?' is at the
- start of the next line and will not be redrawn */
+ if (putcharPerformed)
+ edit_unputchar(); /* when line fits in 'columns' the '?' is at the
+ * start of the next line and will not be redrawn
+ */
if (cc != ESC)
{
AppendToRedobuff((char_u *)CTRL_V_STR);