diff --git a/format.c b/format.c index 3af7ae69..add7c35b 100644 --- a/format.c +++ b/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 grid *gd; struct grid_line *gl; - unsigned long long size; + size_t size = 0; u_int i; if (wp == NULL) return; gd = wp->base.grid; - size = 0; - for (i = 0; i < gd->hsize; i++) { + for (i = 0; i < gd->hsize + gd->sy; i++) { gl = grid_get_line(gd, i); size += gl->cellsize * sizeof *gl->celldata; 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. */ @@ -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_limit", "%u", gd->hlimit); 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_skipped", "%zu", wp->skipped); diff --git a/tmux.h b/tmux.h index 61265488..87d9dd3c 100644 --- a/tmux.h +++ b/tmux.h @@ -675,7 +675,7 @@ struct grid_cell { /* Grid extended cell entry. */ struct grid_extd_entry { - uint32_t data; + u_int data; u_short attr; u_char flags; int fg; @@ -2891,9 +2891,9 @@ u_int session_group_attached_count(struct session_group *); void session_renumber_windows(struct session *); /* utf8.c */ -uint32_t utf8_set_big(char, u_int); -uint32_t utf8_map_big(const struct utf8_data *); -void utf8_get_big(uint32_t, struct utf8_data *); +u_int utf8_set_big(char, u_int); +u_int utf8_map_big(const struct utf8_data *); +void utf8_get_big(u_int, struct utf8_data *); void utf8_set(struct utf8_data *, u_char); void utf8_copy(struct utf8_data *, const struct utf8_data *); enum utf8_state utf8_open(struct utf8_data *, u_char); diff --git a/utf8.c b/utf8.c index c6b204ec..efe8679d 100644 --- a/utf8.c +++ b/utf8.c @@ -54,7 +54,7 @@ static u_int utf8_big_list_size; static u_int utf8_big_list_used; union utf8_big_map { - uint32_t value; + u_int value; struct { u_char flags; #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. */ -uint32_t +u_int utf8_map_big(const struct utf8_data *ud) { union utf8_big_map m = { .value = 0 }; @@ -164,7 +164,7 @@ fail: /* Get UTF-8 from index into buffer. */ 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 }; struct utf8_big_item *bi; @@ -182,7 +182,7 @@ utf8_get_big(uint32_t v, struct utf8_data *ud) 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) memset(ud->data, ' ', ud->size); else { @@ -192,7 +192,7 @@ utf8_get_big(uint32_t v, struct utf8_data *ud) } /* Get big value for UTF-8 single character. */ -uint32_t +u_int utf8_set_big(char c, u_int width) { union utf8_big_map m = { .flags = 1, .data[0] = c };