aboutsummaryrefslogtreecommitdiff
path: root/commands.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-19 16:49:42 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-19 16:49:42 +0000
commit08588cd0fc25128a8ec013d65ca15d8e66d28e99 (patch)
tree9d112ef453d34dfd717b19f6ce09b06e1c54ad6c /commands.c
parentterm: scrolling: calling function must clamp scroll amount (diff)
selection: handle viewport wrap around correctly
When the viewport wraps around, the selection points may be "incorrect".
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/commands.c b/commands.c
index ffe03f3b..2727c1f2 100644
--- a/commands.c
+++ b/commands.c
@@ -3,9 +3,10 @@
#define LOG_MODULE "commands"
#define LOG_ENABLE_DBG 0
#include "log.h"
-#include "terminal.h"
-#include "render.h"
#include "grid.h"
+#include "render.h"
+#include "selection.h"
+#include "terminal.h"
#include "util.h"
void
@@ -73,6 +74,7 @@ cmd_scrollback_up(struct terminal *term, int rows)
else
diff = (term->grid->num_rows - new_view) + term->grid->view;
+ selection_view_up(term, new_view);
term->grid->view = new_view;
if (diff >= 0 && diff < term->rows) {
@@ -146,6 +148,7 @@ cmd_scrollback_down(struct terminal *term, int rows)
else
diff = (term->grid->num_rows - term->grid->view) + new_view;
+ selection_view_down(term, new_view);
term->grid->view = new_view;
if (diff >= 0 && diff < term->rows) {