From 374dae6635f797e480a7b0fc5a5c7bcd4fcca047 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 21 Feb 2013 19:44:27 +0000 Subject: [PATCH] Add a load of miscellaneous pane formats, from George Nachman. --- format.c | 48 +++++++++++++++++++++++++++++++++++++++++------- tmux.1 | 21 ++++++++++++++++++++- 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/format.c b/format.c index b3a63775..bd81799a 100644 --- a/format.c +++ b/format.c @@ -384,29 +384,63 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp) size += gl->cellsize * sizeof *gl->celldata; } size += gd->hsize * sizeof *gd->linedata; + format_add(ft, "history_size", "%u", gd->hsize); + format_add(ft, "history_limit", "%u", gd->hlimit); + format_add(ft, "history_bytes", "%llu", size); if (window_pane_index(wp, &idx) != 0) fatalx("index not found"); + format_add(ft, "pane_index", "%u", idx); format_add(ft, "pane_width", "%u", wp->sx); format_add(ft, "pane_height", "%u", wp->sy); format_add(ft, "pane_title", "%s", wp->base.title); - format_add(ft, "pane_index", "%u", idx); - format_add(ft, "history_size", "%u", gd->hsize); - format_add(ft, "history_limit", "%u", gd->hlimit); - format_add(ft, "history_bytes", "%llu", size); format_add(ft, "pane_id", "%%%u", wp->id); format_add(ft, "pane_active", "%d", wp == wp->window->active); format_add(ft, "pane_dead", "%d", wp->fd == -1); + + format_add(ft, "pane_in_mode", "%d", wp->screen != &wp->base); + + if (wp->tty != NULL) + format_add(ft, "pane_tty", "%s", wp->tty); + format_add(ft, "pane_pid", "%ld", (long) wp->pid); if (wp->cmd != NULL) format_add(ft, "pane_start_command", "%s", wp->cmd); if (wp->cwd != NULL) format_add(ft, "pane_start_path", "%s", wp->cwd); if ((cwd = osdep_get_cwd(wp->fd)) != NULL) format_add(ft, "pane_current_path", "%s", cwd); - format_add(ft, "pane_pid", "%ld", (long) wp->pid); - if (wp->tty != NULL) - format_add(ft, "pane_tty", "%s", wp->tty); + + format_add(ft, "cursor_x", "%d", wp->base.cx); + format_add(ft, "cursor_y", "%d", wp->base.cy); + format_add(ft, "scroll_region_upper", "%d", wp->base.rupper); + format_add(ft, "scroll_region_lower", "%d", wp->base.rlower); + format_add(ft, "saved_cursor_x", "%d", wp->ictx.old_cx); + format_add(ft, "saved_cursor_y", "%d", wp->ictx.old_cy); + + format_add(ft, "alternate_on", "%d", wp->saved_grid ? 1 : 0); + format_add(ft, "alternate_saved_x", "%d", wp->saved_cx); + format_add(ft, "alternate_saved_y", "%d", wp->saved_cy); + + format_add(ft, "cursor_flag", "%d", + !!(wp->base.mode & MODE_CURSOR)); + format_add(ft, "insert_flag", "%d", + !!(wp->base.mode & MODE_INSERT)); + format_add(ft, "keypad_cursor_flag", "%d", + !!(wp->base.mode & MODE_KCURSOR)); + format_add(ft, "keypad_flag", "%d", + !!(wp->base.mode & MODE_KKEYPAD)); + format_add(ft, "wrap_flag", "%d", + !!(wp->base.mode & MODE_WRAP)); + + format_add(ft, "mouse_standard_flag", "%d", + !!(wp->base.mode & MODE_MOUSE_STANDARD)); + format_add(ft, "mouse_button_flag", "%d", + !!(wp->base.mode & MODE_MOUSE_BUTTON)); + format_add(ft, "mouse_any_flag", "%d", + !!(wp->base.mode & MODE_MOUSE_ANY)); + format_add(ft, "mouse_utf8_flag", "%d", + !!(wp->base.mode & MODE_MOUSE_UTF8)); } void diff --git a/tmux.1 b/tmux.1 index 7d5eb5a8..8731efb9 100644 --- a/tmux.1 +++ b/tmux.1 @@ -2985,6 +2985,9 @@ if it is unattached. The following variables are available, where appropriate: .Bl -column "session_created_string" "Replaced with" -offset indent .It Sy "Variable name" Ta Sy "Replaced with" +.It Li "alternate_on" Ta "If pane is in alternate screen" +.It Li "alternate_saved_x" Ta "Saved cursor X in alternate screen" +.It Li "alternate_saved_y" Ta "Saved cursor Y in alternate screen" .It Li "buffer_sample" Ta "First 50 characters from the specified buffer" .It Li "buffer_size" Ta "Size of the specified buffer in bytes" .It Li "client_activity" Ta "Integer time client last had activity" @@ -3001,16 +3004,27 @@ The following variables are available, where appropriate: .It Li "client_tty" Ta "Pseudo terminal of client" .It Li "client_utf8" Ta "1 if client supports utf8" .It Li "client_width" Ta "Width of client" -.It Li "host" Ta "Hostname of local host" +.It Li "cursor_flag" Ta "Pane cursor flag" +.It Li "cursor_x" Ta "Cursor X position in pane" +.It Li "cursor_y" Ta "Cursor Y position in pane" .It Li "history_bytes" Ta "Number of bytes in window history" .It Li "history_limit" Ta "Maximum window history lines" .It Li "history_size" Ta "Size of history in bytes" +.It Li "host" Ta "Hostname of local host" +.It Li "insert_flag" Ta "Pane insert flag" +.It Li "keypad_cursor_flag" Ta "Pane keypad cursor flag" +.It Li "keypad_flag" Ta "Pane keypad flag" .It Li "line" Ta "Line number in the list" +.It Li "mouse_any_flag" Ta "Pane mouse any flag" +.It Li "mouse_button_flag" Ta "Pane mouse button flag" +.It Li "mouse_standard_flag" Ta "Pane mouse standard flag" +.It Li "mouse_utf8_flag" Ta "Pane mouse UTF-8 flag" .It Li "pane_active" Ta "1 if active pane" .It Li "pane_current_path" Ta "Current path if available" .It Li "pane_dead" Ta "1 if pane is dead" .It Li "pane_height" Ta "Height of pane" .It Li "pane_id" Ta "Unique pane ID" +.It Li "pane_in_mode" Ta "If pane is in a mode" .It Li "pane_index" Ta "Index of pane" .It Li "pane_pid" Ta "PID of first process in pane" .It Li "pane_start_command" Ta "Command pane started with" @@ -3018,6 +3032,10 @@ The following variables are available, where appropriate: .It Li "pane_title" Ta "Title of pane" .It Li "pane_tty" Ta "Pseudo terminal of pane" .It Li "pane_width" Ta "Width of pane" +.It Li "saved_cursor_x" Ta "Saved cursor X in pane" +.It Li "saved_cursor_y" Ta "Saved cursor Y in pane" +.It Li "scroll_region_lower" Ta "Bottom of scroll region in pane" +.It Li "scroll_region_upper" Ta "Top of scroll region in pane" .It Li "session_attached" Ta "1 if session attached" .It Li "session_created" Ta "Integer time session created" .It Li "session_created_string" Ta "String time session created" @@ -3037,6 +3055,7 @@ The following variables are available, where appropriate: .It Li "window_name" Ta "Name of window" .It Li "window_panes" Ta "Number of panes in window" .It Li "window_width" Ta "Width of window" +.It Li "wrap_flag" Ta "Pane wrap flag" .El .Sh NAMES AND TITLES .Nm