mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 14:16:18 +00:00
Add support for line numbers in copy mode. A new copy-mode-line-numbers
option has the following modes: off, default (tmux's normal line numbering where 0 is the top visible line), absolute (first line in history is 1), relative (relative to the cursor) and hybrid (current line is absolute, others relative). Also adds copy-mode-line-number-style and copy-mode-current-line-number-style to set the style of the line numbers. When copy mode is entered with the mouse, line numbers stay off. From Leo Henon in GitHub issue 5025.
This commit is contained in:
8
screen.c
8
screen.c
@@ -37,6 +37,8 @@ struct screen_sel {
|
||||
u_int ex;
|
||||
u_int ey;
|
||||
|
||||
u_int clipx;
|
||||
|
||||
struct grid_cell cell;
|
||||
};
|
||||
|
||||
@@ -448,7 +450,8 @@ screen_resize_y(struct screen *s, u_int sy, int eat_empty, u_int *cy)
|
||||
/* Set selection. */
|
||||
void
|
||||
screen_set_selection(struct screen *s, u_int sx, u_int sy,
|
||||
u_int ex, u_int ey, u_int rectangle, int modekeys, struct grid_cell *gc)
|
||||
u_int ex, u_int ey, u_int rectangle, u_int clipx, int modekeys,
|
||||
struct grid_cell *gc)
|
||||
{
|
||||
if (s->sel == NULL)
|
||||
s->sel = xcalloc(1, sizeof *s->sel);
|
||||
@@ -462,6 +465,7 @@ screen_set_selection(struct screen *s, u_int sx, u_int sy,
|
||||
s->sel->sy = sy;
|
||||
s->sel->ex = ex;
|
||||
s->sel->ey = ey;
|
||||
s->sel->clipx = clipx;
|
||||
}
|
||||
|
||||
/* Clear selection. */
|
||||
@@ -489,6 +493,8 @@ screen_check_selection(struct screen *s, u_int px, u_int py)
|
||||
|
||||
if (sel == NULL || sel->hidden)
|
||||
return (0);
|
||||
if (px < sel->clipx)
|
||||
return (0);
|
||||
|
||||
if (sel->rectangle) {
|
||||
if (sel->sy < sel->ey) {
|
||||
|
||||
Reference in New Issue
Block a user