From 23c95f1dea10ffdfc0fab115d21fbc1051584b1d Mon Sep 17 00:00:00 2001 From: Piotr Kocia Date: Sun, 30 Mar 2025 15:27:06 +0200 Subject: [PATCH] minor cleanup --- input.c | 2 ++ vimode.c | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/input.c b/input.c index 45c39ed5..fa72d390 100644 --- a/input.c +++ b/input.c @@ -3212,6 +3212,8 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, break; case TERM_SURF_GRID: { + // TODO (kociap): unsure whether mouse should cancel vimode + // or work in tandem. vimode_cancel(term); urls_reset(term); diff --git a/vimode.c b/vimode.c index 7ac6132e..a144d664 100644 --- a/vimode.c +++ b/vimode.c @@ -48,10 +48,9 @@ static struct coord cursor_to_view_relative(struct terminal *const term, cursor.row -= term->grid->view; return cursor; } -} -static struct coord view_to_offset_relative(struct terminal *const term, - struct coord coord) { +static struct coord cursor_from_view_relative(struct terminal *const term, + struct coord coord) { coord.row += term->grid->view; coord.row -= term->grid->offset; return coord; @@ -319,7 +318,6 @@ static void start_search(struct terminal *term, } static void restore_pre_search_state(struct terminal *const term) { - // TODO (kociap): update selection. damage_cursor_cell(term); term->vimode.cursor = term->vimode.search.original_cursor; damage_cursor_cell(term); @@ -828,7 +826,7 @@ static void move_cursor_delta(struct terminal *const term, cursor.col = term->cols - 1; } - term->vimode.cursor = view_to_offset_relative(term, cursor); + term->vimode.cursor = cursor_from_view_relative(term, cursor); printf("CURSOR MOVED (%d, %d) [delta=(%d, %d)]\n", term->vimode.cursor.row, term->vimode.cursor.col, delta.row, delta.col); damage_cursor_cell(term);