config: add free-form text variant to 'scrollback-indicator-format'

And make the empty string the new default.
This commit is contained in:
Daniel Eklöf 2020-07-28 19:56:53 +02:00
parent eadb5a4a88
commit 2882fbb537
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 31 additions and 12 deletions

View file

@ -1358,20 +1358,26 @@ render_scrollback_position(struct terminal *term)
? 1.0
: (double)rebased_view / term->grid->num_rows;
wchar_t text[64];
wchar_t _text[64];
const wchar_t *text = _text;
int cell_count;
/* *What* to render */
switch (term->conf->scrollback.indicator.format) {
case SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE:
swprintf(text, sizeof(text) / sizeof(text[0]), L"%u%%", (int)(100 * percent));
swprintf(_text, sizeof(_text) / sizeof(_text[0]), L"%u%%", (int)(100 * percent));
cell_count = 3;
break;
case SCROLLBACK_INDICATOR_FORMAT_LINENO:
swprintf(text, sizeof(text) / sizeof(text[0]), L"%d", rebased_view + 1);
swprintf(_text, sizeof(_text) / sizeof(_text[0]), L"%d", rebased_view + 1);
cell_count = 1 + (int)log10(term->grid->num_rows);
break;
case SCROLLBACK_INDICATOR_FORMAT_TEXT:
text = term->conf->scrollback.indicator.text;
cell_count = wcslen(text);
break;
}
const int scale = term->scale;