mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
## What changed Add `tui.mouse_scroll_speed` as a finite positive multiplier for transcript mouse wheel scrolling, including transcript overlays and session previews. Change the default from three rows to one row per wheel event; set the multiplier to `3.0` to retain the previous speed. Fractional values accumulate movement across events and discard the remainder when direction reverses. For example, `0.5` scrolls one row every two events. Following the latest output pauses only when a whole row moves. ## Testing Add tests for configuration validation, integer and fractional scroll speeds, direction changes, decimal accumulation, and following behavior. Extend local settings coverage to include a command-line override for the new setting. GitOrigin-RevId: d355e246fd943415f0ce5a6affe849f77f3615e6
27 lines
843 B
Rust
27 lines
843 B
Rust
//! Keep transcript mouse-scroll speed validation and its configuration schema in sync.
|
|
|
|
use schemars::JsonSchema;
|
|
use schemars::r#gen::SchemaGenerator;
|
|
use schemars::schema::Schema;
|
|
use serde::Deserialize;
|
|
use serde::Deserializer;
|
|
|
|
pub(crate) fn schema(generator: &mut SchemaGenerator) -> Schema {
|
|
let mut schema = Option::<f64>::json_schema(generator).into_object();
|
|
schema.number().exclusive_minimum = Some(0.0);
|
|
schema.into()
|
|
}
|
|
|
|
pub(crate) fn deserialize<'de, D>(deserializer: D) -> Result<Option<f64>, D::Error>
|
|
where
|
|
D: Deserializer<'de>,
|
|
{
|
|
let speed = Option::<f64>::deserialize(deserializer)?;
|
|
if speed.is_some_and(|speed| !speed.is_finite() || speed <= 0.0) {
|
|
return Err(serde::de::Error::custom(
|
|
"tui.mouse_scroll_speed must be a finite positive number",
|
|
));
|
|
}
|
|
Ok(speed)
|
|
}
|