diff --git a/CHANGELOG.md b/CHANGELOG.md index 35669232..dc6fc301 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ * Mouse cursor is now always a `left_ptr` when inside the margins, to indicate it is not possible to start a selection. * 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` (https://codeberg.org/dnkl/foot/issues/42). diff --git a/config.c b/config.c index 2b989d62..169b2b40 100644 --- a/config.c +++ b/config.c @@ -291,15 +291,15 @@ parse_section_main(const char *key, const char *value, struct config *conf, 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) - conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_NONE; + conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_NONE; 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) - conf->scrollback.indicator.style = SCROLLBACK_INDICATOR_STYLE_RELATIVE; + conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_RELATIVE; 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'", path, lineno); return false; @@ -950,7 +950,7 @@ config_load(struct config *conf, const char *conf_path) .scrollback = { .lines = 1000, .indicator = { - .style = SCROLLBACK_INDICATOR_STYLE_RELATIVE, + .position = SCROLLBACK_INDICATOR_POSITION_RELATIVE, .format = SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, }, }, diff --git a/config.h b/config.h index 456019b5..eee01e65 100644 --- a/config.h +++ b/config.h @@ -44,10 +44,10 @@ struct config { struct { enum { - SCROLLBACK_INDICATOR_STYLE_NONE, - SCROLLBACK_INDICATOR_STYLE_FIXED, - SCROLLBACK_INDICATOR_STYLE_RELATIVE - } style; + SCROLLBACK_INDICATOR_POSITION_NONE, + SCROLLBACK_INDICATOR_POSITION_FIXED, + SCROLLBACK_INDICATOR_POSITION_RELATIVE + } position; enum { SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE, diff --git a/doc/foot.5.scd b/doc/foot.5.scd index 188e8edf..949e2751 100644 --- a/doc/foot.5.scd +++ b/doc/foot.5.scd @@ -68,7 +68,7 @@ in this order: *scrollback* Number of scrollback lines. Default: _1000_. -*scrollback-indicator-style* +*scrollback-indicator-position* Configures the style of the scrollback position indicator. One of *none*, *fixed* or *relative*. *none* disables the indicator completely. *fixed* always renders the indicator near the top at @@ -79,7 +79,7 @@ in this order: *scrollback-indicator-format* Which format to use when displaying the scrollback position indicator. Either _percentage_ or _line_. This option is ignored - if *scrollback-indicator-style=none*. Default: _percentage_. + if *scrollback-indicator-position=none*. Default: _percentage_. *workers* Number of threads to use for rendering. Set to 0 to disable diff --git a/footrc b/footrc index 117b73fe..900ce149 100644 --- a/footrc +++ b/footrc @@ -2,7 +2,7 @@ # font=monospace # scrollback=1000 -# scrollback-indicator-style=relative +# scrollback-indicator-position=relative # scrollback-indicator-format=percentage # geometry=700x500 # pad=2x2 diff --git a/render.c b/render.c index 59601c05..195839fb 100644 --- a/render.c +++ b/render.c @@ -1290,7 +1290,7 @@ render_csd(struct terminal *term) static void 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; struct wayland *wayl = term->wl; @@ -1414,16 +1414,16 @@ render_scrollback_position(struct terminal *term) /* *Where* to render - parent relative coordinates */ int surf_top = 0; - switch (term->conf->scrollback.indicator.style) { - case SCROLLBACK_INDICATOR_STYLE_NONE: + switch (term->conf->scrollback.indicator.position) { + case SCROLLBACK_INDICATOR_POSITION_NONE: assert(false); return; - case SCROLLBACK_INDICATOR_STYLE_FIXED: + case SCROLLBACK_INDICATOR_POSITION_FIXED: surf_top = term->cell_height - margin; break; - case SCROLLBACK_INDICATOR_STYLE_RELATIVE: { + case SCROLLBACK_INDICATOR_POSITION_RELATIVE: { int lines = term->rows - 3; /* Avoid using first and two last rows */ assert(lines > 0);