To: vim-dev@vim.org
Subject: patch 7.1.104
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 7.1.104 (after 7.1.095)
Problem: When 'lazyredraw' is set a focus event causes redraw to be
postponed until a key is pressed.
Solution: Instead of not returning from vgetc() when a focus event is
encountered return K_IGNORE. Add plain_vgetc() for when the
caller doesn't want to get K_IGNORE.
Files: src/digraph.c, src/edit.c, src/ex_cmds.c, src/ex_getln.c,
src/getchar.c, src/normal.c, src/proto/getchar.pro, src/window.c
*** ../vim-7.1.103/src/digraph.c Sat Jul 7 13:57:39 2007
--- src/digraph.c Thu Sep 13 16:11:54 2007
***************
*** 2028,2034 ****
++no_mapping;
++allow_keys;
! c = safe_vgetc();
--no_mapping;
--allow_keys;
if (c != ESC) /* ESC cancels CTRL-K */
--- 2028,2034 ----
++no_mapping;
++allow_keys;
! c = plain_vgetc();
--no_mapping;
--allow_keys;
if (c != ESC) /* ESC cancels CTRL-K */
***************
*** 2050,2056 ****
#endif
++no_mapping;
++allow_keys;
! cc = safe_vgetc();
--no_mapping;
--allow_keys;
if (cc != ESC) /* ESC cancels CTRL-K */
--- 2050,2056 ----
#endif
++no_mapping;
++allow_keys;
! cc = plain_vgetc();
--no_mapping;
--allow_keys;
if (cc != ESC) /* ESC cancels CTRL-K */
***************
*** 2350,2356 ****
if (*curbuf->b_p_keymap == NUL)
{
/* Stop any active keymap and clear the table. Also remove
! * b:keymap_unload, as no keymap is active now. */
keymap_unload();
do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
}
--- 2350,2356 ----
if (*curbuf->b_p_keymap == NUL)
{
/* Stop any active keymap and clear the table. Also remove
! * b:keymap_name, as no keymap is active now. */
keymap_unload();
do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
}
*** ../vim-7.1.103/src/edit.c Sun Aug 12 16:38:03 2007
--- src/edit.c Thu Sep 13 16:17:54 2007
***************
*** 788,794 ****
ins_redraw(FALSE);
++no_mapping;
++allow_keys;
! c = safe_vgetc();
--no_mapping;
--allow_keys;
if (c != Ctrl_N && c != Ctrl_G && c != Ctrl_O)
--- 788,794 ----
ins_redraw(FALSE);
++no_mapping;
++allow_keys;
! c = plain_vgetc();
--no_mapping;
--allow_keys;
if (c != Ctrl_N && c != Ctrl_G && c != Ctrl_O)
***************
*** 981,987 ****
#ifdef FEAT_NETBEANS_INTG
case K_F21: /* NetBeans command */
++no_mapping; /* don't map the next key hits */
! i = safe_vgetc();
--no_mapping;
netbeans_keycommand(i);
break;
--- 981,987 ----
#ifdef FEAT_NETBEANS_INTG
case K_F21: /* NetBeans command */
++no_mapping; /* don't map the next key hits */
! i = plain_vgetc();
--no_mapping;
netbeans_keycommand(i);
break;
***************
*** 5224,5233 ****
i = 0;
for (;;)
{
! do
! nc = safe_vgetc();
! while (nc == K_IGNORE || nc == K_VER_SCROLLBAR
! || nc == K_HOR_SCROLLBAR);
#ifdef FEAT_CMDL_INFO
if (!(State & CMDLINE)
# ifdef FEAT_MBYTE
--- 5224,5230 ----
i = 0;
for (;;)
{
! nc = plain_vgetc();
#ifdef FEAT_CMDL_INFO
if (!(State & CMDLINE)
# ifdef FEAT_MBYTE
***************
*** 7575,7581 ****
* deleted when ESC is hit.
*/
++no_mapping;
! regname = safe_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(regname, TRUE);
#endif
--- 7572,7578 ----
* deleted when ESC is hit.
*/
++no_mapping;
! regname = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(regname, TRUE);
#endif
***************
*** 7586,7592 ****
#ifdef FEAT_CMDL_INFO
add_to_showcmd_c(literally);
#endif
! regname = safe_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(regname, TRUE);
#endif
--- 7583,7589 ----
#ifdef FEAT_CMDL_INFO
add_to_showcmd_c(literally);
#endif
! regname = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(regname, TRUE);
#endif
***************
*** 7677,7683 ****
* deleted when ESC is hit.
*/
++no_mapping;
! c = safe_vgetc();
--no_mapping;
switch (c)
{
--- 7674,7680 ----
* deleted when ESC is hit.
*/
++no_mapping;
! c = plain_vgetc();
--no_mapping;
switch (c)
{
***************
*** 9356,9362 ****
* mode message to be deleted when ESC is hit */
++no_mapping;
++allow_keys;
! c = safe_vgetc();
--no_mapping;
--allow_keys;
if (IS_SPECIAL(c) || mod_mask) /* special key */
--- 9353,9359 ----
* mode message to be deleted when ESC is hit */
++no_mapping;
++allow_keys;
! c = plain_vgetc();
--no_mapping;
--allow_keys;
if (IS_SPECIAL(c) || mod_mask) /* special key */
***************
*** 9388,9394 ****
}
++no_mapping;
++allow_keys;
! cc = safe_vgetc();
--no_mapping;
--allow_keys;
if (cc != ESC)
--- 9385,9391 ----
}
++no_mapping;
++allow_keys;
! cc = plain_vgetc();
--no_mapping;
--allow_keys;
if (cc != ESC)
*** ../vim-7.1.103/src/ex_cmds.c Tue Aug 21 15:28:32 2007
--- src/ex_cmds.c Thu Sep 13 16:19:40 2007
***************
*** 4498,4504 ****
*
* The new text is built up in new_start[]. It has some extra
* room to avoid using alloc()/free() too often. new_start_len is
! * the lenght of the allocated memory at new_start.
*
* Make a copy of the old line, so it won't be taken away when
* updating the screen or handling a multi-line match. The "old_"
--- 4499,4505 ----
*
* The new text is built up in new_start[]. It has some extra
* room to avoid using alloc()/free() too often. new_start_len is
! * the length of the allocated memory at new_start.
*
* Make a copy of the old line, so it won't be taken away when
* updating the screen or handling a multi-line match. The "old_"
***************
*** 4669,4675 ****
#endif
++no_mapping; /* don't map this key */
++allow_keys; /* allow special keys */
! i = safe_vgetc();
--allow_keys;
--no_mapping;
--- 4670,4676 ----
#endif
++no_mapping; /* don't map this key */
++allow_keys; /* allow special keys */
! i = plain_vgetc();
--allow_keys;
--no_mapping;
*** ../vim-7.1.103/src/ex_getln.c Mon Aug 6 22:27:12 2007
--- src/ex_getln.c Thu Sep 13 16:20:49 2007
***************
*** 641,647 ****
{
++no_mapping;
++allow_keys;
! c = safe_vgetc();
--no_mapping;
--allow_keys;
/* CTRL-\ e doesn't work when obtaining an expression. */
--- 641,647 ----
{
++no_mapping;
++allow_keys;
! c = plain_vgetc();
--no_mapping;
--allow_keys;
/* CTRL-\ e doesn't work when obtaining an expression. */
***************
*** 1091,1101 ****
#endif
putcmdline('"', TRUE);
++no_mapping;
! i = c = safe_vgetc(); /* CTRL-R <char> */
if (i == Ctrl_O)
i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */
if (i == Ctrl_R)
! c = safe_vgetc(); /* CTRL-R CTRL-R <char> */
--no_mapping;
#ifdef FEAT_EVAL
/*
--- 1091,1101 ----
#endif
putcmdline('"', TRUE);
++no_mapping;
! i = c = plain_vgetc(); /* CTRL-R <char> */
if (i == Ctrl_O)
i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */
if (i == Ctrl_R)
! c = plain_vgetc(); /* CTRL-R CTRL-R <char> */
--no_mapping;
#ifdef FEAT_EVAL
/*
*** ../vim-7.1.103/src/getchar.c Wed Sep 5 21:45:54 2007
--- src/getchar.c Thu Sep 13 16:16:53 2007
***************
*** 1597,1608 ****
}
#endif
#ifdef FEAT_GUI
! /* The caller doesn't need to know that the focus event is delayed
! * until getting a character. */
if (c == K_FOCUSGAINED || c == K_FOCUSLOST)
{
ui_focus_change(c == K_FOCUSGAINED);
! continue;
}
/* Translate K_CSI to CSI. The special key is only used to avoid
--- 1597,1609 ----
}
#endif
#ifdef FEAT_GUI
! /* Handle focus event here, so that the caller doesn't need to
! * know about it. Return K_IGNORE so that we loop once (needed if
! * 'lazyredraw' is set). */
if (c == K_FOCUSGAINED || c == K_FOCUSLOST)
{
ui_focus_change(c == K_FOCUSGAINED);
! c = K_IGNORE;
}
/* Translate K_CSI to CSI. The special key is only used to avoid
***************
*** 1744,1749 ****
--- 1745,1766 ----
c = vgetc();
if (c == NUL)
c = get_keystroke();
+ return c;
+ }
+
+ /*
+ * Like safe_vgetc(), but loop to handle K_IGNORE.
+ * Also ignore scrollbar events.
+ */
+ int
+ plain_vgetc()
+ {
+ int c;
+
+ do
+ {
+ c = safe_vgetc();
+ } while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR);
return c;
}
*** ../vim-7.1.103/src/normal.c Thu Sep 13 15:33:18 2007
--- src/normal.c Thu Sep 13 16:24:51 2007
***************
*** 696,702 ****
++allow_keys; /* no mapping for nchar, but keys */
}
++no_zero_mapping; /* don't map zero here */
! c = safe_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(c, TRUE);
#endif
--- 696,702 ----
++allow_keys; /* no mapping for nchar, but keys */
}
++no_zero_mapping; /* don't map zero here */
! c = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(c, TRUE);
#endif
***************
*** 721,727 ****
ca.count0 = 0;
++no_mapping;
++allow_keys; /* no mapping for nchar, but keys */
! c = safe_vgetc(); /* get next character */
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(c, TRUE);
#endif
--- 721,727 ----
ca.count0 = 0;
++no_mapping;
++allow_keys; /* no mapping for nchar, but keys */
! c = plain_vgetc(); /* get next character */
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(c, TRUE);
#endif
***************
*** 900,906 ****
* For 'g' get the next character now, so that we can check for
* "gr", "g'" and "g`".
*/
! ca.nchar = safe_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(ca.nchar, TRUE);
#endif
--- 900,906 ----
* For 'g' get the next character now, so that we can check for
* "gr", "g'" and "g`".
*/
! ca.nchar = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(ca.nchar, TRUE);
#endif
***************
*** 957,963 ****
im_set_active(TRUE);
#endif
! *cp = safe_vgetc();
if (langmap_active)
{
--- 957,963 ----
im_set_active(TRUE);
#endif
! *cp = plain_vgetc();
if (langmap_active)
{
***************
*** 1045,1051 ****
}
if (c > 0)
{
! c = safe_vgetc();
if (c != Ctrl_N && c != Ctrl_G)
vungetc(c);
else
--- 1045,1051 ----
}
if (c > 0)
{
! c = plain_vgetc();
if (c != Ctrl_N && c != Ctrl_G)
vungetc(c);
else
***************
*** 1064,1070 ****
while (enc_utf8 && lang && (c = vpeekc()) > 0
&& (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1))
{
! c = safe_vgetc();
if (!utf_iscomposing(c))
{
vungetc(c); /* it wasn't, put it back */
--- 1064,1070 ----
while (enc_utf8 && lang && (c = vpeekc()) > 0
&& (c >= 0x100 || MB_BYTE2LEN(vpeekc()) > 1))
{
! c = plain_vgetc();
if (!utf_iscomposing(c))
{
vungetc(c); /* it wasn't, put it back */
***************
*** 4564,4570 ****
#endif
++no_mapping;
++allow_keys; /* no mapping for nchar, but allow key codes */
! nchar = safe_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(nchar, TRUE);
#endif
--- 4564,4570 ----
#endif
++no_mapping;
++allow_keys; /* no mapping for nchar, but allow key codes */
! nchar = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(nchar, TRUE);
#endif
***************
*** 4922,4928 ****
case 'u': /* "zug" and "zuw": undo "zg" and "zw" */
++no_mapping;
++allow_keys; /* no mapping for nchar, but allow key codes */
! nchar = safe_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(nchar, TRUE);
#endif
--- 4922,4928 ----
case 'u': /* "zug" and "zuw": undo "zg" and "zw" */
++no_mapping;
++allow_keys; /* no mapping for nchar, but allow key codes */
! nchar = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(nchar, TRUE);
#endif
*** ../vim-7.1.103/src/proto/getchar.pro Sun May 6 15:04:24 2007
--- src/proto/getchar.pro Thu Sep 13 16:13:19 2007
***************
*** 38,43 ****
--- 38,44 ----
void updatescript __ARGS((int c));
int vgetc __ARGS((void));
int safe_vgetc __ARGS((void));
+ int plain_vgetc __ARGS((void));
int vpeekc __ARGS((void));
int vpeekc_nomap __ARGS((void));
int vpeekc_any __ARGS((void));
*** ../vim-7.1.103/src/window.c Sun Aug 12 16:55:01 2007
--- src/window.c Thu Sep 13 16:25:01 2007
***************
*** 584,590 ****
++no_mapping;
++allow_keys; /* no mapping for xchar, but allow key codes */
if (xchar == NUL)
! xchar = safe_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(xchar, TRUE);
#endif
--- 584,590 ----
++no_mapping;
++allow_keys; /* no mapping for xchar, but allow key codes */
if (xchar == NUL)
! xchar = plain_vgetc();
#ifdef FEAT_LANGMAP
LANGMAP_ADJUST(xchar, TRUE);
#endif
*** ../vim-7.1.103/src/version.c Thu Sep 13 15:33:18 2007
--- src/version.c Thu Sep 13 18:22:59 2007
***************
*** 668,669 ****
--- 668,671 ----
{ /* Add new patch number below this line */
+ /**/
+ 104,
/**/
--
ARTHUR: I am your king!
WOMAN: Well, I didn't vote for you.
ARTHUR: You don't vote for kings.
WOMAN: Well, 'ow did you become king then?
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///