mirror of
https://github.com/tmux/tmux.git
synced 2025-11-03 08:16:08 +00:00
Add buffer_full format variable, from Mohammad AlSaleh in GitHub issue
4630.
This commit is contained in:
18
format.c
18
format.c
@@ -1369,6 +1369,21 @@ format_cb_buffer_sample(struct format_tree *ft)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for buffer_full. */
|
||||
static void *
|
||||
format_cb_buffer_full(struct format_tree *ft)
|
||||
{
|
||||
size_t size;
|
||||
const char *s;
|
||||
|
||||
if (ft->pb != NULL) {
|
||||
s = paste_buffer_data(ft->pb, &size);
|
||||
if (s != NULL)
|
||||
return (xstrndup(s, size));
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Callback for buffer_size. */
|
||||
static void *
|
||||
format_cb_buffer_size(struct format_tree *ft)
|
||||
@@ -3004,6 +3019,9 @@ static const struct format_table_entry format_table[] = {
|
||||
{ "buffer_created", FORMAT_TABLE_TIME,
|
||||
format_cb_buffer_created
|
||||
},
|
||||
{ "buffer_full", FORMAT_TABLE_STRING,
|
||||
format_cb_buffer_full
|
||||
},
|
||||
{ "buffer_mode_format", FORMAT_TABLE_STRING,
|
||||
format_cb_buffer_mode_format
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user