mirror of
https://github.com/openai/codex.git
synced 2026-11-09 08:40:33 +00:00
Move disable_paste_burst under [tui] (#41976)
## What changed - Add `tui.disable_paste_burst` as the preferred configuration key. - Keep the top-level `disable_paste_burst` key as a legacy fallback. - Give the `[tui]` setting precedence when both keys are present, while preserving configuration-layer precedence. ## Testing Add configuration tests covering defaults, both key locations, precedence between the keys, and command-line overrides. GitOrigin-RevId: e7fc9337d5b19d2fd9407e08b8301cee77a11779
This commit is contained in:
1 parent
c7fced56eb
commit
d038f3448f
5 files changed
+99
-5
No files matched your search
@@ -487,9 +487,7 @@ pub struct ConfigToml {
|
|||||||
/// Defaults to `true`.
|
/// Defaults to `true`.
|
||||||
pub check_for_update_on_startup: Option<bool>,
|
pub check_for_update_on_startup: Option<bool>,
|
||||||
|
|
||||||
/// When true, disables burst-paste detection for typed input entirely.
|
/// Legacy fallback for `tui.disable_paste_burst`. Prefer the setting under `[tui]`.
|
||||||
/// All characters are inserted as they are received, and no buffering
|
|
||||||
/// or placeholder replacement will occur for fast keypress bursts.
|
|
||||||
pub disable_paste_burst: Option<bool>,
|
pub disable_paste_burst: Option<bool>,
|
||||||
|
|
||||||
/// When `false`, disables analytics across Codex product surfaces in this machine.
|
/// When `false`, disables analytics across Codex product surfaces in this machine.
|
||||||
|
|||||||
@@ -710,6 +710,12 @@ pub struct Tui {
|
|||||||
#[serde(default = "default_true")]
|
#[serde(default = "default_true")]
|
||||||
pub show_tooltips: bool,
|
pub show_tooltips: bool,
|
||||||
|
|
||||||
|
/// When true, disables burst-paste detection for typed input entirely.
|
||||||
|
/// All characters are inserted as they are received, and no buffering
|
||||||
|
/// or placeholder replacement will occur for fast keypress bursts.
|
||||||
|
/// Overrides the legacy top-level `disable_paste_burst` setting. Defaults to `false`.
|
||||||
|
pub disable_paste_burst: Option<bool>,
|
||||||
|
|
||||||
/// Start the composer in Vim mode (`Normal`) by default.
|
/// Start the composer in Vim mode (`Normal`) by default.
|
||||||
/// Defaults to `false`.
|
/// Defaults to `false`.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|||||||
@@ -3772,6 +3772,10 @@
|
|||||||
"description": "Enable animations (welcome screen, shimmer effects, spinners). Defaults to `true`.",
|
"description": "Enable animations (welcome screen, shimmer effects, spinners). Defaults to `true`.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"disable_paste_burst": {
|
||||||
|
"description": "When true, disables burst-paste detection for typed input entirely. All characters are inserted as they are received, and no buffering or placeholder replacement will occur for fast keypress bursts. Overrides the legacy top-level `disable_paste_burst` setting. Defaults to `false`.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"keymap": {
|
"keymap": {
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
@@ -5798,7 +5802,7 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"disable_paste_burst": {
|
"disable_paste_burst": {
|
||||||
"description": "When true, disables burst-paste detection for typed input entirely. All characters are inserted as they are received, and no buffering or placeholder replacement will occur for fast keypress bursts.",
|
"description": "Legacy fallback for `tui.disable_paste_burst`. Prefer the setting under `[tui]`.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"experimental_compact_prompt_file": {
|
"experimental_compact_prompt_file": {
|
||||||
|
|||||||
@@ -1210,6 +1210,7 @@ fn config_toml_deserializes_model_availability_nux() {
|
|||||||
notification_settings: TuiNotificationSettings::default(),
|
notification_settings: TuiNotificationSettings::default(),
|
||||||
animations: true,
|
animations: true,
|
||||||
show_tooltips: true,
|
show_tooltips: true,
|
||||||
|
disable_paste_burst: None,
|
||||||
vim_mode_default: false,
|
vim_mode_default: false,
|
||||||
raw_output_mode: false,
|
raw_output_mode: false,
|
||||||
alternate_screen: AltScreenMode::default(),
|
alternate_screen: AltScreenMode::default(),
|
||||||
@@ -4289,6 +4290,7 @@ fn tui_config_missing_notifications_field_defaults_to_enabled() {
|
|||||||
notification_settings: TuiNotificationSettings::default(),
|
notification_settings: TuiNotificationSettings::default(),
|
||||||
animations: true,
|
animations: true,
|
||||||
show_tooltips: true,
|
show_tooltips: true,
|
||||||
|
disable_paste_burst: None,
|
||||||
vim_mode_default: false,
|
vim_mode_default: false,
|
||||||
raw_output_mode: false,
|
raw_output_mode: false,
|
||||||
alternate_screen: AltScreenMode::Auto,
|
alternate_screen: AltScreenMode::Auto,
|
||||||
@@ -4307,6 +4309,85 @@ fn tui_config_missing_notifications_field_defaults_to_enabled() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn runtime_config_resolves_disable_paste_burst() -> anyhow::Result<()> {
|
||||||
|
for (toml, expected) in [
|
||||||
|
("", false),
|
||||||
|
("disable_paste_burst = true", true),
|
||||||
|
("disable_paste_burst = true\n[tui]", true),
|
||||||
|
("[tui]\ndisable_paste_burst = true", true),
|
||||||
|
(
|
||||||
|
"disable_paste_burst = true\n[tui]\ndisable_paste_burst = false",
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"disable_paste_burst = false\n[tui]\ndisable_paste_burst = true",
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
] {
|
||||||
|
let config = Config::load_from_base_config_with_overrides(
|
||||||
|
toml::from_str(toml)?,
|
||||||
|
ConfigOverrides::default(),
|
||||||
|
tempdir()?.abs(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
assert_eq!(config.disable_paste_burst, expected, "config: {toml}");
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn disable_paste_burst_preserves_layering_and_new_key_precedence() -> anyhow::Result<()> {
|
||||||
|
for (toml, key, value, expected) in [
|
||||||
|
(
|
||||||
|
"disable_paste_burst = true",
|
||||||
|
"disable_paste_burst",
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"disable_paste_burst = true",
|
||||||
|
"tui.disable_paste_burst",
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"[tui]\ndisable_paste_burst = true",
|
||||||
|
"tui.disable_paste_burst",
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"[tui]\ndisable_paste_burst = true",
|
||||||
|
"disable_paste_burst",
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"[tui]\ndisable_paste_burst = false",
|
||||||
|
"disable_paste_burst",
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
] {
|
||||||
|
let codex_home = TempDir::new()?;
|
||||||
|
std::fs::write(codex_home.path().join(CONFIG_TOML_FILE), toml)?;
|
||||||
|
let config = ConfigBuilder::without_managed_config_for_tests()
|
||||||
|
.codex_home(codex_home.path().to_path_buf())
|
||||||
|
.fallback_cwd(Some(codex_home.path().to_path_buf()))
|
||||||
|
.cli_overrides(vec![(key.to_string(), TomlValue::Boolean(value))])
|
||||||
|
.build()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
config.disable_paste_burst, expected,
|
||||||
|
"config: {toml}, override: {key}={value}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn runtime_config_resolves_terminal_resize_reflow_defaults_and_overrides() {
|
async fn runtime_config_resolves_terminal_resize_reflow_defaults_and_overrides() {
|
||||||
let cfg = Config::load_from_base_config_with_overrides(
|
let cfg = Config::load_from_base_config_with_overrides(
|
||||||
|
|||||||
@@ -4302,7 +4302,12 @@ impl Config {
|
|||||||
active_project,
|
active_project,
|
||||||
notices,
|
notices,
|
||||||
check_for_update_on_startup,
|
check_for_update_on_startup,
|
||||||
disable_paste_burst: cfg.disable_paste_burst.unwrap_or(false),
|
disable_paste_burst: cfg
|
||||||
|
.tui
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|tui| tui.disable_paste_burst)
|
||||||
|
.or(cfg.disable_paste_burst)
|
||||||
|
.unwrap_or(false),
|
||||||
analytics_enabled: cfg.analytics.as_ref().and_then(|a| a.enabled),
|
analytics_enabled: cfg.analytics.as_ref().and_then(|a| a.enabled),
|
||||||
feedback_enabled: cfg
|
feedback_enabled: cfg
|
||||||
.feedback
|
.feedback
|
||||||
|
|||||||
Reference in new issue
Block a user