nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] [PATCH] Window resize handling


From: Benno Schulenberg
Subject: Re: [Nano-devel] [PATCH] Window resize handling
Date: Tue, 05 May 2015 10:04:30 +0200

On Tue, May 5, 2015, at 08:53, Mahyar Abbaspour wrote:
> On Tue, May 5, 2015 at 12:37 AM, Benno Schulenberg <address@hidden> 
> wrote:
> > I have removed the section of code, and cannot notice any adverse 
> > effects.  And how could there be?  Whenever we are resizing the window, 
> > we are already in blocking mode: [...]
> 
> It's not true. You can test it by putting a fprintf(stderr, "foo"); in the 
> sigpending() if. It sometimes gets executed especially in heavy loops like 
> the file browser provided that you are dragging the mouse to the left and 
> right very fast.

Sure it will get executed sometimes.  But if that section isn't there,
the very same SIGWINCH will be handled by the second section instead.
It will not be missed.

> However as I said, in the normal use, we are almost always 
> in the blocking mode.

With "blocking mode" we mean blocking-on-input, waiting for a
keystroke, right?  Not signal-blocking-mode.

> Ok, I will place allow_pending_sigwinch(FALSE) after the while loop
> and change the toggle mechanism in the signal handler to sigwinch_flag++.
> Is it ok?

I don't know.  This whole asynchronous signalling is confusing me.  :)

What I don't get is: when wgetch() is patiently waiting for input,
waiting and waiting, and we don't type anything, how then can the
screen ever be regenerated?  Apparently wgetch() returns with an
ERR as soon as a SIGWINCH occurs (or any other signal, probably)?

Anyway, when we are now handling a SIGWINCH in a single place,
there is no longer any need to be blocking SIGWINCH.  Let it occur
whenever it likes (well, not during spell checking and linting and
such stuff; but during normal nano operations, fine).  As many
SIGWINCHes can occur as they like, they will only get noticed
and handled when nano is again looking for input.  So I think
any allow_pending_sigwinch() can be removed from src/winio.c.

Ah, there is one situation where nano will fail to handle SIGWINCHes:
when it is searching through a giant file (that is: when nodelay_mode
is TRUE).  But leave that case for now; we will correct it later.

Benno

-- 
http://www.fastmail.com - The way an email service should be




reply via email to

[Prev in Thread] Current Thread [Next in Thread]