mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 17:39:09 +00:00
Add a cursor_character format.
This commit is contained in:
parent
b24c9e34a9
commit
161b57869e
17
format.c
17
format.c
@ -685,6 +685,21 @@ format_cb_pane_in_mode(struct format_tree *ft, struct format_entry *fe)
|
|||||||
xasprintf(&fe->value, "%u", n);
|
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. */
|
/* Merge a format tree. */
|
||||||
static void
|
static void
|
||||||
format_merge(struct format_tree *ft, struct format_tree *from)
|
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_x", "%u", wp->base.cx);
|
||||||
format_add(ft, "cursor_y", "%u", wp->base.cy);
|
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_upper", "%u", wp->base.rupper);
|
||||||
format_add(ft, "scroll_region_lower", "%u", wp->base.rlower);
|
format_add(ft, "scroll_region_lower", "%u", wp->base.rlower);
|
||||||
|
|
||||||
|
1
tmux.1
1
tmux.1
@ -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_alias" Ta "" Ta "Command alias if listing commands"
|
||||||
.It Li "command_list_usage" Ta "" Ta "Command usage 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_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_x" Ta "" Ta "Cursor X position in pane"
|
||||||
.It Li "cursor_y" Ta "" Ta "Cursor Y 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"
|
.It Li "history_bytes" Ta "" Ta "Number of bytes in window history"
|
||||||
|
Loading…
Reference in New Issue
Block a user