[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: |
Wed, 22 Apr 2015 10:56:09 +0200 |
Hi Mahyar,
On Tue, Apr 21, 2015, at 23:10, Mahyar Abbaspour wrote:
> As it's mentioned in the TODO list, Nano does not handle window resizes
> properly, so I decided to write a patch to handle window resizes properly
> (hopefully).
Thanks for the patch. After just some short testing, it appears
to work fine. Nice!
However, compilation failed at first:
proto.h:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘sigwinch_flag’
After inlcuding <signal.h> there, it compiled fine.
Some nitpicks:
> + if (kbinput == KEY_WINCH) {
> + browser_refresh();
> + old_selected = selected;
This last one seems superfluous, as it was done just seven lines
earlier.
(Also, please use four spaces for the first, third, fifth level indent;
it's not all tabs everywhere. Use M-P to see the difference.)
> #ifndef NANO_TINY
> +/* An imaginary key we return to caller when we get SIGWINCH */
> +#define KEY_WINCH -2
> +#endif
> +
> +#ifndef NANO_TINY
There's no need for the #endif and second #ifndef.
> --- src/text.c (revision 5213)
> +++ src/text.c (working copy)
> @@ -2207,15 +2207,6 @@
>
> edit_refresh();
>
> -#ifndef NANO_TINY
> - /* We're going to set jump_buf so that we return here after a
> - * SIGWINCH instead of to main(). Indicate this. */
> - jump_buf_main = FALSE;
> -
> - /* Return here after a SIGWINCH. */
> - sigsetjmp(jump_buf, 1);
> -#endif
Well... removing this breaks the special case for Unjustify:
right after a ^J it is possible to do an unjustify with ^U.
With your patch it is no longer possible to unjustify when
a window resize took place right after the ^J. With current
nano this works fine. (True, a highly unlikely scenario,
but...).
> /* Read in a character and interpret it. Continue doing this until
> * we get a recognized value or sequence. */
> - while ((kbinput = parse_kbinput(win)) == ERR)
> - ;
> + do {
> + kbinput = parse_kbinput(win);
> + } while (kbinput == ERR
> +#ifndef NANO_TINY
> + && kbinput != KEY_WINCH
> +#endif
> + );
Hm? I don't see what the "&& kbinput != KEY_WINCH" brings.
When kbinput == ERR it necessarily means it isn't anything else.
Benno
--
http://www.fastmail.com - A fast, anti-spam email service.
- [Nano-devel] [PATCH] Window resize handling, Mahyar Abbaspour, 2015/04/21
- Re: [Nano-devel] [PATCH] Window resize handling,
Benno Schulenberg <=
- Re: [Nano-devel] [PATCH] Window resize handling, Mahyar Abbaspour, 2015/04/22
- Re: [Nano-devel] [PATCH] Window resize handling, Benno Schulenberg, 2015/04/22
- Re: [Nano-devel] [PATCH] Window resize handling, Mahyar Abbaspour, 2015/04/23
- Re: [Nano-devel] [PATCH] Window resize handling, Mahyar Abbaspour, 2015/04/24
- Re: [Nano-devel] [PATCH] Window resize handling, Benno Schulenberg, 2015/04/24
- Re: [Nano-devel] [PATCH] Window resize handling, Mahyar Abbaspour, 2015/04/25
- Re: [Nano-devel] [PATCH] Window resize handling, Benno Schulenberg, 2015/04/26
- Re: [Nano-devel] [PATCH] Window resize handling, Mahyar Abbaspour, 2015/04/29
- Re: [Nano-devel] [PATCH] Window resize handling, Benno Schulenberg, 2015/04/29