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: Mahyar Abbaspour
Subject: Re: [Nano-devel] [PATCH] Window resize handling
Date: Thu, 23 Apr 2015 16:18:22 +0430

On Wed, Apr 22, 2015 at 10:51 PM, Benno Schulenberg <address@hidden> wrote:

> +    /* Let the others know the handler has been executed */
> +    sigwinch_flag = sigwinch_flag ? 0 : 1;

What if there were two SIGWINCHes during a blocking period?
Wouldn't it therefore be better to just do sigwinch_flag++?
 
When a SIGWINCH is raised during the blocking mode, wgetch() immediately returns ERR (and sets errno to EINTR) so it is impossible to get two SIGWINCHes during blocking mode. If you mean during the execution of the signal handler, we have already blocked SIGWINCH (when we established SIGWINCH signal handler).
     
Well, I can imagine the user doing ^J, then realize that the width is
wrong, then resizes the window, and then: "Darn, I forgot to unjustify
first."  However... if it was really only the width that was wrong, the
user can do <Up> and hit ^J again to rejustify things with the new
width. 

So... I will allow this tiny regression, [...]

There is no need. I fixed it :)
 
By the way, your patch still doesn't compile.  To achieve that (on my
system at least), you will have to move #include <signal.h> from nano.c
to nano.h.

Fixed.
 
There's one little awkwardness I've found while using your patch.
Run nano, hit ^G, then make the window some twenty columns
narrower, then hit <End>.  You're not at the end of the help text.
And the other way around: hit ^G, make the window significantly
wider, then hit <End>.  You find yourself in a blank expanse.
So... ideally your patch would rebuild the help screen when a
SIGWINCH has occurred.  But if that's too diffiult/ugly/expensive
to make, I will let it pass: the user can hit ^G ^G to enter the
help screen again.

Confirmed. I'm working on it.
 
Oh, make that two awkwardnesses.  Eh, no, make this a blocker.
Start nano, hit ^R ^T, then make the window so much narrower
that you lose at least one column of files and the directory requires
two pages to display.  Then hit <PageDown>.  Huh?  It has skipped
a bunch of files.  If you use <Down> instead, the cursor wil disappear
for a little while between the two pages.  Conversely, when making
the window wider when in the file browser, and the number of
required pages is reduced, it will still display the original number
of pages, thus showing several files more than once.  So also
the file list must be regenerated when a SIGWINCH occurs
while in the file browser.

During my tests, it turned out to be more than a blocker. If you make the window narrower as much as losing just one column, and then if you do any vertical movement, you would jump to random entries. I'm working to fix this too.

I will send you another patch containing those fixes. Please report any other bugs you encounter during testing.

Regards,
--

Mahyar

reply via email to

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