mirror of
https://github.com/tmux/tmux.git
synced 2026-10-08 02:34:28 +00:00
Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master: Use ACS arrows for tree mode. Do not crash when synchronizing groups and there is no current window. GitHub issue 5467 from Ju-an Zhang. Add pane_private_modes format with list of DEC private modes, from George Nachman. Do not log when logging is off, from Michael Grant.
This commit is contained in:
61
format.c
61
format.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: format.c,v 1.410 2026/07/29 20:43:20 nicm Exp $ */
|
||||
/* $OpenBSD: format.c,v 1.412 2026/08/05 07:31:08 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -2101,6 +2101,60 @@ format_cb_synchronized_output_flag(struct format_tree *ft)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for pane_private_modes. */
|
||||
static void *
|
||||
format_cb_pane_private_modes(struct format_tree *ft)
|
||||
{
|
||||
static const struct {
|
||||
int mode;
|
||||
int number;
|
||||
} table[] = {
|
||||
{ MODE_KCURSOR, 1 }, /* DECCKM */
|
||||
{ MODE_ORIGIN, 6 }, /* DECOM */
|
||||
{ MODE_WRAP, 7 }, /* DECAWM */
|
||||
{ MODE_CURSOR_BLINKING, 12 }, /* cursor blinking */
|
||||
{ MODE_CURSOR, 25 }, /* DECTCEM */
|
||||
{ MODE_MOUSE_STANDARD, 1000 }, /* mouse normal tracking */
|
||||
{ MODE_MOUSE_BUTTON, 1002 }, /* mouse button tracking */
|
||||
{ MODE_MOUSE_ALL, 1003 }, /* mouse any tracking */
|
||||
{ MODE_FOCUSON, 1004 }, /* focus reporting */
|
||||
{ MODE_MOUSE_UTF8, 1005 }, /* mouse: UTF-8 */
|
||||
{ MODE_MOUSE_SGR, 1006 }, /* mouse: SGR */
|
||||
{ MODE_BRACKETPASTE, 2004 }, /* bracketed paste */
|
||||
{ MODE_SYNC, 2026 }, /* synchronized output */
|
||||
{ MODE_THEME_UPDATES, 2031 }, /* theme update notifications */
|
||||
};
|
||||
int mode;
|
||||
char *value = NULL, *tmp;
|
||||
u_int i;
|
||||
|
||||
if (ft->wp == NULL)
|
||||
return (NULL);
|
||||
mode = ft->wp->base.mode;
|
||||
|
||||
for (i = 0; i < nitems(table); i++) {
|
||||
if (~mode & table[i].mode)
|
||||
continue;
|
||||
/*
|
||||
* Only report cursor blinking when set by the application, not
|
||||
* when it comes from the cursor-style option.
|
||||
*/
|
||||
if (table[i].mode == MODE_CURSOR_BLINKING &&
|
||||
(~mode & MODE_CURSOR_BLINKING_SET))
|
||||
continue;
|
||||
if (value == NULL)
|
||||
xasprintf(&value, "%d", table[i].number);
|
||||
else {
|
||||
xasprintf(&tmp, "%s,%d", value, table[i].number);
|
||||
free(value);
|
||||
value = tmp;
|
||||
}
|
||||
}
|
||||
if (value == NULL)
|
||||
return (xstrdup(""));
|
||||
return (value);
|
||||
}
|
||||
|
||||
/* Callback for pane_active. */
|
||||
static void *
|
||||
format_cb_pane_active(struct format_tree *ft)
|
||||
@@ -3813,6 +3867,9 @@ static const struct format_table_entry format_table[] = {
|
||||
{ "pane_pipe_pid", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_pipe_pid
|
||||
},
|
||||
{ "pane_private_modes", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_private_modes
|
||||
},
|
||||
{ "pane_right", FORMAT_TABLE_STRING,
|
||||
format_cb_pane_right
|
||||
},
|
||||
@@ -4200,6 +4257,8 @@ format_log_debug_cb(const char *key, const char *value, void *arg)
|
||||
void
|
||||
format_log_debug(struct format_tree *ft, const char *prefix)
|
||||
{
|
||||
if (log_get_level() == 0)
|
||||
return;
|
||||
format_each(ft, format_log_debug_cb, (void *)prefix);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user