comparison src/edit.c @ 2811:5381eb5b1eb9 v7.3.181

updated for version 7.3.181 Problem: When repeating the insert of CTRL-V or a digraph the display may not be updated correctly. Solution: Only call edit_unputchar() after edit_putchar(). (Lech Lorens)
author Bram Moolenaar <bram@vim.org>
date Tue, 10 May 2011 14:22:16 +0200
parents c00efaa0af24
children d641f141f937
comparison
equal deleted inserted replaced
2810:8a9bd9723dfe 2811:5381eb5b1eb9
1551 */ 1551 */
1552 static void 1552 static void
1553 ins_ctrl_v() 1553 ins_ctrl_v()
1554 { 1554 {
1555 int c; 1555 int c;
1556 int did_putchar = FALSE;
1556 1557
1557 /* may need to redraw when no more chars available now */ 1558 /* may need to redraw when no more chars available now */
1558 ins_redraw(FALSE); 1559 ins_redraw(FALSE);
1559 1560
1560 if (redrawing() && !char_avail()) 1561 if (redrawing() && !char_avail())
1562 {
1561 edit_putchar('^', TRUE); 1563 edit_putchar('^', TRUE);
1564 did_putchar = TRUE;
1565 }
1562 AppendToRedobuff((char_u *)CTRL_V_STR); /* CTRL-V */ 1566 AppendToRedobuff((char_u *)CTRL_V_STR); /* CTRL-V */
1563 1567
1564 #ifdef FEAT_CMDL_INFO 1568 #ifdef FEAT_CMDL_INFO
1565 add_to_showcmd_c(Ctrl_V); 1569 add_to_showcmd_c(Ctrl_V);
1566 #endif 1570 #endif
1567 1571
1568 c = get_literal(); 1572 c = get_literal();
1569 edit_unputchar(); /* when line fits in 'columns' the '^' is at the start 1573 if (did_putchar)
1570 of the next line and will not be redrawn */ 1574 /* when the line fits in 'columns' the '^' is at the start of the next
1575 * line and will not removed by the redraw */
1576 edit_unputchar();
1571 #ifdef FEAT_CMDL_INFO 1577 #ifdef FEAT_CMDL_INFO
1572 clear_showcmd(); 1578 clear_showcmd();
1573 #endif 1579 #endif
1574 insert_special(c, FALSE, TRUE); 1580 insert_special(c, FALSE, TRUE);
1575 #ifdef FEAT_RIGHTLEFT 1581 #ifdef FEAT_RIGHTLEFT
9635 static int 9641 static int
9636 ins_digraph() 9642 ins_digraph()
9637 { 9643 {
9638 int c; 9644 int c;
9639 int cc; 9645 int cc;
9646 int did_putchar = FALSE;
9640 9647
9641 pc_status = PC_STATUS_UNSET; 9648 pc_status = PC_STATUS_UNSET;
9642 if (redrawing() && !char_avail()) 9649 if (redrawing() && !char_avail())
9643 { 9650 {
9644 /* may need to redraw when no more chars available now */ 9651 /* may need to redraw when no more chars available now */
9645 ins_redraw(FALSE); 9652 ins_redraw(FALSE);
9646 9653
9647 edit_putchar('?', TRUE); 9654 edit_putchar('?', TRUE);
9655 did_putchar = TRUE;
9648 #ifdef FEAT_CMDL_INFO 9656 #ifdef FEAT_CMDL_INFO
9649 add_to_showcmd_c(Ctrl_K); 9657 add_to_showcmd_c(Ctrl_K);
9650 #endif 9658 #endif
9651 } 9659 }
9652 9660
9659 ++no_mapping; 9667 ++no_mapping;
9660 ++allow_keys; 9668 ++allow_keys;
9661 c = plain_vgetc(); 9669 c = plain_vgetc();
9662 --no_mapping; 9670 --no_mapping;
9663 --allow_keys; 9671 --allow_keys;
9664 edit_unputchar(); /* when line fits in 'columns' the '?' is at the start 9672 if (did_putchar)
9665 of the next line and will not be redrawn */ 9673 /* when the line fits in 'columns' the '?' is at the start of the next
9674 * line and will not be removed by the redraw */
9675 edit_unputchar();
9666 9676
9667 if (IS_SPECIAL(c) || mod_mask) /* special key */ 9677 if (IS_SPECIAL(c) || mod_mask) /* special key */
9668 { 9678 {
9669 #ifdef FEAT_CMDL_INFO 9679 #ifdef FEAT_CMDL_INFO
9670 clear_showcmd(); 9680 clear_showcmd();
9672 insert_special(c, TRUE, FALSE); 9682 insert_special(c, TRUE, FALSE);
9673 return NUL; 9683 return NUL;
9674 } 9684 }
9675 if (c != ESC) 9685 if (c != ESC)
9676 { 9686 {
9687 did_putchar = FALSE;
9677 if (redrawing() && !char_avail()) 9688 if (redrawing() && !char_avail())
9678 { 9689 {
9679 /* may need to redraw when no more chars available now */ 9690 /* may need to redraw when no more chars available now */
9680 ins_redraw(FALSE); 9691 ins_redraw(FALSE);
9681 9692
9682 if (char2cells(c) == 1) 9693 if (char2cells(c) == 1)
9683 { 9694 {
9684 /* first remove the '?', otherwise it's restored when typing
9685 * an ESC next */
9686 edit_unputchar();
9687 ins_redraw(FALSE); 9695 ins_redraw(FALSE);
9688 edit_putchar(c, TRUE); 9696 edit_putchar(c, TRUE);
9697 did_putchar = TRUE;
9689 } 9698 }
9690 #ifdef FEAT_CMDL_INFO 9699 #ifdef FEAT_CMDL_INFO
9691 add_to_showcmd_c(c); 9700 add_to_showcmd_c(c);
9692 #endif 9701 #endif
9693 } 9702 }
9694 ++no_mapping; 9703 ++no_mapping;
9695 ++allow_keys; 9704 ++allow_keys;
9696 cc = plain_vgetc(); 9705 cc = plain_vgetc();
9697 --no_mapping; 9706 --no_mapping;
9698 --allow_keys; 9707 --allow_keys;
9699 edit_unputchar(); /* when line fits in 'columns' the '?' is at the 9708 if (did_putchar)
9700 start of the next line and will not be redrawn */ 9709 /* when the line fits in 'columns' the '?' is at the start of the
9710 * next line and will not be removed by a redraw */
9711 edit_unputchar();
9701 if (cc != ESC) 9712 if (cc != ESC)
9702 { 9713 {
9703 AppendToRedobuff((char_u *)CTRL_V_STR); 9714 AppendToRedobuff((char_u *)CTRL_V_STR);
9704 c = getdigraph(c, cc, TRUE); 9715 c = getdigraph(c, cc, TRUE);
9705 #ifdef FEAT_CMDL_INFO 9716 #ifdef FEAT_CMDL_INFO