Added feature switch to disable animations in TUI (#6870)

This PR adds support for a new feature flag `tui.animations`. By
default, the TUI uses animations in its welcome screen, "working"
spinners, and "shimmer" effects. This animations can interfere with
screen readers, so it's good to provide a way to disable them.

This change is inspired by [a
PR](https://github.com/openai/codex/pull/4014) contributed by @Orinks.
That PR has faltered a bit, but I think the core idea is sound. This
version incorporates feedback from @aibrahim-oai. In particular:
1. It uses a feature flag (`tui.animations`) rather than the unqualified
CLI key `no-animations`. Feature flags are the preferred way to expose
boolean switches. They are also exposed via CLI command switches.
2. It includes more complete documentation.
3. It disables a few animations that the other PR omitted.
This commit is contained in:
Eric Traut authored and GitHub committed 2025-11-20 10:40:08 -08:00
1 parent 888c6dd9e7
commit d909048a85
15 files changed
+326 -188

No files matched your search

+10 -1
View File
@@ -962,6 +962,7 @@ impl ChatWidget {
parsed,
source,
None,
self.config.animations,
)));
}
@@ -1071,6 +1072,7 @@ impl ChatWidget {
ev.parsed_cmd,
ev.source,
interaction_input,
self.config.animations,
)));
}
@@ -1083,6 +1085,7 @@ impl ChatWidget {
self.active_cell = Some(Box::new(history_cell::new_active_mcp_tool_call(
ev.call_id,
ev.invocation,
self.config.animations,
)));
self.request_redraw();
}
@@ -1104,7 +1107,11 @@ impl ChatWidget {
Some(cell) if cell.call_id() == call_id => cell.complete(duration, result),
_ => {
self.flush_active_cell();
let mut cell = history_cell::new_active_mcp_tool_call(call_id, invocation);
let mut cell = history_cell::new_active_mcp_tool_call(
call_id,
invocation,
self.config.animations,
);
let extra_cell = cell.complete(duration, result);
self.active_cell = Some(Box::new(cell));
extra_cell
@@ -1146,6 +1153,7 @@ impl ChatWidget {
enhanced_keys_supported,
placeholder_text: placeholder,
disable_paste_burst: config.disable_paste_burst,
animations_enabled: config.animations,
}),
active_cell: None,
config: config.clone(),
@@ -1220,6 +1228,7 @@ impl ChatWidget {
enhanced_keys_supported,
placeholder_text: placeholder,
disable_paste_burst: config.disable_paste_burst,
animations_enabled: config.animations,
}),
active_cell: None,
config: config.clone(),