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:
nicm
2026-05-01 09:44:42 +00:00
parent a2acf0f7cf
commit 524f283cc6
6 changed files with 419 additions and 26 deletions

3
tmux.h
View File

@@ -3292,7 +3292,7 @@ void screen_set_progress_bar(struct screen *, enum progress_bar_state, int);
void screen_resize(struct screen *, u_int, u_int, int);
void screen_resize_cursor(struct screen *, u_int, u_int, int, int, int);
void screen_set_selection(struct screen *, u_int, u_int, u_int, u_int,
u_int, int, struct grid_cell *);
u_int, u_int, int, struct grid_cell *);
void screen_clear_selection(struct screen *);
void screen_hide_selection(struct screen *);
int screen_check_selection(struct screen *, u_int, u_int);
@@ -3530,6 +3530,7 @@ char *window_copy_get_line(struct window_pane *, u_int);
int window_copy_get_current_offset(struct window_pane *, u_int *,
u_int *);
char *window_copy_get_hyperlink(struct window_pane *, u_int, u_int);
void window_copy_set_line_numbers(struct window_pane *, int);
/* window-option.c */
extern const struct window_mode window_customize_mode;