Add an optional build-time switch to disable scrollback support

This change introduces a new `scrollback` Meson build option (enabled
by default) that lets foot be compiled without scrollback history.
When the option is off, `FOOT_HAVE_SCROLLBACK` is left
undefined and the relevant code is excluded from the build,
producing a slimmer terminal for use cases that do not need it.

With scrollback disabled:

- The `[scrollback]` section in `foot.ini` and its key bindings
  become no-ops.
- In-terminal search is removed,
  along with the "pipe scrollback" action, the scrollback indicator,
  and their colors/overlays.
- IME hooks for the search box, mouse-wheel scrollback handling,
  and related `terminal` state are compiled out.
- Selection auto-scroll (the timer that scrolls the viewport while
  a drag-selection extends past the visible area) is removed,
  since with no scrollback there is nowhere to scroll to.
  The associated function declarations,
  `enum selection_scroll_direction`,
  the `auto_scroll` field on `terminal::selection`,
  and their init/teardown sites are all excluded from the build.

To keep action enumerations stable across build configurations,
two range markers (`BIND_ACTION_PIPE_FIRST` / `BIND_ACTION_PIPE_LAST`)
are introduced so that pipe-action handling does not depend on
`PIPE_SCROLLBACK` being present. The build summary and
`foot --version` now report `+scrollback` or `-scrollback`,
and the config tests have been updated to account for optional section.
This commit is contained in:
Campbell Barton 2026-05-15 15:51:01 +10:00
parent f35e60577f
commit d28ac267d2
25 changed files with 317 additions and 22 deletions

View file

@ -166,11 +166,14 @@ struct color_theme {
uint32_t bg;
} jump_label;
#if defined(FOOT_HAVE_SCROLLBACK)
struct {
uint32_t fg;
uint32_t bg;
} scrollback_indicator;
#endif /* FOOT_HAVE_SCROLLBACK */
#if defined(FOOT_HAVE_SCROLLBACK)
struct {
struct {
uint32_t fg;
@ -182,14 +185,17 @@ struct color_theme {
uint32_t bg;
} match;
} search_box;
#endif /* FOOT_HAVE_SCROLLBACK */
struct {
bool cursor:1;
bool jump_label:1;
bool scrollback_indicator:1;
bool url:1;
#if defined(FOOT_HAVE_SCROLLBACK)
bool scrollback_indicator:1;
bool search_box_no_match:1;
bool search_box_match:1;
#endif /* FOOT_HAVE_SCROLLBACK */
uint8_t dim;
} use_custom;
@ -308,6 +314,7 @@ struct config {
bool command_focused;
} bell;
#if defined(FOOT_HAVE_SCROLLBACK)
struct {
uint32_t lines;
@ -328,6 +335,7 @@ struct config {
} indicator;
float multiplier;
} scrollback;
#endif /* FOOT_HAVE_SCROLLBACK */
struct {
char32_t *label_letters;
@ -375,9 +383,11 @@ struct config {
* Special modes
*/
#if defined(FOOT_HAVE_SCROLLBACK)
/* While searching (not - action to *start* a search is in the
* 'key' bindings above */
struct config_key_binding_list search;
#endif /* FOOT_HAVE_SCROLLBACK */
/* While showing URL jump labels */
struct config_key_binding_list url;