about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-06-29 13:50:04 +0200
committerMichael Vetter <jubalh@iodoru.org>2022-06-29 13:50:04 +0200
commitc84b1b5e5d038684a6a475a251b738c3c5ffb9a5 (patch)
treeb5c8709d22d9883f26ce590cd10b7a9cc939360a /src/ui
parent449c7ce2bad75438e5cff6733366e0ada153a23e (diff)
downloadprofani-tty-c84b1b5e5d038684a6a475a251b738c3c5ffb9a5.tar.gz
Don't scroll if not needed
If we are in a window with a lot of text and press PAGE UP we scroll up
and write [scrolled] in the titlebar.

So far we also wrote [scrolled] in there even when actually nothing
happened. Like when opening a new window (/msg someone) and there is no
text inside.
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/window.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 7bd403da..e25002d6 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -598,6 +598,10 @@ win_page_up(ProfWin* window)
     int page_space = rows - 4;
     int* page_start = &(window->layout->y_pos);
 
+    // dont need to scroll
+    if (*page_start == 0)
+        return;
+
     *page_start -= page_space;
 
     // went past beginning, show first page