refactor: add a ‘range’ struct, grouping a start and end coord together

This commit is contained in:
Daniel Eklöf 2022-04-09 15:09:02 +02:00
parent c7dd30742a
commit 5b1f1602bc
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 105 additions and 96 deletions

View file

@ -2121,8 +2121,9 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
auto_scroll_direction, selection_col); auto_scroll_direction, selection_col);
} }
if (term->selection.ongoing && (cursor_is_on_new_cell || if (term->selection.ongoing && (
term->selection.end.row < 0)) cursor_is_on_new_cell ||
term->selection.coords.end.row < 0))
{ {
selection_update(term, selection_col, selection_row); selection_update(term, selection_col, selection_row);
} }

View file

@ -3231,7 +3231,7 @@ render_urls(struct terminal *term)
continue; continue;
bool hide = false; bool hide = false;
const struct coord *pos = &url->start; const struct coord *pos = &url->range.start;
const int _row const int _row
= (pos->row = (pos->row
- scrollback_end - scrollback_end
@ -3701,14 +3701,14 @@ maybe_resize(struct terminal *term, int width, int height, bool force)
* tracking points list. * tracking points list.
*/ */
struct coord *const tracking_points[] = { struct coord *const tracking_points[] = {
&term->selection.start, &term->selection.coords.start,
&term->selection.end, &term->selection.coords.end,
}; };
/* Resize grids */ /* Resize grids */
grid_resize_and_reflow( grid_resize_and_reflow(
&term->normal, new_normal_grid_rows, new_cols, old_rows, new_rows, &term->normal, new_normal_grid_rows, new_cols, old_rows, new_rows,
term->selection.end.row >= 0 ? ALEN(tracking_points) : 0, term->selection.coords.end.row >= 0 ? ALEN(tracking_points) : 0,
tracking_points); tracking_points);
grid_resize_without_reflow( grid_resize_without_reflow(

View file

@ -450,11 +450,11 @@ search_match_to_end_of_word(struct terminal *term, bool spaces_only)
if (term->search.match_len == 0) if (term->search.match_len == 0)
return; return;
xassert(term->selection.end.row != -1); xassert(term->selection.coords.end.row != -1);
const bool move_cursor = term->search.cursor == term->search.len; const bool move_cursor = term->search.cursor == term->search.len;
const struct coord old_end = term->selection.end; const struct coord old_end = term->selection.coords.end;
struct coord new_end = old_end; struct coord new_end = old_end;
struct row *row = NULL; struct row *row = NULL;

View file

@ -45,16 +45,16 @@ selection_on_rows(const struct terminal *term, int row_start, int row_end)
term->selection.start.row, term->selection.end.row, term->selection.start.row, term->selection.end.row,
row_start, row_end, term->grid->offset); row_start, row_end, term->grid->offset);
if (term->selection.end.row < 0) if (term->selection.coords.end.row < 0)
return false; return false;
xassert(term->selection.start.row != -1); xassert(term->selection.coords.start.row != -1);
row_start += term->grid->offset; row_start += term->grid->offset;
row_end += term->grid->offset; row_end += term->grid->offset;
const struct coord *start = &term->selection.start; const struct coord *start = &term->selection.coords.start;
const struct coord *end = &term->selection.end; const struct coord *end = &term->selection.coords.end;
if ((row_start <= start->row && row_end >= start->row) || if ((row_start <= start->row && row_end >= start->row) ||
(row_start <= end->row && row_end >= end->row)) (row_start <= end->row && row_end >= end->row))
@ -79,29 +79,29 @@ selection_on_rows(const struct terminal *term, int row_start, int row_end)
void void
selection_view_up(struct terminal *term, int new_view) selection_view_up(struct terminal *term, int new_view)
{ {
if (likely(term->selection.start.row < 0)) if (likely(term->selection.coords.start.row < 0))
return; return;
if (likely(new_view < term->grid->view)) if (likely(new_view < term->grid->view))
return; return;
term->selection.start.row += term->grid->num_rows; term->selection.coords.start.row += term->grid->num_rows;
if (term->selection.end.row >= 0) if (term->selection.coords.end.row >= 0)
term->selection.end.row += term->grid->num_rows; term->selection.coords.end.row += term->grid->num_rows;
} }
void void
selection_view_down(struct terminal *term, int new_view) selection_view_down(struct terminal *term, int new_view)
{ {
if (likely(term->selection.start.row < 0)) if (likely(term->selection.coords.start.row < 0))
return; return;
if (likely(new_view > term->grid->view)) if (likely(new_view > term->grid->view))
return; return;
term->selection.start.row &= term->grid->num_rows - 1; term->selection.coords.start.row &= term->grid->num_rows - 1;
if (term->selection.end.row >= 0) if (term->selection.coords.end.row >= 0)
term->selection.end.row &= term->grid->num_rows - 1; term->selection.coords.end.row &= term->grid->num_rows - 1;
} }
static void static void
@ -251,7 +251,7 @@ extract_one_const_wrapper(struct terminal *term,
char * char *
selection_to_text(const struct terminal *term) selection_to_text(const struct terminal *term)
{ {
if (term->selection.end.row == -1) if (term->selection.coords.end.row == -1)
return NULL; return NULL;
struct extraction_context *ctx = extract_begin(term->selection.kind, true); struct extraction_context *ctx = extract_begin(term->selection.kind, true);
@ -259,7 +259,7 @@ selection_to_text(const struct terminal *term)
return NULL; return NULL;
foreach_selected( foreach_selected(
(struct terminal *)term, term->selection.start, term->selection.end, (struct terminal *)term, term->selection.coords.start, term->selection.coords.end,
&extract_one_const_wrapper, ctx); &extract_one_const_wrapper, ctx);
char *text; char *text;
@ -479,11 +479,11 @@ selection_start(struct terminal *term, int col, int row,
switch (kind) { switch (kind) {
case SELECTION_CHAR_WISE: case SELECTION_CHAR_WISE:
case SELECTION_BLOCK: case SELECTION_BLOCK:
term->selection.start = (struct coord){col, term->grid->view + row}; term->selection.coords.start = (struct coord){col, term->grid->view + row};
term->selection.end = (struct coord){-1, -1}; term->selection.coords.end = (struct coord){-1, -1};
term->selection.pivot.start = term->selection.start; term->selection.pivot.start = term->selection.coords.start;
term->selection.pivot.end = term->selection.end; term->selection.pivot.end = term->selection.coords.end;
break; break;
case SELECTION_WORD_WISE: { case SELECTION_WORD_WISE: {
@ -491,10 +491,10 @@ selection_start(struct terminal *term, int col, int row,
selection_find_word_boundary_left(term, &start, spaces_only); selection_find_word_boundary_left(term, &start, spaces_only);
selection_find_word_boundary_right(term, &end, spaces_only); selection_find_word_boundary_right(term, &end, spaces_only);
term->selection.start = (struct coord){ term->selection.coords.start = (struct coord){
start.col, term->grid->view + start.row}; start.col, term->grid->view + start.row};
term->selection.pivot.start = term->selection.start; term->selection.pivot.start = term->selection.coords.start;
term->selection.pivot.end = (struct coord){end.col, term->grid->view + end.row}; term->selection.pivot.end = (struct coord){end.col, term->grid->view + end.row};
selection_update(term, end.col, end.row); selection_update(term, end.col, end.row);
@ -506,9 +506,9 @@ selection_start(struct terminal *term, int col, int row,
selection_find_line_boundary_left(term, &start, spaces_only); selection_find_line_boundary_left(term, &start, spaces_only);
selection_find_line_boundary_right(term, &end, spaces_only); selection_find_line_boundary_right(term, &end, spaces_only);
term->selection.start = (struct coord){ term->selection.coords.start = (struct coord){
start.col, term->grid->view + start.row}; start.col, term->grid->view + start.row};
term->selection.pivot.start = term->selection.start; term->selection.pivot.start = term->selection.coords.start;
term->selection.pivot.end = (struct coord){end.col, term->grid->view + end.row}; term->selection.pivot.end = (struct coord){end.col, term->grid->view + end.row};
selection_update(term, end.col, end.row); selection_update(term, end.col, end.row);
@ -632,7 +632,7 @@ reset_modify_context(struct mark_context *ctx)
static void static void
selection_modify(struct terminal *term, struct coord start, struct coord end) selection_modify(struct terminal *term, struct coord start, struct coord end)
{ {
xassert(term->selection.start.row != -1); xassert(term->selection.coords.start.row != -1);
xassert(start.row != -1 && start.col != -1); xassert(start.row != -1 && start.col != -1);
xassert(end.row != -1 && end.col != -1); xassert(end.row != -1 && end.col != -1);
@ -645,16 +645,16 @@ selection_modify(struct terminal *term, struct coord start, struct coord end)
foreach_selected(term, start, end, &premark_selected, &ctx); foreach_selected(term, start, end, &premark_selected, &ctx);
reset_modify_context(&ctx); reset_modify_context(&ctx);
if (term->selection.end.row >= 0) { if (term->selection.coords.end.row >= 0) {
/* Unmark previous selection, ignoring cells that are part of /* Unmark previous selection, ignoring cells that are part of
* the new selection */ * the new selection */
foreach_selected(term, term->selection.start, term->selection.end, foreach_selected(term, term->selection.coords.start, term->selection.coords.end,
&unmark_selected, &ctx); &unmark_selected, &ctx);
reset_modify_context(&ctx); reset_modify_context(&ctx);
} }
term->selection.start = start; term->selection.coords.start = start;
term->selection.end = end; term->selection.coords.end = end;
/* Mark new selection */ /* Mark new selection */
foreach_selected(term, start, end, &mark_selected, &ctx); foreach_selected(term, start, end, &mark_selected, &ctx);
@ -744,20 +744,20 @@ set_pivot_point_for_block_and_char_wise(struct terminal *term,
void void
selection_update(struct terminal *term, int col, int row) selection_update(struct terminal *term, int col, int row)
{ {
if (term->selection.start.row < 0) if (term->selection.coords.start.row < 0)
return; return;
if (!term->selection.ongoing) if (!term->selection.ongoing)
return; return;
LOG_DBG("selection updated: start = %d,%d, end = %d,%d -> %d, %d", LOG_DBG("selection updated: start = %d,%d, end = %d,%d -> %d, %d",
term->selection.start.row, term->selection.start.col, term->selection.coords.start.row, term->selection.coords.start.col,
term->selection.end.row, term->selection.end.col, term->selection.coords.end.row, term->selection.coords.end.col,
row, col); row, col);
xassert(term->grid->view + row != -1); xassert(term->grid->view + row != -1);
struct coord new_start = term->selection.start; struct coord new_start = term->selection.coords.start;
struct coord new_end = {col, term->grid->view + row}; struct coord new_end = {col, term->grid->view + row};
/* Adjust start point if the selection has changed 'direction' */ /* Adjust start point if the selection has changed 'direction' */
@ -900,11 +900,11 @@ selection_update(struct terminal *term, int col, int row)
void void
selection_dirty_cells(struct terminal *term) selection_dirty_cells(struct terminal *term)
{ {
if (term->selection.start.row < 0 || term->selection.end.row < 0) if (term->selection.coords.start.row < 0 || term->selection.coords.end.row < 0)
return; return;
foreach_selected( foreach_selected(
term, term->selection.start, term->selection.end, &mark_selected, term, term->selection.coords.start, term->selection.coords.end, &mark_selected,
&(struct mark_context){0}); &(struct mark_context){0});
} }
@ -912,8 +912,8 @@ static void
selection_extend_normal(struct terminal *term, int col, int row, selection_extend_normal(struct terminal *term, int col, int row,
enum selection_kind new_kind) enum selection_kind new_kind)
{ {
const struct coord *start = &term->selection.start; const struct coord *start = &term->selection.coords.start;
const struct coord *end = &term->selection.end; const struct coord *end = &term->selection.coords.end;
if (start->row > end->row || if (start->row > end->row ||
(start->row == end->row && start->col > end->col)) (start->row == end->row && start->col > end->col))
@ -1020,8 +1020,8 @@ selection_extend_normal(struct terminal *term, int col, int row,
static void static void
selection_extend_block(struct terminal *term, int col, int row) selection_extend_block(struct terminal *term, int col, int row)
{ {
const struct coord *start = &term->selection.start; const struct coord *start = &term->selection.coords.start;
const struct coord *end = &term->selection.end; const struct coord *end = &term->selection.coords.end;
struct coord top_left = { struct coord top_left = {
.row = min(start->row, end->row), .row = min(start->row, end->row),
@ -1089,7 +1089,7 @@ void
selection_extend(struct seat *seat, struct terminal *term, selection_extend(struct seat *seat, struct terminal *term,
int col, int row, enum selection_kind new_kind) int col, int row, enum selection_kind new_kind)
{ {
if (term->selection.start.row < 0 || term->selection.end.row < 0) { if (term->selection.coords.start.row < 0 || term->selection.coords.end.row < 0) {
/* No existing selection */ /* No existing selection */
return; return;
} }
@ -1101,8 +1101,8 @@ selection_extend(struct seat *seat, struct terminal *term,
row += term->grid->view; row += term->grid->view;
if ((row == term->selection.start.row && col == term->selection.start.col) || if ((row == term->selection.coords.start.row && col == term->selection.coords.start.col) ||
(row == term->selection.end.row && col == term->selection.end.col)) (row == term->selection.coords.end.row && col == term->selection.coords.end.col))
{ {
/* Extension point *is* one of the current end points */ /* Extension point *is* one of the current end points */
return; return;
@ -1138,14 +1138,14 @@ selection_finalize(struct seat *seat, struct terminal *term, uint32_t serial)
selection_stop_scroll_timer(term); selection_stop_scroll_timer(term);
term->selection.ongoing = false; term->selection.ongoing = false;
if (term->selection.start.row < 0 || term->selection.end.row < 0) if (term->selection.coords.start.row < 0 || term->selection.coords.end.row < 0)
return; return;
xassert(term->selection.start.row != -1); xassert(term->selection.coords.start.row != -1);
xassert(term->selection.end.row != -1); xassert(term->selection.coords.end.row != -1);
term->selection.start.row &= (term->grid->num_rows - 1); term->selection.coords.start.row &= (term->grid->num_rows - 1);
term->selection.end.row &= (term->grid->num_rows - 1); term->selection.coords.end.row &= (term->grid->num_rows - 1);
switch (term->conf->selection_target) { switch (term->conf->selection_target) {
case SELECTION_TARGET_NONE: case SELECTION_TARGET_NONE:
@ -1169,21 +1169,21 @@ void
selection_cancel(struct terminal *term) selection_cancel(struct terminal *term)
{ {
LOG_DBG("selection cancelled: start = %d,%d end = %d,%d", LOG_DBG("selection cancelled: start = %d,%d end = %d,%d",
term->selection.start.row, term->selection.start.col, term->selection.coords.start.row, term->selection.coords.start.col,
term->selection.end.row, term->selection.end.col); term->selection.coords.end.row, term->selection.coords.end.col);
selection_stop_scroll_timer(term); selection_stop_scroll_timer(term);
if (term->selection.start.row >= 0 && term->selection.end.row >= 0) { if (term->selection.coords.start.row >= 0 && term->selection.coords.end.row >= 0) {
foreach_selected( foreach_selected(
term, term->selection.start, term->selection.end, term, term->selection.coords.start, term->selection.coords.end,
&unmark_selected, &(struct mark_context){0}); &unmark_selected, &(struct mark_context){0});
render_refresh(term); render_refresh(term);
} }
term->selection.kind = SELECTION_NONE; term->selection.kind = SELECTION_NONE;
term->selection.start = (struct coord){-1, -1}; term->selection.coords.start = (struct coord){-1, -1};
term->selection.end = (struct coord){-1, -1}; term->selection.coords.end = (struct coord){-1, -1};
term->selection.pivot.start = (struct coord){-1, -1}; term->selection.pivot.start = (struct coord){-1, -1};
term->selection.pivot.end = (struct coord){-1, -1}; term->selection.pivot.end = (struct coord){-1, -1};
term->selection.direction = SELECTION_UNDIR; term->selection.direction = SELECTION_UNDIR;
@ -1566,7 +1566,7 @@ text_to_clipboard(struct seat *seat, struct terminal *term, char *text, uint32_t
void void
selection_to_clipboard(struct seat *seat, struct terminal *term, uint32_t serial) selection_to_clipboard(struct seat *seat, struct terminal *term, uint32_t serial)
{ {
if (term->selection.start.row < 0 || term->selection.end.row < 0) if (term->selection.coords.start.row < 0 || term->selection.coords.end.row < 0)
return; return;
/* Get selection as a string */ /* Get selection as a string */

View file

@ -1157,8 +1157,10 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
.cursor = conf->cursor.color.cursor, .cursor = conf->cursor.color.cursor,
}, },
.selection = { .selection = {
.start = {-1, -1}, .coords = {
.end = {-1, -1}, .start = {-1, -1},
.end = {-1, -1},
},
.pivot = { .pivot = {
.start = {-1, -1}, .start = {-1, -1},
.end = {-1, -1}, .end = {-1, -1},
@ -2155,8 +2157,8 @@ term_erase_scrollback(struct terminal *term)
const int rel_start = (start - scrollback_start + num_rows) & mask; const int rel_start = (start - scrollback_start + num_rows) & mask;
const int rel_end = (end - scrollback_start + num_rows) & mask; const int rel_end = (end - scrollback_start + num_rows) & mask;
const int sel_start = term->selection.start.row; const int sel_start = term->selection.coords.start.row;
const int sel_end = term->selection.end.row; const int sel_end = term->selection.coords.end.row;
if (sel_end >= 0) { if (sel_end >= 0) {
/* /*
@ -2237,8 +2239,10 @@ UNITTEST
}, },
.grid = &term.normal, .grid = &term.normal,
.selection = { .selection = {
.start = {-1, -1}, .coords = {
.end = {-1, -1}, .start = {-1, -1},
.end = {-1, -1},
},
.kind = SELECTION_NONE, .kind = SELECTION_NONE,
.auto_scroll = { .auto_scroll = {
.fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK), .fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK),
@ -2281,14 +2285,14 @@ UNITTEST
term.normal.offset = 14; /* Screen covers rows 14,15,0,1,2 */ term.normal.offset = 14; /* Screen covers rows 14,15,0,1,2 */
/* Selection covers rows 15,0,1,2,3 */ /* Selection covers rows 15,0,1,2,3 */
term.selection.start = (struct coord){.row = 15}; term.selection.coords.start = (struct coord){.row = 15};
term.selection.end = (struct coord){.row = 19}; term.selection.coords.end = (struct coord){.row = 19};
term.selection.kind = SELECTION_CHAR_WISE; term.selection.kind = SELECTION_CHAR_WISE;
populate_scrollback(); populate_scrollback();
term_erase_scrollback(&term); term_erase_scrollback(&term);
xassert(term.selection.start.row < 0); xassert(term.selection.coords.start.row < 0);
xassert(term.selection.end.row < 0); xassert(term.selection.coords.end.row < 0);
xassert(term.selection.kind == SELECTION_NONE); xassert(term.selection.kind == SELECTION_NONE);
/* /*
@ -2297,18 +2301,18 @@ UNITTEST
*/ */
/* Selection covers rows 15,0 */ /* Selection covers rows 15,0 */
term.selection.start = (struct coord){.row = 15}; term.selection.coords.start = (struct coord){.row = 15};
term.selection.end = (struct coord){.row = 16}; term.selection.coords.end = (struct coord){.row = 16};
term.selection.kind = SELECTION_CHAR_WISE; term.selection.kind = SELECTION_CHAR_WISE;
populate_scrollback(); populate_scrollback();
term_erase_scrollback(&term); term_erase_scrollback(&term);
xassert(term.selection.start.row == 15); xassert(term.selection.coords.start.row == 15);
xassert(term.selection.end.row == 16); xassert(term.selection.coords.end.row == 16);
xassert(term.selection.kind == SELECTION_CHAR_WISE); xassert(term.selection.kind == SELECTION_CHAR_WISE);
term.selection.start = (struct coord){-1, -1}; term.selection.coords.start = (struct coord){-1, -1};
term.selection.end = (struct coord){-1, -1}; term.selection.coords.end = (struct coord){-1, -1};
term.selection.kind = SELECTION_NONE; term.selection.kind = SELECTION_NONE;
/* /*
@ -2502,7 +2506,7 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows
xassert(rows <= region.end - region.start); xassert(rows <= region.end - region.start);
/* Cancel selections that cannot be scrolled */ /* Cancel selections that cannot be scrolled */
if (unlikely(term->selection.end.row >= 0)) { if (unlikely(term->selection.coords.end.row >= 0)) {
/* /*
* Selection is (partly) inside either the top or bottom * Selection is (partly) inside either the top or bottom
* scrolling regions, or on (at least one) of the lines * scrolling regions, or on (at least one) of the lines
@ -2567,7 +2571,7 @@ term_scroll_reverse_partial(struct terminal *term,
xassert(rows <= region.end - region.start); xassert(rows <= region.end - region.start);
/* Cancel selections that cannot be scrolled */ /* Cancel selections that cannot be scrolled */
if (unlikely(term->selection.end.row >= 0)) { if (unlikely(term->selection.coords.end.row >= 0)) {
/* /*
* Selection is (partly) inside either the top or bottom * Selection is (partly) inside either the top or bottom
* scrolling regions, or on (at least one) of the lines * scrolling regions, or on (at least one) of the lines

View file

@ -79,6 +79,11 @@ struct coord {
int row; int row;
}; };
struct range {
struct coord start;
struct coord end;
};
struct cursor { struct cursor {
struct coord point; struct coord point;
bool lcf; bool lcf;
@ -288,8 +293,7 @@ struct url {
uint64_t id; uint64_t id;
char *url; char *url;
char32_t *key; char32_t *key;
struct coord start; struct range range;
struct coord end;
enum url_action action; enum url_action action;
bool url_mode_dont_change_url_attr; /* Entering/exiting URL mode doesnt touch the cells attr.url */ bool url_mode_dont_change_url_attr; /* Entering/exiting URL mode doesnt touch the cells attr.url */
bool osc8; bool osc8;
@ -476,15 +480,11 @@ struct terminal {
struct { struct {
enum selection_kind kind; enum selection_kind kind;
enum selection_direction direction; enum selection_direction direction;
struct coord start; struct range coords;
struct coord end;
bool ongoing; bool ongoing;
bool spaces_only; /* SELECTION_SEMANTIC_WORD */ bool spaces_only; /* SELECTION_SEMANTIC_WORD */
struct { struct range pivot;
struct coord start;
struct coord end;
} pivot;
struct { struct {
int fd; int fd;

View file

@ -411,8 +411,10 @@ auto_detected(const struct terminal *term, enum url_action action,
((struct url){ ((struct url){
.id = (uint64_t)rand() << 32 | rand(), .id = (uint64_t)rand() << 32 | rand(),
.url = url_utf8, .url = url_utf8,
.start = start, .range = {
.end = end, .start = start,
.end = end,
},
.action = action, .action = action,
.osc8 = false})); .osc8 = false}));
} }
@ -466,8 +468,10 @@ osc8_uris(const struct terminal *term, enum url_action action, url_list_t *urls)
((struct url){ ((struct url){
.id = range->id, .id = range->id,
.url = xstrdup(range->uri), .url = xstrdup(range->uri),
.start = start, .range = {
.end = end, .start = start,
.end = end,
},
.action = action, .action = action,
.url_mode_dont_change_url_attr = dont_touch_url_attr, .url_mode_dont_change_url_attr = dont_touch_url_attr,
.osc8 = true})); .osc8 = true}));
@ -486,11 +490,11 @@ remove_overlapping(url_list_t *urls, int cols)
const struct url *out = &outer->item; const struct url *out = &outer->item;
const struct url *in = &inner->item; const struct url *in = &inner->item;
uint64_t in_start = in->start.row * cols + in->start.col; uint64_t in_start = in->range.start.row * cols + in->range.start.col;
uint64_t in_end = in->end.row * cols + in->end.col; uint64_t in_end = in->range.end.row * cols + in->range.end.col;
uint64_t out_start = out->start.row * cols + out->start.col; uint64_t out_start = out->range.start.row * cols + out->range.start.col;
uint64_t out_end = out->end.row * cols + out->end.col; uint64_t out_end = out->range.end.row * cols + out->range.end.col;
if ((in_start <= out_start && in_end >= out_start) || if ((in_start <= out_start && in_end >= out_start) ||
(in_start <= out_end && in_end >= out_end) || (in_start <= out_end && in_end >= out_end) ||
@ -669,8 +673,8 @@ tag_cells_for_url(struct terminal *term, const struct url *url, bool value)
if (url->url_mode_dont_change_url_attr) if (url->url_mode_dont_change_url_attr)
return; return;
const struct coord *start = &url->start; const struct coord *start = &url->range.start;
const struct coord *end = &url->end; const struct coord *end = &url->range.end;
size_t end_r = end->row & (term->grid->num_rows - 1); size_t end_r = end->row & (term->grid->num_rows - 1);