aboutsummaryrefslogtreecommitdiff
path: root/selection.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-10-11 16:18:18 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-10-11 16:18:18 +0000
commit4ad7fdc19c386fada4e1f8401d6da95f2930c201 (patch)
treef79012e93e785e71083f8a658f5e2f21ab9a44f9 /selection.c
parentinput: auto-scroll: apply scrollback.multiplier to the interval divisor (diff)
selection: auto-scroll: add SELECTION_SCROLL_NOT as a scroll ‘direction’
Diffstat (limited to 'selection.c')
-rw-r--r--selection.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/selection.c b/selection.c
index c774c713..20ed011c 100644
--- a/selection.c
+++ b/selection.c
@@ -817,6 +817,9 @@ fdm_scroll_timer(struct fdm *fdm, int fd, int events, void *data)
}
switch (term->selection.auto_scroll.direction) {
+ case SELECTION_SCROLL_NOT:
+ return true;
+
case SELECTION_SCROLL_UP:
for (uint64_t i = 0; i < expiration_count; i++)
cmd_scrollback_up(term, 1);
@@ -838,6 +841,8 @@ void
selection_start_scroll_timer(struct terminal *term, int interval_ns,
enum selection_scroll_direction direction, int col)
{
+ assert(direction != SELECTION_SCROLL_NOT);
+
if (!term->selection.ongoing)
return;
@@ -875,7 +880,6 @@ selection_start_scroll_timer(struct terminal *term, int interval_ns,
term->selection.auto_scroll.direction = direction;
term->selection.auto_scroll.col = col;
-
return;
err:
@@ -886,11 +890,14 @@ err:
void
selection_stop_scroll_timer(struct terminal *term)
{
- if (term->selection.auto_scroll.fd < 0)
+ if (term->selection.auto_scroll.fd < 0) {
+ assert(term->selection.auto_scroll.direction == SELECTION_SCROLL_NOT);
return;
+ }
fdm_del(term->fdm, term->selection.auto_scroll.fd);
term->selection.auto_scroll.fd = -1;
+ term->selection.auto_scroll.direction = SELECTION_SCROLL_NOT;
}
static void