about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-03-31 21:44:34 +0100
committerJames Booth <boothj5@gmail.com>2014-03-31 21:44:34 +0100
commit3fdd9944ab81935a1b51317bff1d55cb2dd69b75 (patch)
tree0fc93283767c239d60e323ebf5e803c356c6580d /src
parent3d768527c1ad4d1ac768b64c4094ad189ca08208 (diff)
downloadprofani-tty-3fdd9944ab81935a1b51317bff1d55cb2dd69b75.tar.gz
Do not scroll to end in message window when paging
Diffstat (limited to 'src')
-rw-r--r--src/ui/core.c13
-rw-r--r--src/ui/window.c2
-rw-r--r--src/ui/window.h2
3 files changed, 13 insertions, 4 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index ab06149e..4a8a984f 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -298,7 +298,11 @@ _ui_incoming_msg(const char * const from, const char * const message,
 
     free(display_from);
 
-    ui_current_page_off();
+    ProfWin *current = wins_get_current();
+    if (!current->paged) {
+        win_move_to_end(current);
+        win_refresh(current);
+    }
 }
 
 static void
@@ -858,7 +862,7 @@ static void
 _ui_current_page_off(void)
 {
     ProfWin *current = wins_get_current();
-    win_page_off(current);
+    win_move_to_end(current);
     win_refresh(current);
 }
 
@@ -1663,6 +1667,11 @@ _win_handle_page(const wint_t * const ch)
         current->paged = 1;
         wins_refresh_current();
     }
+
+    // switch off page if last line visible
+    if ((y-1) - *page_start == page_space) {
+        current->paged = 0;
+    }
 }
 
 static void
diff --git a/src/ui/window.c b/src/ui/window.c
index 320566fd..95870847 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -114,7 +114,7 @@ win_refresh(ProfWin *window)
 }
 
 void
-win_page_off(ProfWin *window)
+win_move_to_end(ProfWin *window)
 {
     window->paged = 0;
 
diff --git a/src/ui/window.h b/src/ui/window.h
index 940c34fd..4c35c2ee 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -63,7 +63,7 @@ void win_vprint_line(ProfWin *self, const char show_char, int attrs,
 void win_print_line(ProfWin *self, const char show_char, int attrs,
     const char * const msg);
 void win_refresh(ProfWin *window);
-void win_page_off(ProfWin *window);
+void win_move_to_end(ProfWin *window);
 void win_print_time(ProfWin *window, char show_char);
 void win_presence_colour_on(ProfWin *window, const char * const presence);
 void win_presence_colour_off(ProfWin *window, const char * const presence);