Thursday, October 6, 2011

Re: vim (in terminal) fails to redraw after window resizing

diff -r 409691084d19 src/os_unix.c
--- a/src/os_unix.c Tue Oct 04 21:22:44 2011 +0200
+++ b/src/os_unix.c Thu Oct 06 22:01:17 2011 -0400
@@ -5146,11 +5146,21 @@
# endif
# ifdef EINTR
if (ret == -1 && errno == EINTR)
+ {
+
+ /*
+ * Check whether window has been resized (EINTR is due to SIGWINCH)
+ */
+ if (do_resize)
+ handle_resize();
+
/* Interrupted by a signal, need to try again. We ignore msec
* here, because we do want to check even after a timeout if
* characters are available. Needed for reading output of an
* external command after the process has finished. */
goto select_eintr;
+
+ }
# endif
# ifdef __TANDEM
if (ret == -1 && errno == ENOTSUP)
(Adding vim_dev to recipients...)

Bram Moolenaar, Thu 2011-10-06 @ 23:21:29+0200:
>
> Bill Sun wrote:
>
> > I updated my Vim (from 1-250 to 1-333), after that update, Vim fails to
> > redraw the window (if the window is enlarged, Vim won't fill the gap,
> > which was filled by Vim automatically in the older version) instantly
> > when I resize the window. So I have to put my cursor on Vim (under
> > xterm) and press some (maybe any) key to make it redraw itself.
> >
> > Err... It's a little bit hard to explain that problem. I made an ogv to
> > illustrate that (Sorry, I cannot access to most video store websites, so
> > I have to attach that file).
> >
> > I'm using Arch Linux (x86_64), awesome window manager.
> > Vim version: (See attachment below)
> > System information:
> > Linux 3.0.6
> > X server 1.10.4
> > xterm 275
> > awesome 3.4.10
>
> I have noticed this too. Haven't been able to guess what causes it. If
> someone can find out if a specific patch has introduced this it would
> help a lot. It might also depend on the xterm version (although I don't
> think I updated it recently).

Attached is a patch which fixes the issue.

Previously, if the terminal window was resized while Vim was waiting for
a character to be input (in the midst of a select(2) system call), the
resulting SIGWINCH would interrupt the syscall and set do_resize to
TRUE, as it should. However, since patch 295, the select call would then
immediately be retried, without checking do_resize to see if the window
needed to be redrawn.

With this patch, Vim will call handle_resize to redraw the window before
retrying the select call if a SIGWINCH was the reason why the select was
interrupted in the first place.

-Taylor Hedberg

--
You received this message from the "vim_use" 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

No comments: