mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 11:55:56 +00:00
Add copy-mode-position-style and copy-mode-selection-style for copy
mode (they default to mode-style as before).
This commit is contained in:
parent
67cc7f6dc6
commit
6f7db82b18
@ -1026,6 +1026,24 @@ const struct options_table_entry options_table[] = {
|
|||||||
.text = "Format of the position indicator in copy mode."
|
.text = "Format of the position indicator in copy mode."
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ .name = "copy-mode-position-style",
|
||||||
|
.type = OPTIONS_TABLE_STRING,
|
||||||
|
.scope = OPTIONS_TABLE_WINDOW,
|
||||||
|
.default_str = "#{mode-style}",
|
||||||
|
.flags = OPTIONS_TABLE_IS_STYLE,
|
||||||
|
.separator = ",",
|
||||||
|
.text = "Style of position indicator in copy mode."
|
||||||
|
},
|
||||||
|
|
||||||
|
{ .name = "copy-mode-selection-style",
|
||||||
|
.type = OPTIONS_TABLE_STRING,
|
||||||
|
.scope = OPTIONS_TABLE_WINDOW,
|
||||||
|
.default_str = "#{mode-style}",
|
||||||
|
.flags = OPTIONS_TABLE_IS_STYLE,
|
||||||
|
.separator = ",",
|
||||||
|
.text = "Style of selection in copy mode."
|
||||||
|
},
|
||||||
|
|
||||||
{ .name = "fill-character",
|
{ .name = "fill-character",
|
||||||
.type = OPTIONS_TABLE_STRING,
|
.type = OPTIONS_TABLE_STRING,
|
||||||
.scope = OPTIONS_TABLE_WINDOW,
|
.scope = OPTIONS_TABLE_WINDOW,
|
||||||
|
16
tmux.1
16
tmux.1
@ -4888,6 +4888,22 @@ or
|
|||||||
contains
|
contains
|
||||||
.Ql vi .
|
.Ql vi .
|
||||||
.Pp
|
.Pp
|
||||||
|
.It Ic copy-mode-position-style Ar style
|
||||||
|
Set the style of the position indicator in copy mode.
|
||||||
|
For how to specify
|
||||||
|
.Ar style ,
|
||||||
|
see the
|
||||||
|
.Sx STYLES
|
||||||
|
section.
|
||||||
|
.Pp
|
||||||
|
.It Ic copy-mode-selection-style Ar style
|
||||||
|
Set the style of the selection in copy mode.
|
||||||
|
For how to specify
|
||||||
|
.Ar style ,
|
||||||
|
see the
|
||||||
|
.Sx STYLES
|
||||||
|
section.
|
||||||
|
.Pp
|
||||||
.It Ic mode-style Ar style
|
.It Ic mode-style Ar style
|
||||||
Set window modes style.
|
Set window modes style.
|
||||||
For how to specify
|
For how to specify
|
||||||
|
@ -4391,13 +4391,15 @@ window_copy_write_line(struct window_mode_entry *wme,
|
|||||||
char *expanded;
|
char *expanded;
|
||||||
struct format_tree *ft;
|
struct format_tree *ft;
|
||||||
|
|
||||||
style_apply(&gc, oo, "mode-style", NULL);
|
ft = format_create_defaults(NULL, NULL, NULL, NULL, wp);
|
||||||
|
|
||||||
|
style_apply(&gc, oo, "copy-mode-position-style", ft);
|
||||||
gc.flags |= GRID_FLAG_NOPALETTE;
|
gc.flags |= GRID_FLAG_NOPALETTE;
|
||||||
style_apply(&mgc, oo, "copy-mode-match-style", NULL);
|
style_apply(&mgc, oo, "copy-mode-match-style", ft);
|
||||||
mgc.flags |= GRID_FLAG_NOPALETTE;
|
mgc.flags |= GRID_FLAG_NOPALETTE;
|
||||||
style_apply(&cgc, oo, "copy-mode-current-match-style", NULL);
|
style_apply(&cgc, oo, "copy-mode-current-match-style", ft);
|
||||||
cgc.flags |= GRID_FLAG_NOPALETTE;
|
cgc.flags |= GRID_FLAG_NOPALETTE;
|
||||||
style_apply(&mkgc, oo, "copy-mode-mark-style", NULL);
|
style_apply(&mkgc, oo, "copy-mode-mark-style", ft);
|
||||||
mkgc.flags |= GRID_FLAG_NOPALETTE;
|
mkgc.flags |= GRID_FLAG_NOPALETTE;
|
||||||
|
|
||||||
window_copy_write_one(wme, ctx, py, hsize - data->oy + py,
|
window_copy_write_one(wme, ctx, py, hsize - data->oy + py,
|
||||||
@ -4406,14 +4408,12 @@ window_copy_write_line(struct window_mode_entry *wme,
|
|||||||
if (py == 0 && s->rupper < s->rlower && !data->hide_position) {
|
if (py == 0 && s->rupper < s->rlower && !data->hide_position) {
|
||||||
value = options_get_string(oo, "copy-mode-position-format");
|
value = options_get_string(oo, "copy-mode-position-format");
|
||||||
if (*value != '\0') {
|
if (*value != '\0') {
|
||||||
ft = format_create_defaults(NULL, NULL, NULL, NULL, wp);
|
|
||||||
expanded = format_expand(ft, value);
|
expanded = format_expand(ft, value);
|
||||||
if (*expanded != '\0') {
|
if (*expanded != '\0') {
|
||||||
screen_write_cursormove(ctx, 0, 0, 0);
|
screen_write_cursormove(ctx, 0, 0, 0);
|
||||||
format_draw(ctx, &gc, sx, expanded, NULL, 0);
|
format_draw(ctx, &gc, sx, expanded, NULL, 0);
|
||||||
}
|
}
|
||||||
free(expanded);
|
free(expanded);
|
||||||
format_free(ft);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4421,6 +4421,8 @@ window_copy_write_line(struct window_mode_entry *wme,
|
|||||||
screen_write_cursormove(ctx, screen_size_x(s) - 1, py, 0);
|
screen_write_cursormove(ctx, screen_size_x(s) - 1, py, 0);
|
||||||
screen_write_putc(ctx, &grid_default_cell, '$');
|
screen_write_putc(ctx, &grid_default_cell, '$');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
format_free(ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4668,6 +4670,7 @@ window_copy_set_selection(struct window_mode_entry *wme, int may_redraw,
|
|||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
u_int sx, sy, cy, endsx, endsy;
|
u_int sx, sy, cy, endsx, endsy;
|
||||||
int startrelpos, endrelpos;
|
int startrelpos, endrelpos;
|
||||||
|
struct format_tree *ft;
|
||||||
|
|
||||||
window_copy_synchronize_cursor(wme, no_reset);
|
window_copy_synchronize_cursor(wme, no_reset);
|
||||||
|
|
||||||
@ -4689,8 +4692,10 @@ window_copy_set_selection(struct window_mode_entry *wme, int may_redraw,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set colours and selection. */
|
/* Set colours and selection. */
|
||||||
style_apply(&gc, oo, "mode-style", NULL);
|
ft = format_create_defaults(NULL, NULL, NULL, NULL, wp);
|
||||||
|
style_apply(&gc, oo, "copy-mode-selection-style", ft);
|
||||||
gc.flags |= GRID_FLAG_NOPALETTE;
|
gc.flags |= GRID_FLAG_NOPALETTE;
|
||||||
|
format_free(ft);
|
||||||
screen_set_selection(s, sx, sy, endsx, endsy, data->rectflag,
|
screen_set_selection(s, sx, sy, endsx, endsy, data->rectflag,
|
||||||
data->modekeys, &gc);
|
data->modekeys, &gc);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user