diff options
author | nicm <nicm> | 2019-03-19 19:01:50 +0000 |
---|---|---|
committer | nicm <nicm> | 2019-03-19 19:01:50 +0000 |
commit | 161b57869e12a0fd8a95965e98b4866f6055f860 (patch) | |
tree | a153c5f9e1864f2cbb8802544606eb7cc2e3bf2f | |
parent | b24c9e34a9581773de7bc67da81ac25da97dcd1a (diff) | |
download | rtmux-161b57869e12a0fd8a95965e98b4866f6055f860.tar.gz rtmux-161b57869e12a0fd8a95965e98b4866f6055f860.tar.bz2 rtmux-161b57869e12a0fd8a95965e98b4866f6055f860.zip |
Add a cursor_character format.
-rw-r--r-- | format.c | 17 | ||||
-rw-r--r-- | tmux.1 | 1 |
2 files changed, 18 insertions, 0 deletions
@@ -685,6 +685,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) @@ -2031,6 +2046,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); @@ -3744,6 +3744,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" |