Patch 8.0.0275

184 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 31, 2017, 4:08:13 PM1/31/17
to vim...@googlegroups.com

Patch 8.0.0275
Problem: When checking for CTRL-C typed the GUI may detect a screen resize
and redraw the screen, causing trouble.
Solution: Set updating_screen in ui_breakcheck().
Files: src/ui.c


*** ../vim-8.0.0274/src/ui.c 2016-09-29 15:18:51.351768068 +0200
--- src/ui.c 2017-01-31 22:05:10.684588423 +0100
***************
*** 363,374 ****
--- 363,381 ----
void
ui_breakcheck_force(int force)
{
+ int save_us = updating_screen;
+
+ /* We do not want gui_resize_shell() to redraw the screen here. */
+ ++updating_screen;
+
#ifdef FEAT_GUI
if (gui.in_use)
gui_mch_update();
else
#endif
mch_breakcheck(force);
+
+ updating_screen = save_us;
}

/*****************************************************************************
*** ../vim-8.0.0274/src/version.c 2017-01-31 21:53:35.045154104 +0100
--- src/version.c 2017-01-31 22:06:35.724031905 +0100
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 275,
/**/

--
TIM: Too late.
ARTHUR: What?
TIM: There he is!
[They all turn, and see a large white RABBIT lollop a few yards out of the
cave. Accompanied by terrifying chord and jarring metallic monster noise.]
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Feb 28, 2017, 8:05:49 AM2/28/17
to vim...@googlegroups.com
On Di, 31 Jan 2017, Bram Moolenaar wrote:

> Patch 8.0.0275
> Problem: When checking for CTRL-C typed the GUI may detect a screen resize
> and redraw the screen, causing trouble.
> Solution: Set updating_screen in ui_breakcheck().
> Files: src/ui.c

Either this patch or 274¹ breaks :simalt command on windows. Use
:simalt ~x and notice how the screen will be correctly resized but the
actual drawn window looks like before. A :redraw fixes that issue.

Note: patch 299 does not fix the issue.

I looked into the source, but it's not obvious to me how to fix this.

¹I checked from the repository here. vim/vim-win32-installer There are
only releases for 273 and 275 and the bug started happening with the 275
release.

Mit freundlichen Grüßen
Christian
--
Die Meisterschaft gilt oft für Egoismus.
-- Goethe, Maximen und Reflektionen, Nr. 453

Bram Moolenaar

unread,
Feb 28, 2017, 3:54:21 PM2/28/17
to vim...@googlegroups.com, Christian Brabandt

Christian Brabandt wrote:

> On Di, 31 Jan 2017, Bram Moolenaar wrote:
>
> > Patch 8.0.0275
> > Problem: When checking for CTRL-C typed the GUI may detect a screen resize
> > and redraw the screen, causing trouble.
> > Solution: Set updating_screen in ui_breakcheck().
> > Files: src/ui.c
>
> Either this patch or 274¹ breaks :simalt command on windows. Use
> :simalt ~x and notice how the screen will be correctly resized but the
> actual drawn window looks like before. A :redraw fixes that issue.
>
> Note: patch 299 does not fix the issue.
>
> I looked into the source, but it's not obvious to me how to fix this.
>
> ¹I checked from the repository here. vim/vim-win32-installer There are
> only releases for 273 and 275 and the bug started happening with the 275
> release.

Is this in the GUI or in the console?

I suppose the resize callback is invoked shen checking for input, and
then the screen update isn't reached. Perhaps inserting <Nop> in the
input queue would help?

--
What a wonderfully exciting cough! Do you mind if I join you?
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

Christian Brabandt

unread,
Mar 1, 2017, 2:18:33 AM3/1/17
to vim...@googlegroups.com
Hi Bram!

On Di, 28 Feb 2017, Bram Moolenaar wrote:

>
> Christian Brabandt wrote:
>
> > On Di, 31 Jan 2017, Bram Moolenaar wrote:
> >
> > > Patch 8.0.0275
> > > Problem: When checking for CTRL-C typed the GUI may detect a screen resize
> > > and redraw the screen, causing trouble.
> > > Solution: Set updating_screen in ui_breakcheck().
> > > Files: src/ui.c
> >
> > Either this patch or 274¹ breaks :simalt command on windows. Use
> > :simalt ~x and notice how the screen will be correctly resized but the
> > actual drawn window looks like before. A :redraw fixes that issue.
> >
> > Note: patch 299 does not fix the issue.
> >
> > I looked into the source, but it's not obvious to me how to fix this.
> >
> > ¹I checked from the repository here. vim/vim-win32-installer There are
> > only releases for 273 and 275 and the bug started happening with the 275
> > release.
>
> Is this in the GUI or in the console?

I noticed in the GUI. I checked again for the console, but it seems
:simalt is not available on console vim.

> I suppose the resize callback is invoked shen checking for input, and
> then the screen update isn't reached. Perhaps inserting <Nop> in the
> input queue would help?

perhaps. I tried various redraw_later()/update_screen() calls, but those
did not work. Any particular toy patch I could try?

Best,
Christian

Christian Brabandt

unread,
Apr 20, 2017, 3:50:35 PM4/20/17
to vim...@googlegroups.com
I tried with this patch:
diff --git a/src/gui_w32.c b/src/gui_w32.c
index fc566abee..9aac174f2 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2637,6 +2637,7 @@ ex_simalt(exarg_T *eap)
PostMessage(s_hwnd, WM_CHAR, (WPARAM)*keys, (LPARAM)0);
keys++;
}
+ server_to_input_buf((char_u *)"<C-\><C-G>");
}

/*

And that fixes the issue. I tried using <Nop> but that one does seem to
be only replaced in do_map() so that would be literally translated to
the commands <, N, o, p and threw an error message for not finding the
last search pattern.

One might need to add some ifdefs however, don't know if
server_to_input() is always available on Windows.

Best,
Christian

Bram Moolenaar

unread,
Apr 20, 2017, 5:07:53 PM4/20/17
to vim...@googlegroups.com, Christian Brabandt

Christian Brabandt wrote:

> On Mi, 01 Mär 2017, Christian Brabandt wrote:
>
> > On Di, 28 Feb 2017, Bram Moolenaar wrote:
> > > I suppose the resize callback is invoked shen checking for input, and
> > > then the screen update isn't reached. Perhaps inserting <Nop> in the
> > > input queue would help?
> >
> > perhaps. I tried various redraw_later()/update_screen() calls, but those
> > did not work. Any particular toy patch I could try?
>
> I tried with this patch:
> diff --git a/src/gui_w32.c b/src/gui_w32.c
> index fc566abee..9aac174f2 100644
> --- a/src/gui_w32.c
> +++ b/src/gui_w32.c
> @@ -2637,6 +2637,7 @@ ex_simalt(exarg_T *eap)
> PostMessage(s_hwnd, WM_CHAR, (WPARAM)*keys, (LPARAM)0);
> keys++;
> }
> + server_to_input_buf((char_u *)"<C-\><C-G>");
> }
>
> /*

Hmm, doesn't that have side effects? It takes Vim to Normal mode.

> And that fixes the issue. I tried using <Nop> but that one does seem to
> be only replaced in do_map() so that would be literally translated to
> the commands <, N, o, p and threw an error message for not finding the
> last search pattern.
>
> One might need to add some ifdefs however, don't know if
> server_to_input() is always available on Windows.

How about using K_IGNORE instead? In the input buffer that's K_SPECIAL
KS_EXTRA KE_IGNORE (three bytes).

--
Windows
M!uqoms

Christian Brabandt

unread,
Apr 20, 2017, 6:02:43 PM4/20/17
to vim...@googlegroups.com
On Do, 20 Apr 2017, Bram Moolenaar wrote:

> How about using K_IGNORE instead? In the input buffer that's K_SPECIAL
> KS_EXTRA KE_IGNORE (three bytes).

Thanks that helps. How about this patch then:

diff --git a/src/gui_w32.c b/src/gui_w32.c
index fc566abee..4d9eaab92 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -2627,7 +2627,9 @@ gui_mch_set_curtab(int nr)
void
ex_simalt(exarg_T *eap)
{
- char_u *keys = eap->arg;
+ char_u *keys = eap->arg;
+ int fill_typebuf = FALSE;
+ char_u key_name[3];

PostMessage(s_hwnd, WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)0);
while (*keys)
@@ -2636,6 +2638,15 @@ ex_simalt(exarg_T *eap)
*keys = ' '; /* for showing system menu */
PostMessage(s_hwnd, WM_CHAR, (WPARAM)*keys, (LPARAM)0);
keys++;
+ fill_typebuf = TRUE;
+ }
+ if (fill_typebuf)
+ {
+ key_name[0] = K_SPECIAL;
+ key_name[1] = KS_EXTRA;
+ key_name[2] = KE_IGNORE;
+ typebuf_was_filled = TRUE;
+ (void)ins_typebuf(key_name, REMAP_NONE, 0, TRUE, FALSE);
}
}


In fact, even simply setting typebuf_was_filled seems to be enough.
However, as I don't know what the input typebuf will then look like, I
added the K_IGNORE as suggested.

Best,
Christian
--
Eine gute Rede ist eine Ansprache, die das Thema erschöpft, aber
keineswegs die Zuhörer.
-- Winston Spencer Churchill

Bram Moolenaar

unread,
Apr 22, 2017, 9:18:02 AM4/22/17
to vim...@googlegroups.com, Christian Brabandt
Not sure if that makes a difference, would depend on from where
ex_simalt() was called.

We do need to append a NUL to key_name!

--
MARTHA'S WAY: Don't throw out all that leftover wine. Freeze into ice cubes
for future use in casseroles and sauces.
MY WAY: What leftover wine?

Christian Brabandt

unread,
Apr 22, 2017, 2:59:32 PM4/22/17
to vim...@googlegroups.com
On Sa, 22 Apr 2017, Bram Moolenaar wrote:

> We do need to append a NUL to key_name!

Thanks for fixing this for me. I somehow thought it would be initialized
with NUL.

Best,
Christian
--
Das beste vom Sonntag ist der Samstagabend.

Christian Brabandt

unread,
Apr 25, 2017, 4:19:56 AM4/25/17
to vim...@googlegroups.com
Hi vim_dev!

On Sa, 22 Apr 2017, Christian Brabandt wrote:

> On Sa, 22 Apr 2017, Bram Moolenaar wrote:
>
> > We do need to append a NUL to key_name!
>
> Thanks for fixing this for me. I somehow thought it would be initialized
> with NUL.

Strangely now the simalt command still does not work. Can other people
still reproduce the issue or is this fixed for them?

Best,
Christian
--
Reale Windows Meldung:
"Die Arbeitsstation hat kein Vertrauensgeheimnis."

David Fishburn

unread,
Apr 25, 2017, 8:53:27 AM4/25/17
to vim_dev
On Tue, Apr 25, 2017 at 4:19 AM, Christian Brabandt <cbl...@256bit.org> wrote:
Hi vim_dev!

On Sa, 22 Apr 2017, Christian Brabandt wrote:

> On Sa, 22 Apr 2017, Bram Moolenaar wrote:
>
> > We do need to append a NUL to key_name!
>
> Thanks for fixing this for me. I somehow thought it would be initialized
> with NUL.

Strangely now the simalt command still does not work. Can other people
still reproduce the issue or is this fixed for them?


VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr  5 2017 08:20:27)
MS-Windows 32-bit GUI version with OLE support
Included patches: 1-543

I just ran:
:simalt f

Worked fine on my Windows 10 box.

David 

Christian Brabandt

unread,
Apr 25, 2017, 2:23:23 PM4/25/17
to vim_dev, abu...@gmail.com
On Di, 25 Apr 2017, David Fishburn wrote:

> VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr  5 2017 08:20:27)
> MS-Windows 32-bit GUI version with OLE support
> Included patches: 1-543
>
> I just ran:
> :simalt f
>
> Worked fine on my Windows 10 box.

Please try with a non-full screen version:
simalt ~x

This shows like that until 8.0.578:
https://i.snag.gy/3VfqUe.jpg

Patch 8.0.578 was supposed to fix that and my broken patch worked for me
https://github.com/chrisbra/vim-win32-installer/commit/4238d7e9d5f46fe6e33f2a6350cd22b19da21334
(Windows Binary available here for test:
https://github.com/chrisbra/vim-win32-installer/releases/tag/v8.0.0575_cb)

However Patch 8.0.578 does not (Binary taken from here:
https://github.com/vim/vim-win32-installer/releases/tag/v8.0.0586).

Can someone confirm?

CC' Al, who also noticed that bug.

Best,
Christian
--
Die beste Art sich zu rächen: Nicht Gleiches mit Gleichem vergelten.
-- Marc Aurel (römischer Kaiser, 121-180)

KF Leong

unread,
Apr 26, 2017, 12:16:40 AM4/26/17
to vim_dev, abu...@gmail.com
>
> Patch 8.0.578 was supposed to fix that and my broken patch worked for me
> https://github.com/chrisbra/vim-win32-installer/commit/4238d7e9d5f46fe6e33f2a6350cd22b19da21334
> (Windows Binary available here for test:
> https://github.com/chrisbra/vim-win32-installer/releases/tag/v8.0.0575_cb)
>
This build works for me.

> However Patch 8.0.578 does not (Binary taken from here:
> https://github.com/vim/vim-win32-installer/releases/tag/v8.0.0586).

This build does not.

From your broken patch (v8.0.0575_cb):
+ char_u key_name[2];
...


+ key_name[0] = K_SPECIAL;
+ key_name[1] = KS_EXTRA;
+ key_name[2] = KE_IGNORE;

More keys than it should inserted in typeahead buffer?

HTH.
KF

Christian Brabandt

unread,
Apr 28, 2017, 3:05:22 PM4/28/17
to vim_dev
I already said, that patch was not correct. Please try this one instead:
https://github.com/chrisbra/vim-win32-installer/releases/tag/v8.0.0587

This uses NOP instead of IGNORE and from my testing this works.


Best,
Christian
--
Den seelischen Wert einer Frau erkennst du daran, wie sie zu altern
versteht.
-- Christian Morgenstern

KF Leong

unread,
Apr 28, 2017, 9:50:44 PM4/28/17
to vim_dev
> https://github.com/chrisbra/vim-win32-installer/releases/tag/v8.0.0587
>
> This uses NOP instead of IGNORE and from my testing this works.
Yes, this build works. Thanks for the work!

KF

Bram Moolenaar

unread,
Apr 29, 2017, 11:39:27 AM4/29/17
to vim...@googlegroups.com, Christian Brabandt

Christian Brabandt wrote:

> On Di, 25 Apr 2017, KF Leong wrote:
> > > Patch 8.0.578 was supposed to fix that and my broken patch worked for me
> > > https://github.com/chrisbra/vim-win32-installer/commit/4238d7e9d5f46fe6e33f2a6350cd22b19da21334
> > > (Windows Binary available here for test:
> > > https://github.com/chrisbra/vim-win32-installer/releases/tag/v8.0.0575_cb)
> > >
> > This build works for me.
> >
> > > However Patch 8.0.578 does not (Binary taken from here:
> > > https://github.com/vim/vim-win32-installer/releases/tag/v8.0.0586).
> > This build does not.
> >
> > From your broken patch (v8.0.0575_cb):
> > + char_u key_name[2];
> > ...
> > + key_name[0] = K_SPECIAL;
> > + key_name[1] = KS_EXTRA;
> > + key_name[2] = KE_IGNORE;
> >
> > More keys than it should inserted in typeahead buffer?
>
> I already said, that patch was not correct. Please try this one instead:
> https://github.com/chrisbra/vim-win32-installer/releases/tag/v8.0.0587
>
> This uses NOP instead of IGNORE and from my testing this works.

Wait, I thought those releases were made from the official release
repository. Did you make a change on top of that?

--
In Africa some of the native tribes have a custom of beating the ground
with clubs and uttering spine chilling cries. Anthropologists call
this a form of primitive self-expression. In America we call it golf.

Christian Brabandt

unread,
Apr 30, 2017, 1:03:29 PM4/30/17
to vim...@googlegroups.com
On Sa, 29 Apr 2017, Bram Moolenaar wrote:

> > > > https://github.com/chrisbra/vim-win32-installer...

That is my private fork of the official win32-installer repository:

> > > > https://github.com/vim/vim-win32-installer/releases/tag/v8.0.0586

> Wait, I thought those releases were made from the official release
> repository. Did you make a change on top of that?

Yeah, its a bit confusing. My Windows build machine went away, the only
way to test patches for me is to drop a patch file below the patch path
like this one:

https://github.com/chrisbra/vim-win32-installer/blob/master/patch/simalt.patch

commit and tag it and run the update script. This will build new
releases on appveyor and push it back to my private fork that I can then
test locally.

BTW: thanks for applying the patch so quickly.

Best,
Christian
--
Die Schutzgemeinschaft enttäuschter Wintersportfreunde e.V. fordert
für das gesamte Alpengebiet die Anbringung deutlich lesbarer
Gütesiegel auf der Rückseite der Neuschneedecke.
-- Loriot (Vicco von Bülow)
Reply all
Reply to author
Forward
0 new messages