diff options
-rw-r--r-- | format.c | 17 | ||||
-rw-r--r-- | tmux.1 | 1 |
2 files changed, 18 insertions, 0 deletions
@@ -700,6 +700,21 @@ format_cb_pane_in_mode(struct format_tree *ft, struct format_entry *fe) xasprintf(&fe->value, "%u", n); } +/* Callback for cursor_character. */ +static void +format_cb_cursor_character(struct format_tree *ft, struct format_entry *fe) +{ + struct window_pane *wp = ft->wp; + struct grid_cell gc; + + if (wp == NULL) + return; + + grid_view_get_cell(wp->base.grid, wp->base.cx, wp->base.cy, &gc); + if (~gc.flags & GRID_FLAG_PADDING) + xasprintf(&fe->value, "%.*s", (int)gc.data.size, gc.data.data); +} + /* Merge a format tree. */ static void format_merge(struct format_tree *ft, struct format_tree *from) @@ -2048,6 +2063,8 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp) format_add(ft, "cursor_x", "%u", wp->base.cx); format_add(ft, "cursor_y", "%u", wp->base.cy); + format_add_cb(ft, "cursor_character", format_cb_cursor_character); + format_add(ft, "scroll_region_upper", "%u", wp->base.rupper); format_add(ft, "scroll_region_lower", "%u", wp->base.rlower); @@ -3846,6 +3846,7 @@ The following variables are available, where appropriate: .It Li "command_list_alias" Ta "" Ta "Command alias if listing commands" .It Li "command_list_usage" Ta "" Ta "Command usage if listing commands" .It Li "cursor_flag" Ta "" Ta "Pane cursor flag" +.It Li "cursor_character" Ta "Character at cursor in pane" .It Li "cursor_x" Ta "" Ta "Cursor X position in pane" .It Li "cursor_y" Ta "" Ta "Cursor Y position in pane" .It Li "history_bytes" Ta "" Ta "Number of bytes in window history" |