nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] [PATCH 13/15] tweaks: switch from checking SMOOTH_SCROLL to


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH 13/15] tweaks: switch from checking SMOOTH_SCROLL to checking JUMPY_SCROLLING
Date: Thu, 31 Jan 2019 19:14:48 +0100

---
 src/global.c | 8 ++++----
 src/move.c   | 8 ++++----
 src/nano.c   | 5 -----
 src/search.c | 2 +-
 src/winio.c  | 4 ++--
 5 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/global.c b/src/global.c
index 4860a079..09cec324 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1241,7 +1241,7 @@ void shortcut_init(void)
        /* Group of "Appearance" toggles. */
        add_to_sclist(MMAIN, "M-X", 0, do_toggle_void, NO_HELP);
        add_to_sclist(MMAIN, "M-C", 0, do_toggle_void, CONSTANT_SHOW);
-       add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SMOOTH_SCROLL);
+       add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, JUMPY_SCROLLING);
        add_to_sclist(MMAIN, "M-$", 0, do_toggle_void, SOFTWRAP);
 #ifdef ENABLE_LINENUMBERS
        add_to_sclist(MMAIN, "M-#", 0, do_toggle_void, LINE_NUMBERS);
@@ -1393,8 +1393,8 @@ const char *flagtostr(int flag)
                        return N_("Help mode");
                case CONSTANT_SHOW:
                        return N_("Constant cursor position display");
-               case SMOOTH_SCROLL:
-                       return N_("Smooth scrolling");
+               case JUMPY_SCROLLING:
+                       return N_("Jumpy scrolling (per half-screen)");
                case SOFTWRAP:
                        return N_("Soft wrapping of overlong lines");
                case WHITESPACE_DISPLAY:
@@ -1645,7 +1645,7 @@ sc *strtosc(const char *input)
                else if (!strcasecmp(input, "constantshow"))
                        s->toggle = CONSTANT_SHOW;
                else if (!strcasecmp(input, "smoothscroll"))
-                       s->toggle = SMOOTH_SCROLL;
+                       s->toggle = JUMPY_SCROLLING;
                else if (!strcasecmp(input, "softwrap"))
                        s->toggle = SOFTWRAP;
 #ifdef ENABLE_LINENUMBERS
diff --git a/src/move.c b/src/move.c
index 319d9c57..5a3018c7 100644
--- a/src/move.c
+++ b/src/move.c
@@ -117,7 +117,7 @@ void do_page_up(void)
 
        /* If we're not in smooth scrolling mode, put the cursor at the
         * beginning of the top line of the edit window, as Pico does. */
-       if (!ISSET(SMOOTH_SCROLL)) {
+       if (ISSET(JUMPY_SCROLLING)) {
                openfile->current = openfile->edittop;
                leftedge = openfile->firstcolumn;
                openfile->current_y = 0;
@@ -147,7 +147,7 @@ void do_page_down(void)
 
        /* If we're not in smooth scrolling mode, put the cursor at the
         * beginning of the top line of the edit window, as Pico does. */
-       if (!ISSET(SMOOTH_SCROLL)) {
+       if (ISSET(JUMPY_SCROLLING)) {
                openfile->current = openfile->edittop;
                leftedge = openfile->firstcolumn;
                openfile->current_y = 0;
@@ -501,7 +501,7 @@ void do_up(void)
 
        set_proper_index_and_pww(&leftedge, target_column, FALSE);
 
-       if (openfile->current_y == 0 && ISSET(SMOOTH_SCROLL))
+       if (openfile->current_y == 0 && !ISSET(JUMPY_SCROLLING))
                edit_scroll(BACKWARD);
        else
                edit_redraw(was_current, FLOWING);
@@ -524,7 +524,7 @@ void do_down(void)
 
        set_proper_index_and_pww(&leftedge, target_column, TRUE);
 
-       if (openfile->current_y == editwinrows - 1 && ISSET(SMOOTH_SCROLL))
+       if (openfile->current_y == editwinrows - 1 && !ISSET(JUMPY_SCROLLING))
                edit_scroll(FORWARD);
        else
                edit_redraw(was_current, FLOWING);
diff --git a/src/nano.c b/src/nano.c
index 06b20f71..8b3ca603 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2415,11 +2415,6 @@ int main(int argc, char **argv)
        }
 #endif /* ENABLE_NANORC */
 
-       if (ISSET(JUMPY_SCROLLING))
-               UNSET(SMOOTH_SCROLL);
-       else
-               SET(SMOOTH_SCROLL);
-
        if (ISSET(EMPTY_LINE))
                UNSET(MORE_SPACE);
        else
diff --git a/src/search.c b/src/search.c
index 71e1027b..cde6689e 100644
--- a/src/search.c
+++ b/src/search.c
@@ -846,7 +846,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool 
use_answer,
                /* If the target line is close to the tail of the file, put the 
last
                 * line or chunk on the bottom line of the screen; otherwise, 
just
                 * center the target line. */
-               if (rows_from_tail < editwinrows / 2 && ISSET(SMOOTH_SCROLL)) {
+               if (rows_from_tail < editwinrows / 2 && 
!ISSET(JUMPY_SCROLLING)) {
                        openfile->current_y = editwinrows - 1 - rows_from_tail;
                        adjust_viewport(STATIONARY);
                } else
diff --git a/src/winio.c b/src/winio.c
index cc80c7b3..3979c2fc 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3230,7 +3230,7 @@ void edit_redraw(filestruct *old_current, update_type 
manner)
 
        /* If the current line is offscreen, scroll until it's onscreen. */
        if (current_is_offscreen()) {
-               adjust_viewport(ISSET(SMOOTH_SCROLL) ? manner : CENTERING);
+               adjust_viewport(!ISSET(JUMPY_SCROLLING) ? manner : CENTERING);
                refresh_needed = TRUE;
                return;
        }
@@ -3276,7 +3276,7 @@ void edit_refresh(void)
 
        /* If the current line is out of view, get it back on screen. */
        if (current_is_offscreen())
-               adjust_viewport((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING 
: FLOWING);
+               adjust_viewport((focusing || ISSET(JUMPY_SCROLLING)) ? 
CENTERING : FLOWING);
 
        line = openfile->edittop;
 
-- 
2.19.2




reply via email to

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