config: rename scrollback-indicator-style to scrollback-indicator-position

This commit is contained in:
Daniel Eklöf 2020-07-27 20:02:51 +02:00
parent aca5a64954
commit 718e5b4a77
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
6 changed files with 19 additions and 19 deletions

View file

@ -20,7 +20,7 @@
* Mouse cursor is now always a `left_ptr` when inside the margins, to * Mouse cursor is now always a `left_ptr` when inside the margins, to
indicate it is not possible to start a selection. indicate it is not possible to start a selection.
* Scrollback position indicator. This feature is optional and * Scrollback position indicator. This feature is optional and
controlled by the **scrollback-indicator-style** and controlled by the **scrollback-indicator-position** and
**scrollback-indicator-format** options in `footrc` **scrollback-indicator-format** options in `footrc`
(https://codeberg.org/dnkl/foot/issues/42). (https://codeberg.org/dnkl/foot/issues/42).

View file

@ -291,15 +291,15 @@ parse_section_main(const char *key, const char *value, struct config *conf,
conf->scrollback.lines = lines; conf->scrollback.lines = lines;
} }
else if (strcmp(key, "scrollback-indicator-style") == 0) { else if (strcmp(key, "scrollback-indicator-position") == 0) {
if (strcmp(value, "none") == 0) if (strcmp(value, "none") == 0)
conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_NONE; conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_NONE;
else if (strcmp(value, "fixed") == 0) else if (strcmp(value, "fixed") == 0)
conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_FIXED; conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_FIXED;
else if (strcmp(value, "relative") == 0) else if (strcmp(value, "relative") == 0)
conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_RELATIVE; conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_RELATIVE;
else { else {
LOG_ERR("%s:%d: scrollback-indicator-style must be one of " LOG_ERR("%s:%d: scrollback-indicator-position must be one of "
"'none', 'fixed' or 'moving'", "'none', 'fixed' or 'moving'",
path, lineno); path, lineno);
return false; return false;
@ -950,7 +950,7 @@ config_load(struct config *conf, const char *conf_path)
.scrollback = { .scrollback = {
.lines = 1000, .lines = 1000,
.indicator = { .indicator = {
.style = SCROLLBACK_INDICATOR_STYLE_RELATIVE, .position = SCROLLBACK_INDICATOR_POSITION_RELATIVE,
.format = SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, .format = SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE,
}, },
}, },

View file

@ -44,10 +44,10 @@ struct config {
struct { struct {
enum { enum {
SCROLLBACK_INDICATOR_STYLE_NONE, SCROLLBACK_INDICATOR_POSITION_NONE,
SCROLLBACK_INDICATOR_STYLE_FIXED, SCROLLBACK_INDICATOR_POSITION_FIXED,
SCROLLBACK_INDICATOR_STYLE_RELATIVE SCROLLBACK_INDICATOR_POSITION_RELATIVE
} style; } position;
enum { enum {
SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE,

View file

@ -68,7 +68,7 @@ in this order:
*scrollback* *scrollback*
Number of scrollback lines. Default: _1000_. Number of scrollback lines. Default: _1000_.
*scrollback-indicator-style* *scrollback-indicator-position*
Configures the style of the scrollback position indicator. One of Configures the style of the scrollback position indicator. One of
*none*, *fixed* or *relative*. *none* disables the indicator *none*, *fixed* or *relative*. *none* disables the indicator
completely. *fixed* always renders the indicator near the top at completely. *fixed* always renders the indicator near the top at
@ -79,7 +79,7 @@ in this order:
*scrollback-indicator-format* *scrollback-indicator-format*
Which format to use when displaying the scrollback position Which format to use when displaying the scrollback position
indicator. Either _percentage_ or _line_. This option is ignored indicator. Either _percentage_ or _line_. This option is ignored
if *scrollback-indicator-style=none*. Default: _percentage_. if *scrollback-indicator-position=none*. Default: _percentage_.
*workers* *workers*
Number of threads to use for rendering. Set to 0 to disable Number of threads to use for rendering. Set to 0 to disable

2
footrc
View file

@ -2,7 +2,7 @@
# font=monospace # font=monospace
# scrollback=1000 # scrollback=1000
# scrollback-indicator-style=relative # scrollback-indicator-position=relative
# scrollback-indicator-format=percentage # scrollback-indicator-format=percentage
# geometry=700x500 # geometry=700x500
# pad=2x2 # pad=2x2

View file

@ -1290,7 +1290,7 @@ render_csd(struct terminal *term)
static void static void
render_scrollback_position(struct terminal *term) render_scrollback_position(struct terminal *term)
{ {
if (term->conf->scrollback.indicator.style == SCROLLBACK_INDICATOR_STYLE_NONE) if (term->conf->scrollback.indicator.position == SCROLLBACK_INDICATOR_POSITION_NONE)
return; return;
struct wayland *wayl = term->wl; struct wayland *wayl = term->wl;
@ -1414,16 +1414,16 @@ render_scrollback_position(struct terminal *term)
/* *Where* to render - parent relative coordinates */ /* *Where* to render - parent relative coordinates */
int surf_top = 0; int surf_top = 0;
switch (term->conf->scrollback.indicator.style) { switch (term->conf->scrollback.indicator.position) {
case SCROLLBACK_INDICATOR_STYLE_NONE: case SCROLLBACK_INDICATOR_POSITION_NONE:
assert(false); assert(false);
return; return;
case SCROLLBACK_INDICATOR_STYLE_FIXED: case SCROLLBACK_INDICATOR_POSITION_FIXED:
surf_top = term->cell_height - margin; surf_top = term->cell_height - margin;
break; break;
case SCROLLBACK_INDICATOR_STYLE_RELATIVE: { case SCROLLBACK_INDICATOR_POSITION_RELATIVE: {
int lines = term->rows - 3; /* Avoid using first and two last rows */ int lines = term->rows - 3; /* Avoid using first and two last rows */
assert(lines > 0); assert(lines > 0);