mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
b34af611a5
35
format.c
35
format.c
@ -761,22 +761,46 @@ format_cb_history_bytes(struct format_tree *ft, struct format_entry *fe)
|
|||||||
struct window_pane *wp = ft->wp;
|
struct window_pane *wp = ft->wp;
|
||||||
struct grid *gd;
|
struct grid *gd;
|
||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
unsigned long long size;
|
size_t size = 0;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return;
|
return;
|
||||||
gd = wp->base.grid;
|
gd = wp->base.grid;
|
||||||
|
|
||||||
size = 0;
|
for (i = 0; i < gd->hsize + gd->sy; i++) {
|
||||||
for (i = 0; i < gd->hsize; i++) {
|
|
||||||
gl = grid_get_line(gd, i);
|
gl = grid_get_line(gd, i);
|
||||||
size += gl->cellsize * sizeof *gl->celldata;
|
size += gl->cellsize * sizeof *gl->celldata;
|
||||||
size += gl->extdsize * sizeof *gl->extddata;
|
size += gl->extdsize * sizeof *gl->extddata;
|
||||||
}
|
}
|
||||||
size += gd->hsize * sizeof *gl;
|
size += (gd->hsize + gd->sy) * sizeof *gl;
|
||||||
|
|
||||||
xasprintf(&fe->value, "%llu", size);
|
xasprintf(&fe->value, "%zu", size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Callback for history_all_bytes. */
|
||||||
|
static void
|
||||||
|
format_cb_history_all_bytes(struct format_tree *ft, struct format_entry *fe)
|
||||||
|
{
|
||||||
|
struct window_pane *wp = ft->wp;
|
||||||
|
struct grid *gd;
|
||||||
|
struct grid_line *gl;
|
||||||
|
u_int i, lines, cells = 0, extended_cells = 0;
|
||||||
|
|
||||||
|
if (wp == NULL)
|
||||||
|
return;
|
||||||
|
gd = wp->base.grid;
|
||||||
|
|
||||||
|
lines = gd->hsize + gd->sy;
|
||||||
|
for (i = 0; i < lines; i++) {
|
||||||
|
gl = grid_get_line(gd, i);
|
||||||
|
cells += gl->cellsize;
|
||||||
|
extended_cells += gl->extdsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
xasprintf(&fe->value, "%u,%zu,%u,%zu,%u,%zu", lines,
|
||||||
|
lines * sizeof *gl, cells, cells * sizeof *gl->celldata,
|
||||||
|
extended_cells, extended_cells * sizeof *gl->extddata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Callback for pane_tabs. */
|
/* Callback for pane_tabs. */
|
||||||
@ -2823,6 +2847,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
|
|||||||
format_add(ft, "history_size", "%u", gd->hsize);
|
format_add(ft, "history_size", "%u", gd->hsize);
|
||||||
format_add(ft, "history_limit", "%u", gd->hlimit);
|
format_add(ft, "history_limit", "%u", gd->hlimit);
|
||||||
format_add_cb(ft, "history_bytes", format_cb_history_bytes);
|
format_add_cb(ft, "history_bytes", format_cb_history_bytes);
|
||||||
|
format_add_cb(ft, "history_all_bytes", format_cb_history_all_bytes);
|
||||||
|
|
||||||
format_add(ft, "pane_written", "%zu", wp->written);
|
format_add(ft, "pane_written", "%zu", wp->written);
|
||||||
format_add(ft, "pane_skipped", "%zu", wp->skipped);
|
format_add(ft, "pane_skipped", "%zu", wp->skipped);
|
||||||
|
8
tmux.h
8
tmux.h
@ -675,7 +675,7 @@ struct grid_cell {
|
|||||||
|
|
||||||
/* Grid extended cell entry. */
|
/* Grid extended cell entry. */
|
||||||
struct grid_extd_entry {
|
struct grid_extd_entry {
|
||||||
uint32_t data;
|
u_int data;
|
||||||
u_short attr;
|
u_short attr;
|
||||||
u_char flags;
|
u_char flags;
|
||||||
int fg;
|
int fg;
|
||||||
@ -2891,9 +2891,9 @@ u_int session_group_attached_count(struct session_group *);
|
|||||||
void session_renumber_windows(struct session *);
|
void session_renumber_windows(struct session *);
|
||||||
|
|
||||||
/* utf8.c */
|
/* utf8.c */
|
||||||
uint32_t utf8_set_big(char, u_int);
|
u_int utf8_set_big(char, u_int);
|
||||||
uint32_t utf8_map_big(const struct utf8_data *);
|
u_int utf8_map_big(const struct utf8_data *);
|
||||||
void utf8_get_big(uint32_t, struct utf8_data *);
|
void utf8_get_big(u_int, struct utf8_data *);
|
||||||
void utf8_set(struct utf8_data *, u_char);
|
void utf8_set(struct utf8_data *, u_char);
|
||||||
void utf8_copy(struct utf8_data *, const struct utf8_data *);
|
void utf8_copy(struct utf8_data *, const struct utf8_data *);
|
||||||
enum utf8_state utf8_open(struct utf8_data *, u_char);
|
enum utf8_state utf8_open(struct utf8_data *, u_char);
|
||||||
|
10
utf8.c
10
utf8.c
@ -54,7 +54,7 @@ static u_int utf8_big_list_size;
|
|||||||
static u_int utf8_big_list_used;
|
static u_int utf8_big_list_used;
|
||||||
|
|
||||||
union utf8_big_map {
|
union utf8_big_map {
|
||||||
uint32_t value;
|
u_int value;
|
||||||
struct {
|
struct {
|
||||||
u_char flags;
|
u_char flags;
|
||||||
#define UTF8_BIG_SIZE 0x1f
|
#define UTF8_BIG_SIZE 0x1f
|
||||||
@ -124,7 +124,7 @@ utf8_put_big_item(const char *data, size_t size, u_int *index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get UTF-8 as index into buffer. */
|
/* Get UTF-8 as index into buffer. */
|
||||||
uint32_t
|
u_int
|
||||||
utf8_map_big(const struct utf8_data *ud)
|
utf8_map_big(const struct utf8_data *ud)
|
||||||
{
|
{
|
||||||
union utf8_big_map m = { .value = 0 };
|
union utf8_big_map m = { .value = 0 };
|
||||||
@ -164,7 +164,7 @@ fail:
|
|||||||
|
|
||||||
/* Get UTF-8 from index into buffer. */
|
/* Get UTF-8 from index into buffer. */
|
||||||
void
|
void
|
||||||
utf8_get_big(uint32_t v, struct utf8_data *ud)
|
utf8_get_big(u_int v, struct utf8_data *ud)
|
||||||
{
|
{
|
||||||
union utf8_big_map m = { .value = v };
|
union utf8_big_map m = { .value = v };
|
||||||
struct utf8_big_item *bi;
|
struct utf8_big_item *bi;
|
||||||
@ -182,7 +182,7 @@ utf8_get_big(uint32_t v, struct utf8_data *ud)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
o = ((uint32_t)m.data[2] << 16)|((uint32_t)m.data[1] << 8)|m.data[0];
|
o = ((u_int)m.data[2] << 16)|((u_int)m.data[1] << 8)|m.data[0];
|
||||||
if (o >= utf8_big_list_used)
|
if (o >= utf8_big_list_used)
|
||||||
memset(ud->data, ' ', ud->size);
|
memset(ud->data, ' ', ud->size);
|
||||||
else {
|
else {
|
||||||
@ -192,7 +192,7 @@ utf8_get_big(uint32_t v, struct utf8_data *ud)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get big value for UTF-8 single character. */
|
/* Get big value for UTF-8 single character. */
|
||||||
uint32_t
|
u_int
|
||||||
utf8_set_big(char c, u_int width)
|
utf8_set_big(char c, u_int width)
|
||||||
{
|
{
|
||||||
union utf8_big_map m = { .flags = 1, .data[0] = c };
|
union utf8_big_map m = { .flags = 1, .data[0] = c };
|
||||||
|
Loading…
Reference in New Issue
Block a user