add new option `allow-rename-pane` to control whether pane-title should set by escape sequence

pull/3930/head
cache-miss 2024-04-10 09:18:59 +08:00
parent 887cdccacf
commit c124d74fd2
4 changed files with 10 additions and 3 deletions

View File

@ -212,7 +212,6 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'T')) {
title = format_single_from_target(item, args_get(args, 'T'));
if (screen_set_title(&wp->base, title)) {
wp->base.ignore_osc_2 = 1;
notify_pane("pane-title-changed", wp);
server_redraw_window_borders(wp->window);
server_status_window(wp->window);

View File

@ -2372,7 +2372,8 @@ input_exit_osc(struct input_ctx *ictx)
switch (option) {
case 0:
case 2:
if ( sctx->s->ignore_osc_2 == 0 && screen_set_title(sctx->s, p) && wp != NULL) {
if (options_get_number(ictx->wp->options, "allow-rename-pane") == 1 &&
screen_set_title(sctx->s, p) && wp != NULL) {
notify_pane("pane-title-changed", wp);
server_redraw_window_borders(wp->window);
server_status_window(wp->window);

View File

@ -875,6 +875,14 @@ const struct options_table_entry options_table[] = {
"to rename windows."
},
{ .name = "allow-rename-pane",
.type = OPTIONS_TABLE_FLAG,
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
.default_num = 0,
.text = "Whether applications are allowed to use the escape sequence "
"to rename pane."
},
{ .name = "alternate-screen",
.type = OPTIONS_TABLE_FLAG,
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,

1
tmux.h
View File

@ -877,7 +877,6 @@ struct screen_sel;
struct screen_titles;
struct screen {
char *title;
int ignore_osc_2;
char *path;
struct screen_titles *titles;