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: Fri, 24 Apr 2015 19:23:32 +0430

On Thu, Apr 23, 2015 at 4:18 PM, Mahyar Abbaspour <address@hidden> wrote:

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


Hi,

Here is the patch containing those fixes. Please apply it after applying the previous patch.

Index: src/browser.c
===================================================================
--- src/browser.c    (revision 5213)
+++ src/browser.c    (working copy)
@@ -124,6 +124,16 @@
 
 #ifndef NANO_TINY
         if (kbinput == KEY_WINCH) {
+        /* Reset global varibales that are necessary */
+        filelist = NULL;
+        filelist_len = 0;
+        width = 0;
+        longest = 0;
+        /* We have closed dir stream so we have to reopen it */
+        dir = opendir(path);
+        browser_init(path, dir);
+        qsort(filelist, filelist_len, sizeof(char *), diralphasort);
+        titlebar(path);
         curs_set(0);
         continue;
         }
Index: src/help.c
===================================================================
--- src/help.c    (revision 5213)
+++ src/help.c    (working copy)
@@ -124,6 +124,17 @@
 
 #ifndef NANO_TINY
     if (kbinput == KEY_WINCH) {
+        ptr = help_text;
+        /* The window dimensions have changed. Recalculate last_line */
+        last_line = 0;
+        for (; *ptr != '\0'; last_line++) {
+        ptr += help_line_len(ptr);
+        if (*ptr == '\n')
+            ptr++;
+        }
+        if (last_line > 0)
+        last_line--;
+
         curs_set(0);
         continue;
     }
Index: src/nano.h
===================================================================
--- src/nano.h    (revision 5213)
+++ src/nano.h    (working copy)
@@ -117,7 +117,7 @@
 #include <regex.h>
 #endif
 #ifndef NANO_TINY
-#include <setjmp.h>
+#include <signal.h>
 #endif
 #include <assert.h>
 
Index: src/text.c
===================================================================
--- src/text.c    (revision 5213)
+++ src/text.c    (working copy)
@@ -2207,8 +2207,6 @@
 
     edit_refresh();
 
-    statusbar(_("Can now UnJustify!"));
-
     /* If constant cursor position display is on, make sure the current
      * cursor position will be properly displayed on the statusbar. */
     if (ISSET(CONST_UPDATE))
@@ -2220,7 +2218,15 @@
 
     /* Now get a keystroke and see if it's unjustify.  If not, put back
      * the keystroke and return. */
-    kbinput = do_input(FALSE);
+#ifndef NANO_TINY
+    do {
+#endif
+        statusbar(_("Can now UnJustify!"));
+        kbinput = do_input(FALSE);
+#ifndef NANO_TINY
+    } while (kbinput == KEY_WINCH);
+#endif
+
     func = func_from_key(&kbinput);
 
     if (func == do_uncut_text) {

Regards,
--

Mahyar

reply via email to

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