From e7aeb77bd9ad8235aaa0e7efa17bcdcf11cfd09d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 3 May 2020 15:44:38 +0100 Subject: [PATCH] Use the cursor position not the current position when working out which marks are current. --- window-copy.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/window-copy.c b/window-copy.c index 9f84ade9..ce6bcb72 100644 --- a/window-copy.c +++ b/window-copy.c @@ -3057,25 +3057,28 @@ window_copy_update_style(struct window_mode_entry *wme, u_int fx, u_int fy, const struct grid_cell *cgc) { struct window_copy_mode_data *data = wme->data; - u_int mark, at, start, end, cy; + u_int mark, start, end, cy, cursor, current; u_int sx = screen_size_x(data->backing); if (data->searchmark == NULL) return; - mark = data->searchmark[(fy * sx) + fx]; + + current = (fy * sx) + fx; + + mark = data->searchmark[current]; if (mark == 0) return; cy = screen_hsize(data->backing) - data->oy + data->cy; - at = (cy * sx) + data->cx; - if (data->searchmark[at] == mark) { - window_copy_match_start_end(data, at, &start, &end); - if (at >= start && at <= end) { + cursor = (cy * sx) + data->cx; + if (data->searchmark[cursor] == mark) { + window_copy_match_start_end(data, cursor, &start, &end); + if (current >= start && current <= end) { gc->attr = cgc->attr; gc->fg = cgc->fg; gc->bg = cgc->bg; + return; } - return; } gc->attr = mgc->attr;