browser: redo the layout only when an actual resize occurred
This improves upon the previous commit. This fixes https://savannah.gnu.org/bugs/?67294 in a better way.
This commit is contained in:
@@ -421,6 +421,10 @@ char *browse(char *path)
|
||||
dir = NULL;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
resized_for_browser = FALSE;
|
||||
#endif
|
||||
|
||||
/* If something was selected before, reselect it;
|
||||
* otherwise, just select the first item (..). */
|
||||
if (present_name != NULL) {
|
||||
@@ -644,8 +648,7 @@ char *browse(char *path)
|
||||
rearrange:
|
||||
#ifndef NANO_TINY
|
||||
/* If the terminal resized (or might have), refresh the file list. */
|
||||
if (kbinput == THE_WINDOW_RESIZED || function == do_help || function == goto_dir ||
|
||||
function == do_search_backward || function == do_search_forward) {
|
||||
if (kbinput == THE_WINDOW_RESIZED || resized_for_browser) {
|
||||
/* Remember the selected file, to be able to reselect it. */
|
||||
present_name = copy_of(filelist[selected]);
|
||||
goto read_directory_contents;
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#ifndef NANO_TINY
|
||||
volatile sig_atomic_t the_window_resized = FALSE;
|
||||
/* Set to TRUE by the handler whenever a SIGWINCH occurs. */
|
||||
volatile sig_atomic_t resized_for_browser = FALSE;
|
||||
/* Same as above, but used by the file browser. */
|
||||
#endif
|
||||
|
||||
bool on_a_vt = FALSE;
|
||||
|
||||
@@ -1049,6 +1049,7 @@ void handle_sigwinch(int signal)
|
||||
{
|
||||
/* Let the input routine know that a SIGWINCH has occurred. */
|
||||
the_window_resized = TRUE;
|
||||
resized_for_browser = TRUE;
|
||||
}
|
||||
|
||||
/* Reinitialize and redraw the screen completely. */
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern volatile sig_atomic_t the_window_resized;
|
||||
extern volatile sig_atomic_t resized_for_browser;
|
||||
#endif
|
||||
|
||||
extern bool on_a_vt;
|
||||
|
||||
Reference in New Issue
Block a user