mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
90f262e9a4
Introduce a full codex-tui source snapshot under the new codex-tui2 crate so viewport work can be replayed in isolation. This change copies the entire codex-rs/tui/src tree into codex-rs/tui2/src in one atomic step, rather than piecemeal, to keep future diffs vs the original viewport bookmark easy to reason about. The goal is for codex-tui2 to render identically to the existing TUI behind the `features.tui2` flag while we gradually port the viewport/history commits from the joshka/viewport bookmark onto this forked tree. While on this baseline change, we also ran the codex-tui2 snapshot test suite and accepted all insta snapshots for the new crate, so the snapshot files now use the codex-tui2 naming scheme and encode the unmodified legacy TUI behavior. This keeps later viewport commits focused on intentional behavior changes (and their snapshots) rather than on mechanical snapshot renames.
72 lines
3.6 KiB
Rust
72 lines
3.6 KiB
Rust
use std::time::Duration;
|
|
|
|
// Embed animation frames for each variant at compile time.
|
|
macro_rules! frames_for {
|
|
($dir:literal) => {
|
|
[
|
|
include_str!(concat!("../frames/", $dir, "/frame_1.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_2.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_3.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_4.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_5.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_6.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_7.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_8.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_9.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_10.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_11.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_12.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_13.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_14.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_15.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_16.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_17.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_18.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_19.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_20.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_21.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_22.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_23.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_24.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_25.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_26.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_27.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_28.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_29.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_30.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_31.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_32.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_33.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_34.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_35.txt")),
|
|
include_str!(concat!("../frames/", $dir, "/frame_36.txt")),
|
|
]
|
|
};
|
|
}
|
|
|
|
pub(crate) const FRAMES_DEFAULT: [&str; 36] = frames_for!("default");
|
|
pub(crate) const FRAMES_CODEX: [&str; 36] = frames_for!("codex");
|
|
pub(crate) const FRAMES_OPENAI: [&str; 36] = frames_for!("openai");
|
|
pub(crate) const FRAMES_BLOCKS: [&str; 36] = frames_for!("blocks");
|
|
pub(crate) const FRAMES_DOTS: [&str; 36] = frames_for!("dots");
|
|
pub(crate) const FRAMES_HASH: [&str; 36] = frames_for!("hash");
|
|
pub(crate) const FRAMES_HBARS: [&str; 36] = frames_for!("hbars");
|
|
pub(crate) const FRAMES_VBARS: [&str; 36] = frames_for!("vbars");
|
|
pub(crate) const FRAMES_SHAPES: [&str; 36] = frames_for!("shapes");
|
|
pub(crate) const FRAMES_SLUG: [&str; 36] = frames_for!("slug");
|
|
|
|
pub(crate) const ALL_VARIANTS: &[&[&str]] = &[
|
|
&FRAMES_DEFAULT,
|
|
&FRAMES_CODEX,
|
|
&FRAMES_OPENAI,
|
|
&FRAMES_BLOCKS,
|
|
&FRAMES_DOTS,
|
|
&FRAMES_HASH,
|
|
&FRAMES_HBARS,
|
|
&FRAMES_VBARS,
|
|
&FRAMES_SHAPES,
|
|
&FRAMES_SLUG,
|
|
];
|
|
|
|
pub(crate) const FRAME_TICK_DEFAULT: Duration = Duration::from_millis(80);
|