mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Add a cursor_character format.
This commit is contained in:
parent
c51576eed0
commit
cafd4ec8ef
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: format.c,v 1.185 2019/03/18 20:53:33 nicm Exp $ */
|
||||
/* $OpenBSD: format.c,v 1.186 2019/03/19 19:01:50 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@ -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);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: tmux.1,v 1.627 2019/03/19 13:35:42 nicm Exp $
|
||||
.\" $OpenBSD: tmux.1,v 1.628 2019/03/19 19:01:50 nicm Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
.\"
|
||||
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user