Files
codex/codex-rs/tui/src/startup_presentation_tests.rs
T
Eric Traut a2de8fedcc Move fullscreen transcript control to TUI configuration (#46849)
## What changed

Use `tui.fullscreen_transcript` to opt into the fullscreen transcript, including scrolling, selection, and search. It defaults to `false`; `--no-alt-screen` and `tui.alternate_screen = "never"` still take precedence.

The new preference controls both the first frame and application startup. Boolean CLI overrides for it are allowed during daemon startup. The old `features.transcript_v2` flag is deprecated and ignored, with a notice directing users to the new setting; it does not migrate into or override the preference.

## Testing

Add coverage for default terminal scrollback, fullscreen persistence through startup, alternate-screen restrictions, daemon override validation, and independence from the deprecated flag. Update existing history and activity tests to use the new preference.

GitOrigin-RevId: 4117bf1ee548fa8d101a594f9506673d87c74c15
2026-09-20 16:59:00 +00:00

99 lines
3.0 KiB
Rust

//! Check first-frame editor and screen settings using the real client configuration loader.
use super::*;
use clap::Parser;
use crossterm::event::KeyCode;
use pretty_assertions::assert_eq;
#[tokio::test]
async fn selected_profile_controls_submit_before_the_first_frame() -> anyhow::Result<()> {
let home = tempfile::tempdir()?;
std::fs::write(
home.path().join("config.toml"),
"disable_paste_burst = false\n",
)?;
let selected = AbsolutePathBuf::from_absolute_path(home.path().join("work.config.toml"))?;
let cli = Cli::try_parse_from(["codex"])?;
for (submit, expected_bindings) in [
("[]", Vec::new()),
("\"f12\"", vec![crate::key_hint::plain(KeyCode::F(12))]),
] {
std::fs::write(
&selected,
format!("disable_paste_burst = true\n[tui.keymap.composer]\nsubmit = {submit}\n"),
)?;
let presentation = load(
&cli,
home.path(),
LoaderOverrides {
user_config_path: Some(selected.clone()),
user_config_profile: Some("work".parse()?),
ignore_project_config: true,
..LoaderOverrides::without_managed_config_for_tests()
},
Vec::new(),
/*config_cwd*/ None,
)
.await?;
assert_eq!(
(
presentation.screen.keymap.composer.submit,
presentation.screen.disable_paste_burst,
),
(expected_bindings, true),
);
}
Ok(())
}
#[tokio::test]
async fn first_frame_respects_screen_and_status_line_overrides() -> anyhow::Result<()> {
let home = tempfile::tempdir()?;
for (config, args, expected) in [
("", vec!["codex"], (true, false, true)),
(
"[tui]\nfullscreen_transcript = true\n",
vec!["codex"],
(true, true, true),
),
(
"[tui]\nfullscreen_transcript = true\n",
vec!["codex", "--no-alt-screen"],
(false, false, true),
),
(
"[tui]\nfullscreen_transcript = false\n",
vec!["codex"],
(true, false, true),
),
(
"[tui]\nfullscreen_transcript = true\nalternate_screen = \"never\"\nstatus_line = []\n",
vec!["codex"],
(false, false, false),
),
] {
std::fs::write(home.path().join("config.toml"), config)?;
let cli = Cli::try_parse_from(args)?;
let presentation = load(
&cli,
home.path(),
LoaderOverrides {
ignore_project_config: true,
..LoaderOverrides::without_managed_config_for_tests()
},
Vec::new(),
/*config_cwd*/ None,
)
.await?;
assert_eq!(
(
presentation.screen.use_alt_screen,
presentation.screen.transcript_mode.is_owned(),
presentation.screen.status_line_enabled
),
expected,
);
}
Ok(())
}