mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
config: add scrollback section
* Move 'scrollback' to 'scrollback.lines' * Move (the new) 'scrollback-indicator-*' options to 'scrollback.indicator-*' Log a deprecation warning when the old 'scrollback' option is used, but don't remove it, yet.
This commit is contained in:
parent
25e745cd8a
commit
d11d374252
4 changed files with 53 additions and 17 deletions
|
|
@ -24,6 +24,11 @@
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
* **scrollback** option in `footrc`. Use the **lines** option in the
|
||||||
|
**[scrollback]** section instead.
|
||||||
|
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
||||||
34
config.c
34
config.c
|
|
@ -306,6 +306,9 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(key, "scrollback") == 0) {
|
else if (strcmp(key, "scrollback") == 0) {
|
||||||
|
LOG_WARN("deprecated: 'scrollback' option, "
|
||||||
|
"use 'lines' in the '[scrollback]' section instead'");
|
||||||
|
|
||||||
unsigned long lines;
|
unsigned long lines;
|
||||||
if (!str_to_ulong(value, 10, &lines)) {
|
if (!str_to_ulong(value, 10, &lines)) {
|
||||||
LOG_ERR("%s:%d: expected an integer: %s", path, lineno, value);
|
LOG_ERR("%s:%d: expected an integer: %s", path, lineno, value);
|
||||||
|
|
@ -314,7 +317,28 @@ 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-position") == 0) {
|
else {
|
||||||
|
LOG_ERR("%s:%u: invalid key: %s", path, lineno, key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
parse_section_scrollback(const char *key, const char *value, struct config *conf,
|
||||||
|
const char *path, unsigned lineno)
|
||||||
|
{
|
||||||
|
if (strcmp(key, "lines") == 0) {
|
||||||
|
unsigned long lines;
|
||||||
|
if (!str_to_ulong(value, 10, &lines)) {
|
||||||
|
LOG_ERR("%s:%d: expected an integer: %s", path, lineno, value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
conf->scrollback.lines = lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "indicator-position") == 0) {
|
||||||
if (strcmp(value, "none") == 0)
|
if (strcmp(value, "none") == 0)
|
||||||
conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_NONE;
|
conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_NONE;
|
||||||
else if (strcmp(value, "fixed") == 0)
|
else if (strcmp(value, "fixed") == 0)
|
||||||
|
|
@ -322,14 +346,14 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
else if (strcmp(value, "relative") == 0)
|
else if (strcmp(value, "relative") == 0)
|
||||||
conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_RELATIVE;
|
conf->scrollback.indicator.position = SCROLLBACK_INDICATOR_POSITION_RELATIVE;
|
||||||
else {
|
else {
|
||||||
LOG_ERR("%s:%d: scrollback-indicator-position must be one of "
|
LOG_ERR("%s:%d: indicator-position must be one of "
|
||||||
"'none', 'fixed' or 'moving'",
|
"'none', 'fixed' or 'moving'",
|
||||||
path, lineno);
|
path, lineno);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strcmp(key, "scrollback-indicator-format") == 0) {
|
else if (strcmp(key, "indicator-format") == 0) {
|
||||||
if (strcmp(value, "percentage") == 0) {
|
if (strcmp(value, "percentage") == 0) {
|
||||||
conf->scrollback.indicator.format
|
conf->scrollback.indicator.format
|
||||||
= SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE;
|
= SCROLLBACK_INDICATOR_FORMAT_PERCENTAGE;
|
||||||
|
|
@ -342,7 +366,7 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
|
|
||||||
size_t len = mbstowcs(NULL, value, -1);
|
size_t len = mbstowcs(NULL, value, -1);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
LOG_ERRNO("%s:%d: invalid scrollback-indicator-format value", path, lineno);
|
LOG_ERRNO("%s:%d: invalid indicator-format value", path, lineno);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -894,6 +918,7 @@ parse_config_file(FILE *f, struct config *conf, const char *path)
|
||||||
{
|
{
|
||||||
enum section {
|
enum section {
|
||||||
SECTION_MAIN,
|
SECTION_MAIN,
|
||||||
|
SECTION_SCROLLBACK,
|
||||||
SECTION_COLORS,
|
SECTION_COLORS,
|
||||||
SECTION_CURSOR,
|
SECTION_CURSOR,
|
||||||
SECTION_CSD,
|
SECTION_CSD,
|
||||||
|
|
@ -914,6 +939,7 @@ parse_config_file(FILE *f, struct config *conf, const char *path)
|
||||||
const char *name;
|
const char *name;
|
||||||
} section_info[] = {
|
} section_info[] = {
|
||||||
[SECTION_MAIN] = {&parse_section_main, "main"},
|
[SECTION_MAIN] = {&parse_section_main, "main"},
|
||||||
|
[SECTION_SCROLLBACK] = {&parse_section_scrollback, "scrollback"},
|
||||||
[SECTION_COLORS] = {&parse_section_colors, "colors"},
|
[SECTION_COLORS] = {&parse_section_colors, "colors"},
|
||||||
[SECTION_CURSOR] = {&parse_section_cursor, "cursor"},
|
[SECTION_CURSOR] = {&parse_section_cursor, "cursor"},
|
||||||
[SECTION_CSD] = {&parse_section_csd, "csd"},
|
[SECTION_CSD] = {&parse_section_csd, "csd"},
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,19 @@ in this order:
|
||||||
compositor can use this value to e.g. group multiple windows, or
|
compositor can use this value to e.g. group multiple windows, or
|
||||||
apply window management rules. Default: _foot_.
|
apply window management rules. Default: _foot_.
|
||||||
|
|
||||||
*scrollback*
|
*workers*
|
||||||
|
Number of threads to use for rendering. Set to 0 to disable
|
||||||
|
multithreading. Default: the number of available logical CPUs
|
||||||
|
(including SMT). Note that this is not always the best value. In
|
||||||
|
some cases, the number of physical _cores_ is better.
|
||||||
|
|
||||||
|
|
||||||
|
# SECTION: scrollback
|
||||||
|
|
||||||
|
*lines*
|
||||||
Number of scrollback lines. Default: _1000_.
|
Number of scrollback lines. Default: _1000_.
|
||||||
|
|
||||||
*scrollback-indicator-position*
|
*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
|
||||||
|
|
@ -76,17 +85,11 @@ in this order:
|
||||||
corresponding to the current scrollback position. Default:
|
corresponding to the current scrollback position. Default:
|
||||||
_relative_.
|
_relative_.
|
||||||
|
|
||||||
*scrollback-indicator-format*
|
*indicator-format*
|
||||||
Which format to use when displaying the scrollback position
|
Which format to use when displaying the scrollback position
|
||||||
indicator. Either _percentage_, _line_, or a custom fixed
|
indicator. Either _percentage_, _line_, or a custom fixed
|
||||||
string. This option is ignored if
|
string. This option is ignored if
|
||||||
*scrollback-indicator-position=none*. Default: _empty string_.
|
*indicator-position=none*. Default: _empty string_.
|
||||||
|
|
||||||
*workers*
|
|
||||||
Number of threads to use for rendering. Set to 0 to disable
|
|
||||||
multithreading. Default: the number of available logical CPUs
|
|
||||||
(including SMT). Note that this is not always the best value. In
|
|
||||||
some cases, the number of physical _cores_ is better.
|
|
||||||
|
|
||||||
|
|
||||||
# SECTION: cursor
|
# SECTION: cursor
|
||||||
|
|
|
||||||
8
footrc
8
footrc
|
|
@ -1,9 +1,6 @@
|
||||||
# -*- conf -*-
|
# -*- conf -*-
|
||||||
|
|
||||||
# font=monospace
|
# font=monospace
|
||||||
# scrollback=1000
|
|
||||||
# scrollback-indicator-position=relative
|
|
||||||
# scrollback-indicator-format=
|
|
||||||
# geometry=700x500
|
# geometry=700x500
|
||||||
# pad=2x2
|
# pad=2x2
|
||||||
# initial-window-mode=windowed
|
# initial-window-mode=windowed
|
||||||
|
|
@ -12,6 +9,11 @@
|
||||||
# login-shell=no
|
# login-shell=no
|
||||||
# workers=<number of logical CPUs>
|
# workers=<number of logical CPUs>
|
||||||
|
|
||||||
|
[scrollback]
|
||||||
|
# lines=1000
|
||||||
|
# indicator-position=relative
|
||||||
|
# indicator-format=
|
||||||
|
|
||||||
[cursor]
|
[cursor]
|
||||||
# style=block
|
# style=block
|
||||||
# color=111111 dcdccc
|
# color=111111 dcdccc
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue