Use the cursor position not the current position when working out which marks

are current.
This commit is contained in:
Nicholas Marriott 2020-05-03 15:44:38 +01:00
parent cb09705df3
commit e7aeb77bd9

View File

@ -3057,26 +3057,29 @@ window_copy_update_style(struct window_mode_entry *wme, u_int fx, u_int fy,
const struct grid_cell *cgc) const struct grid_cell *cgc)
{ {
struct window_copy_mode_data *data = wme->data; 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); u_int sx = screen_size_x(data->backing);
if (data->searchmark == NULL) if (data->searchmark == NULL)
return; return;
mark = data->searchmark[(fy * sx) + fx];
current = (fy * sx) + fx;
mark = data->searchmark[current];
if (mark == 0) if (mark == 0)
return; return;
cy = screen_hsize(data->backing) - data->oy + data->cy; cy = screen_hsize(data->backing) - data->oy + data->cy;
at = (cy * sx) + data->cx; cursor = (cy * sx) + data->cx;
if (data->searchmark[at] == mark) { if (data->searchmark[cursor] == mark) {
window_copy_match_start_end(data, at, &start, &end); window_copy_match_start_end(data, cursor, &start, &end);
if (at >= start && at <= end) { if (current >= start && current <= end) {
gc->attr = cgc->attr; gc->attr = cgc->attr;
gc->fg = cgc->fg; gc->fg = cgc->fg;
gc->bg = cgc->bg; gc->bg = cgc->bg;
}
return; return;
} }
}
gc->attr = mgc->attr; gc->attr = mgc->attr;
gc->fg = mgc->fg; gc->fg = mgc->fg;