From a05b1c516c41f148cc9b7336dc964a930d883e3c Mon Sep 17 00:00:00 2001 From: kai Date: Wed, 11 Feb 2026 13:19:37 +0100 Subject: [PATCH 1/2] fix: restore cursor after scrolling in normal mode The scroll handlers hide the cursor with hardcoded hide_cursor=1 during active scrolling. After scrolling decelerates to zero velocity, nothing restores the cursor, leaving it permanently hidden. Add scroll_active() to expose scroll velocity state, and use it to detect the scroll-to-idle transition and trigger a cursor redraw. Fixes #334 Co-Authored-By: Claude Opus 4.6 --- src/normal.c | 3 +++ src/scroll.c | 5 +++++ src/warpd.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/normal.c b/src/normal.c index e23fa743..63f56bb3 100644 --- a/src/normal.c +++ b/src/normal.c @@ -130,7 +130,10 @@ struct input_event *normal_mode(struct input_event *start_ev, int oneshot) } } + int was_scrolling = scroll_active(); scroll_tick(); + if (was_scrolling && !scroll_active()) + redraw(scr, mx, my, !show_cursor); if (mouse_process_key(ev, "up", "down", "left", "right")) { redraw(scr, mx, my, !show_cursor); continue; diff --git a/src/scroll.c b/src/scroll.c index 3416c9df..398ecc0d 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -89,3 +89,8 @@ void scroll_impart_impulse() { v += fling_velocity; } + +int scroll_active() +{ + return v > 0; +} diff --git a/src/warpd.h b/src/warpd.h index 258c8d4e..c90ee0c7 100644 --- a/src/warpd.h +++ b/src/warpd.h @@ -122,6 +122,7 @@ void scroll_tick(); void scroll_stop(); void scroll_accelerate(int direction); void scroll_decelerate(); +int scroll_active(); void hist_add(int x, int y); int hist_get(int *x, int *y); From a350ad52a7bd4724b1908b700c263568eeb244d5 Mon Sep 17 00:00:00 2001 From: kai Date: Wed, 11 Feb 2026 13:20:03 +0100 Subject: [PATCH 2/2] feat: track physical mouse/trackpad movement in normal mode The cursor overlay now follows physical mouse/trackpad movement in addition to keyboard movement (h/j/k/l). On each loop iteration, if the mouse position has changed, the cursor is redrawn at the new position. Co-Authored-By: Claude Opus 4.6 --- src/normal.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/normal.c b/src/normal.c index 63f56bb3..8abdc0fc 100644 --- a/src/normal.c +++ b/src/normal.c @@ -104,6 +104,7 @@ struct input_event *normal_mode(struct input_event *start_ev, int oneshot) mouse_reset(); redraw(scr, mx, my, !show_cursor); + int prev_mx = mx, prev_my = my; uint64_t time = 0; uint64_t last_blink_update = 0; while (1) { @@ -140,7 +141,7 @@ struct input_event *normal_mode(struct input_event *start_ev, int oneshot) } if (!ev) { - continue; + goto next; } else if (config_input_match(ev, "scroll_down")) { redraw(scr, mx, my, 1); @@ -249,6 +250,11 @@ struct input_event *normal_mode(struct input_event *start_ev, int oneshot) next: platform->mouse_get_position(&scr, &mx, &my); + if (!scroll_active() && (mx != prev_mx || my != prev_my)) + redraw(scr, mx, my, !show_cursor); + + prev_mx = mx; + prev_my = my; platform->commit(); }