diff options
Diffstat (limited to 'src/selection.c')
| -rw-r--r-- | src/selection.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/selection.c b/src/selection.c index b05a43c..4602d8f 100644 --- a/src/selection.c +++ b/src/selection.c @@ -281,14 +281,16 @@ static uint32_t line_seg_start_off(const struct lines *L, uint64_t id, int seg) static bool view_row_line(const struct lines *L, int y, uint64_t *id, int *seg) { const struct term *t = L->t; - int y_scr; - if (term_hist_view_row_pos(&t->view, &t->hist, L->cols, t->rows, screen_top_line(t), y, - id, seg, &y_scr)) + struct hist_view_pos pos; + if (term_hist_view_row_pos(&t->view, &t->hist, L->cols, t->rows, screen_top_line(t), y, &pos)) { + *id = pos.id; + *seg = pos.seg; return true; - if (y_scr >= lines_rows(L)) - y_scr = lines_rows(L) - 1; - *id = L->pos[y_scr].id; - *seg = (int)L->pos[y_scr].seg; + } + if (pos.screen_y >= lines_rows(L)) + pos.screen_y = lines_rows(L) - 1; + *id = L->pos[pos.screen_y].id; + *seg = (int)L->pos[pos.screen_y].seg; return true; } |
