Logo e schermata di avvio di aKode al posto dell'animazione con marchio OpenAI/Codex (A)

Ripristinati come in aKode 0.9.2: fantasmino e banner AKODE (branding.rs), schermata di benvenuto,
intestazione di sessione con il fantasmino, [tui.effects] welcome = false di default (il logo
resta nell'avvio; riattivabile), attribuzione di open-bot-avatar (MIT) in NOTICE.
Tolta l'animazione upstream con il marchio OpenAI e Codex. Il test dello splash tiene conto
della versione piu' lunga. Testi inglesi dell'intestazione invariati; snapshot rigenerati.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-17 14:33:06 +01:00
parent 03e097207c
commit 925917c58c
55 changed files with 711 additions and 1552 deletions

View File

@@ -13,7 +13,8 @@ pub struct TuiEffects {
pub starfield: bool,
/// Shimmer status and loading text.
pub shimmer: bool,
/// Animate the welcome artwork.
/// Show the welcome artwork (ghost + AKODE) in an empty session. aKode: off by default,
/// the session header already shows the name; the first-run setup always shows it.
pub welcome: bool,
/// Animate reasoning-effort changes in the composer and footer.
pub effort: bool,
@@ -28,7 +29,7 @@ impl Default for TuiEffects {
Self {
starfield: true,
shimmer: true,
welcome: true,
welcome: false,
effort: true,
progress: true,
title: true,

View File

@@ -4947,7 +4947,7 @@
"shimmer": true,
"starfield": true,
"title": true,
"welcome": true
"welcome": false
},
"description": "Individual visual effects. Each also requires animations to be enabled."
},
@@ -5834,8 +5834,8 @@
"type": "boolean"
},
"welcome": {
"default": true,
"description": "Animate the welcome artwork.",
"default": false,
"description": "Show the welcome artwork (ghost + AKODE) in an empty session. aKode: off by default, the session header already shows the name; the first-run setup always shows it.",
"type": "boolean"
}
},

View File

@@ -927,13 +927,6 @@ impl App {
{
return Ok(AppRunControl::Continue);
}
// Resume arrives after suspension; retain the last painted phase across hidden owners.
if matches!(&event, TuiEvent::Resume) || !tui.is_owned_screen() || self.overlay.is_some() {
self.chat_widget
.empty_state_animation
.borrow_mut()
.pause_clock();
}
let transcript_owns_input = match (&event, &self.overlay) {
(TuiEvent::Key(key), Some(Overlay::Transcript(overlay))) => {
overlay.owns_interaction_key(*key)
@@ -1382,10 +1375,6 @@ impl App {
return self.render_owned_transcript(tui, screen_size);
}
self.prepare_frame_images();
self.chat_widget
.empty_state_animation
.borrow_mut()
.pause_clock();
self.chat_widget.sync_warnings(&self.transcript_cells);
let dashboard_visible = self
.chat_widget

View File

@@ -5,12 +5,11 @@ use super::*;
use pretty_assertions::assert_eq;
use ratatui::buffer::Buffer;
fn has_blossom(tui: &tui::Tui) -> bool {
fn has_splash(tui: &tui::Tui) -> bool {
text(crate::custom_terminal::test_support::last_rendered_buffer(
&tui.terminal,
))
.chars()
.any(|ch| ('\u{2801}'..='\u{28ff}').contains(&ch))
.contains(crate::branding::WELCOME_LINE)
}
fn text(buffer: &Buffer) -> String {
@@ -39,6 +38,8 @@ fn draw(app: &mut App, tui: &mut tui::Tui, size: Size) -> Result<Rect> {
#[tokio::test]
async fn fresh_logo_returns_only_to_the_ordinary_composer() -> Result<()> {
let mut app = crate::app::test_support::make_test_app().await;
// aKode: the in-session splash is opt-in.
app.local_settings.tui.effects.welcome = true;
app.local_settings.tui.animations = true;
let size = Size::new(/*width*/ 120, /*height*/ 44);
let mut tui = crate::tui::test_support::make_test_tui()?;
@@ -50,37 +51,37 @@ async fn fresh_logo_returns_only_to_the_ordinary_composer() -> Result<()> {
.start_fresh();
draw(&mut app, &mut tui, size)?;
let cursor = tui.terminal.last_known_cursor_pos;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
app.open_transcript_overlay(&mut tui);
draw(&mut app, &mut tui, size)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
assert_eq!(tui.terminal.last_known_cursor_pos, cursor);
app.close_transcript_overlay(&mut tui);
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
app.transcript_view.begin_search();
draw(&mut app, &mut tui, size)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
app.transcript_view.handle_key(
KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE),
&app.transcript_cells,
);
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
for enabled in [true, false] {
app.apply_raw_output_mode(&mut tui, enabled, /*notify*/ false);
draw(&mut app, &mut tui, size)?;
assert_eq!(has_blossom(&tui), !enabled);
assert_eq!(has_splash(&tui), !enabled);
}
app.chat_widget.apply_external_edit(String::new());
for (key, visible) in [(KeyCode::Char('?'), false), (KeyCode::Right, true)] {
app.chat_widget
.handle_key_event(KeyEvent::new(key, KeyModifiers::NONE));
draw(&mut app, &mut tui, size)?;
assert_eq!(has_blossom(&tui), visible);
assert_eq!(has_splash(&tui), visible);
}
tui.set_owned_screen(/*owned*/ false)?;
Ok(())
@@ -89,6 +90,8 @@ async fn fresh_logo_returns_only_to_the_ordinary_composer() -> Result<()> {
#[tokio::test]
async fn non_startup_history_dismisses_logo_until_a_new_thread() -> Result<()> {
let mut app = crate::app::test_support::make_test_app().await;
// aKode: the in-session splash is opt-in.
app.local_settings.tui.effects.welcome = true;
app.local_settings.tui.animations = true;
// Leave room for the full release-note card above the centered logo.
let size = Size::new(/*width*/ 120, /*height*/ 64);
@@ -128,7 +131,7 @@ async fn non_startup_history_dismisses_logo_until_a_new_thread() -> Result<()> {
)),
);
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
// Even invisible non-startup content ends eligibility before a frame or clear can erase it.
app.insert_history_cell(
@@ -138,13 +141,13 @@ async fn non_startup_history_dismisses_logo_until_a_new_thread() -> Result<()> {
app.reset_transcript_state_after_clear();
app.queue_clear_ui_header(&mut tui);
draw(&mut app, &mut tui, size)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
app.chat_widget
.empty_state_animation
.borrow_mut()
.start_fresh();
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
tui.set_owned_screen(/*owned*/ false)?;
Ok(())
}
@@ -152,6 +155,8 @@ async fn non_startup_history_dismisses_logo_until_a_new_thread() -> Result<()> {
#[tokio::test]
async fn empty_state_animation_preserves_header_cursor_and_footer() -> Result<()> {
let mut app = crate::app::test_support::make_test_app().await;
// aKode: the in-session splash is opt-in.
app.local_settings.tui.effects.welcome = true;
app.local_settings.tui.animations = true;
let size = Size::new(/*width*/ 120, /*height*/ 44);
let mut tui = crate::tui::test_support::make_test_tui()?;
@@ -167,14 +172,14 @@ async fn empty_state_animation_preserves_header_cursor_and_footer() -> Result<()
let history_len = app.transcript_cells.len();
let before = crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal).clone();
let cursor = tui.terminal.last_known_cursor_pos;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
app.chat_widget
.empty_state_animation
.borrow_mut()
.start_fresh();
assert_eq!(draw(&mut app, &mut tui, size)?, before_bottom);
let after = crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal);
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
assert_eq!(tui.terminal.last_known_cursor_pos, cursor);
assert_eq!(
&after.content[after.index_of(/*x*/ 0, before_bottom.y)..],
@@ -190,16 +195,16 @@ async fn empty_state_animation_preserves_header_cursor_and_footer() -> Result<()
);
let short = Size::new(/*width*/ 120, /*height*/ 12);
draw(&mut app, &mut tui, short)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
app.chat_widget.apply_external_edit("/m".to_string());
draw(&mut app, &mut tui, size)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
app.chat_widget.apply_external_edit(String::new());
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
assert_eq!(app.transcript_cells.len(), history_len);
app.local_settings.tui.animations = false;
draw(&mut app, &mut tui, size)?;
@@ -215,7 +220,7 @@ async fn empty_state_animation_preserves_header_cursor_and_footer() -> Result<()
app.local_settings.tui.effects.welcome = true;
app.local_settings.tui.effects.shimmer = false;
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
tui.set_owned_screen(/*owned*/ false)?;
Ok(())
}
@@ -223,6 +228,8 @@ async fn empty_state_animation_preserves_header_cursor_and_footer() -> Result<()
#[tokio::test]
async fn submitting_a_draft_dismisses_logo_even_after_clear() -> Result<()> {
let (mut app, _events, _ops) = crate::app::tests::make_test_app_with_channels().await;
// aKode: the in-session splash is opt-in.
app.local_settings.tui.effects.welcome = true;
app.local_settings.tui.animations = true;
let size = Size::new(/*width*/ 120, /*height*/ 44);
let mut tui = crate::tui::test_support::make_test_tui()?;
@@ -233,29 +240,29 @@ async fn submitting_a_draft_dismisses_logo_even_after_clear() -> Result<()> {
.borrow_mut()
.start_fresh();
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
app.chat_widget
.apply_external_edit("first prompt".to_string());
draw(&mut app, &mut tui, size)?;
let drafting = crate::custom_terminal::test_support::last_rendered_buffer(&tui.terminal);
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
assert!(text(drafting).contains("first prompt"));
app.chat_widget.apply_external_edit(String::new());
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
app.chat_widget
.apply_external_edit("first prompt".to_string());
app.chat_widget
.handle_key_event(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE));
draw(&mut app, &mut tui, size)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
let short = Size::new(/*width*/ 120, /*height*/ 8);
draw(&mut app, &mut tui, short)?;
draw(&mut app, &mut tui, size)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
app.reset_transcript_state_after_clear();
draw(&mut app, &mut tui, size)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
tui.set_owned_screen(/*owned*/ false)?;
Ok(())
}
@@ -267,6 +274,8 @@ async fn empty_state_animation_survives_plain_transcript_clicks() -> Result<()>
use crossterm::event::MouseEventKind;
let mut app = crate::app::test_support::make_test_app().await;
// aKode: the in-session splash is opt-in.
app.local_settings.tui.effects.welcome = true;
app.local_settings.tui.animations = true;
let size = Size::new(/*width*/ 120, /*height*/ 44);
let mut tui = crate::tui::test_support::make_test_tui()?;
@@ -295,7 +304,7 @@ async fn empty_state_animation_survives_plain_transcript_clicks() -> Result<()>
&app.transcript_cells,
);
draw(&mut app, &mut tui, size)?;
assert_eq!(has_blossom(&tui), visible);
assert_eq!(has_splash(&tui), visible);
if visible {
assert_eq!(tui.terminal.last_known_cursor_pos, cursor);
}
@@ -307,10 +316,10 @@ async fn empty_state_animation_survives_plain_transcript_clicks() -> Result<()>
);
app.transcript_view.end_selection(&app.transcript_cells);
draw(&mut app, &mut tui, size)?;
assert!(!has_blossom(&tui));
assert!(!has_splash(&tui));
app.transcript_view.jump_to_latest();
draw(&mut app, &mut tui, size)?;
assert!(has_blossom(&tui));
assert!(has_splash(&tui));
tui.set_owned_screen(/*owned*/ false)?;
Ok(())
}

View File

@@ -352,10 +352,6 @@ impl App {
}
pub(super) async fn launch_external_editor(&mut self, tui: &mut tui::Tui) {
self.chat_widget
.empty_state_animation
.borrow_mut()
.pause_clock();
let editor_cmd = match external_editor::resolve_editor_command() {
Ok(cmd) => cmd,
Err(external_editor::EditorError::MissingEditor) => {
@@ -411,10 +407,6 @@ impl App {
}
pub(super) fn request_external_editor_launch(&mut self, tui: &mut tui::Tui) {
self.chat_widget
.empty_state_animation
.borrow_mut()
.pause_clock();
self.chat_widget
.set_external_editor_state(ExternalEditorState::Requested);
self.chat_widget.set_footer_hint_override(Some(vec![(

View File

@@ -105,7 +105,7 @@ pub(super) struct PaintedConversation {
shown_tip: Option<TipSurface>,
needs_redraw: bool,
/// Delays requested by copy feedback, the empty-state animation, and the transcript.
delayed_frames: [Option<Duration>; 3],
delayed_frames: [Option<Duration>; 2],
}
impl PreparedConversation {
@@ -685,9 +685,9 @@ impl App {
);
needs_redraw = false;
}
let blossom_tick = chat_widget
chat_widget
.empty_state_animation
.borrow_mut()
.borrow()
.render_first_screen(
area,
Rect {
@@ -739,7 +739,6 @@ impl App {
needs_redraw,
delayed_frames: [
feedback_tick,
blossom_tick,
(animating || loading).then_some(Duration::from_millis(50)),
],
}
@@ -857,14 +856,6 @@ impl App {
if !tui.is_owned_screen() || self.overlay.is_some() {
return Ok(false);
}
if matches!(event, TuiEvent::FocusLost) {
self.chat_widget
.empty_state_animation
.borrow_mut()
.cancel_replay();
// Show the static, faded decoration immediately when the terminal loses focus.
tui.frame_requester().schedule_frame();
}
if self.transcript_view.history == TranscriptHistoryState::Idle {
self.transcript_view.history = if self.scrollback_has_older_history {
TranscriptHistoryState::Partial
@@ -913,16 +904,6 @@ impl App {
return Ok(true);
}
}
if self.chat_widget.no_modal_or_popup_active()
&& self
.chat_widget
.empty_state_animation
.borrow_mut()
.handle_mouse(*mouse)
{
tui.frame_requester().schedule_frame();
return Ok(true);
}
if composer_ready
&& self.handle_composer_copy_event(tui, event, |tui, text| {
tui.copy_transcript_selection(

View File

@@ -4,8 +4,10 @@ expression: "format!(\"enabled:\\n{}\\n---\\ndisabled:\\n{}\", text(after), text
---
enabled:
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ GPT-5.6-Sol
██▄▄██▄▄██ /tmp/project
██▀████▀██
@@ -16,23 +18,21 @@ enabled:
⣀⣤⣤⣤⣀⣀
⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣦⣤⣤⣤⣤⣤⣤⡀
⢀⣾⣿⣿⠿⠋⠉⠉⢉⣭⣿⣿⣿⣿⣿⠿⣿⣿⣿⣿⣷⣄
⣀⣾⣿⣿⠃ ⣀⣴⣾⣿⣿⡿⠟⠋ ⣀⡀ ⠈⠙⢿⣿⣿⣧
⣀⣶⣿⣿⣿⣿⡇ ⢸⣿⣿⡿⠛⠉⢀⣠⣴⣿⣿⣿⣷⣦⣀⠈⢻⣿⣿⡇
⣰⣿⣿⡿⢿⣿⣿⡇ ⢸⣿⣿⢀⣤⣶⣿⣿⣿⠟⠛⠻⣿⣿⣿⣿⣮⣿⣿⡷
⢰⣿⣿⡟⠁⢸⣿⣿⡇ ⢸⣿⣿⣿⣿⠿⠿⣿⣿⣿⣦⣄⡀⠈⠛⠿⣿⣿⣿⣧⡀
⣾⣿⣿⠃ ⢸⣿⣿⡇ ⢸⣿⣿⠋⠁ ⠈⠙⢻⣿⣿⣿⣶⣤⡀ ⠹⢿⣿⣷⡄
⢸⣿⣿⣇ ⠸⣿⣿⣷⣦⣼⣿⣿ ⢸⣿⣿⠻⢿⣿⣿⡇ ⠘⣿⣿⣿
⠈⢿⣿⣿⣦⡀⠈⠛⠿⣿⣿⣿⣿⣄⡀ ⢀⣠⣼⣿⣿ ⣿⣿⡇ ⣿⣿⣿⠇
⢻⣿⣿⣿⣷⣦⣀⠈⠙⠻⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿ ⣿⣿⡇ ⣠⣿⣿⣿
⢸⣿⣿⡿⢿⣿⣿⣿⣦⣠⣴⣿⣿⣿⡿⠟⠋⢸⣿⣿ ⣿⣿⣷⣴⣿⣿⣿⠃
⠘⣿⣿⣷ ⠈⠛⢿⣿⣿⣿⠿⠋⠉ ⣠⣴⣿⣿⣿ ⣿⣿⣿⣿⣿⠟⠁
⠻⣿⣿⣿⣤⣀ ⠈⠉ ⢀⣤⣶⣿⣿⣿⠿⠟⠁ ⣰⣿⣿⡟⠋⠁
⠈⠿⣿⣿⣿⣿⣶⣾⣿⣿⣿⣿⠟⠋⠁ ⣠⣼⣿⣿⡟
⠙⠛⠛⠛⠻⠛⢿⣿⣿⣿⣿⣷⣾⣿⣿⣿⡿⠏
⠈⠙⠛⠿⠿⠿⠿⠛⠉
█████╗ ██╗ ██╗ ██████╗ ██████╗ ███████╗
▄▄████▄▄ ██╔══██╗██║ ██╔╝██╔═══██╗██╔══██╗██╔════╝
██▀▀██▀▀██ ███████║█████╔╝ ██║ ██║██║ ██║█████╗
██▄▄██▄▄██ ██╔══██║██╔═██╗ ██║ ██║██║ ██║██╔══╝
██▀████▀██ ██║ ██║██║ ██╗╚██████╔╝██████╔╝███████╗
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
Benvenuto in aKode · il tuo agente di coding locale
@@ -50,10 +50,10 @@ enabled:
---
disabled:
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ GPT-5.6-Sol
██▄▄██▄▄██ /tmp/project
██▀████▀██

View File

@@ -3,8 +3,10 @@ source: tui/src/app/tests.rs
expression: rendered
---
>_ aKode (v0.10.0-pulito)
<thread cwd>
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ gpt-test · mock
██▄▄██▄▄██ /tmp/next
██▀████▀██
› Next thread prompt

View File

@@ -3,8 +3,10 @@ source: tui/src/app/tests/realtime_requests.rs
expression: "normalize_voice_snapshot_directory(&rendered, &app.config.cwd)"
---
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ gpt-test · mock
██▄▄██▄▄██ /tmp/project
██▀████▀██
To get started, describe a task or try one of these commands:

View File

@@ -3,8 +3,10 @@ source: tui/src/app/tests/realtime_requests.rs
expression: "normalize_voice_snapshot_directory(&rendered, &app.config.cwd)"
---
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ gpt-test · mock
██▄▄██▄▄██ /tmp/project
██▀████▀██
To get started, describe a task or try one of these commands:

View File

@@ -14,8 +14,10 @@ Restored owner:
gpt-test default · /tmp/project
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ gpt-test · mock
██▄▄██▄▄██ /tmp/project
██▀████▀██
To get started, describe a task or try one of these commands:

View File

@@ -3,8 +3,10 @@ source: tui/src/app/tests/realtime_requests.rs
expression: "normalize_voice_snapshot_directory(&rendered, &app.config.cwd)"
---
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ gpt-test · mock
██▄▄██▄▄██ /tmp/project
██▀████▀██
To get started, describe a task or try one of these commands:

View File

@@ -2,8 +2,10 @@
source: tui/src/app/tests/new_session_tests.rs
expression: "normalize_snapshot_paths(render_bottom_popup(&app.chat_widget, 80))"
---
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ loading
██▄▄██▄▄██ /tmp/project
██▀████▀██
› status [Skill]

View File

@@ -4,8 +4,10 @@ expression: "normalize_snapshot_paths(normalize_agent_center_snapshot(snapshots.
---
80 columns
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ gpt-test · mock
██▄▄██▄▄██ /tmp/project
██▀████▀██
• Conversation continues here.
@@ -17,8 +19,6 @@ expression: "normalize_snapshot_paths(normalize_agent_center_snapshot(snapshots.
› Ask aKode to do anything
GPT-5.6-Sol default · /tmp/project
@@ -26,8 +26,10 @@ expression: "normalize_snapshot_paths(normalize_agent_center_snapshot(snapshots.
32 columns
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-p…
██▀▀██▀▀██ gpt-test · mock
██▄▄██▄▄██ /tmp/project
██▀████▀██
• Conversation continues here.
@@ -39,8 +41,6 @@ expression: "normalize_snapshot_paths(normalize_agent_center_snapshot(snapshots.
› Ask aKode to do anything
GPT-5.6-Sol default · /tmp/pr…

View File

@@ -0,0 +1,139 @@
//! aKode visual identity: the ghost avatar and the welcome banner.
//!
//! The ghost shape is derived from open-bot-avatar by Dominik Scholz
//! (`gallery/ghost.json`, MIT License); see the repository NOTICE file.
use ratatui::style::Style;
use ratatui::style::Stylize;
use ratatui::text::Line;
use ratatui::text::Span;
use crate::style::accent_color;
use crate::width::display_width;
/// Product name shown to users.
pub(crate) const PRODUCT_NAME: &str = "aKode";
/// Italian welcome line shown under the splash banner.
pub(crate) const WELCOME_LINE: &str = "Benvenuto in aKode · il tuo agente di coding locale";
/// The ghost avatar, four rows of equal display width.
pub(crate) const GHOST: [&str; 4] = [" ▄▄████▄▄ ", "██▀▀██▀▀██", "██▄▄██▄▄██", "██▀████▀██"];
pub(crate) const GHOST_WIDTH: usize = 10;
/// "AKODE" in the figlet "ANSI Shadow" font, rows padded to equal display width.
const BANNER: [&str; 6] = [
" █████╗ ██╗ ██╗ ██████╗ ██████╗ ███████╗",
"██╔══██╗██║ ██╔╝██╔═══██╗██╔══██╗██╔════╝",
"███████║█████╔╝ ██║ ██║██║ ██║█████╗ ",
"██╔══██║██╔═██╗ ██║ ██║██║ ██║██╔══╝ ",
"██║ ██║██║ ██╗╚██████╔╝██████╔╝███████╗",
"╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝",
];
const BANNER_WIDTH: usize = 41;
/// Space between the ghost and whatever sits to its right.
pub(crate) const GHOST_GAP: usize = 4;
fn accent() -> Style {
Style::default().fg(accent_color())
}
/// One ghost row styled with the theme accent.
pub(crate) fn ghost_span(row: usize) -> Span<'static> {
Span::styled(GHOST[row], accent())
}
/// Splash lines chosen to fit `width` without wrapping: ghost + ANSI Shadow banner, then
/// (with `compact`) ghost + plain name, then the welcome line alone, then just the name.
/// Without `compact` (a session header already shows the ghost) narrow widths get only the
/// welcome line, or nothing. Every returned line has the same display width so callers can
/// center the block.
pub(crate) fn splash_lines(width: usize, compact: bool) -> Vec<Line<'static>> {
let welcome_width = display_width(WELCOME_LINE);
let version = format!("v{}", crate::version::AKODE_CLI_VERSION);
let compact_width = GHOST_WIDTH + GHOST_GAP + PRODUCT_NAME.len().max(version.len());
let mut lines: Vec<Line<'static>> = Vec::new();
if width >= (GHOST_WIDTH + GHOST_GAP + BANNER_WIDTH).max(welcome_width) {
// Center the four ghost rows against the six banner rows.
for (row, banner) in BANNER.iter().enumerate() {
let ghost = match row {
1..=4 => ghost_span(row - 1),
_ => Span::from(" ".repeat(GHOST_WIDTH)),
};
lines.push(Line::from(vec![
ghost,
" ".repeat(GHOST_GAP).into(),
Span::styled(*banner, accent()),
]));
}
} else if compact && width >= compact_width {
for row in 0..GHOST.len() {
let mut spans = vec![ghost_span(row)];
match row {
1 => {
spans.push(" ".repeat(GHOST_GAP).into());
spans.push(Span::styled(PRODUCT_NAME, accent()).bold());
}
2 => {
spans.push(" ".repeat(GHOST_GAP).into());
spans.push(Span::from(version.clone()).dim());
}
_ => {}
}
lines.push(Line::from(spans));
}
}
if width >= welcome_width {
if !lines.is_empty() {
lines.push(Line::default());
}
lines.push(Line::from(WELCOME_LINE.dim()));
} else if compact && lines.is_empty() {
lines.push(Line::from(PRODUCT_NAME.bold()));
}
let block_width = lines.iter().map(Line::width).max().unwrap_or(0);
lines
.into_iter()
.map(|mut line| {
let used = line.width();
if used < block_width {
line.spans.push(" ".repeat(block_width - used).into());
}
line
})
.collect()
}
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
#[test]
fn glyph_rows_have_uniform_width() {
assert!(BANNER.iter().all(|row| display_width(row) == BANNER_WIDTH));
assert!(GHOST.iter().all(|row| display_width(row) == GHOST_WIDTH));
}
#[test]
fn splash_degrades_without_overflow() {
for width in [0usize, 5, 13, 19, 20, 40, 51, 54, 55, 80, 200] {
let lines = splash_lines(width, /*compact*/ true);
assert!(!lines.is_empty());
let widths: Vec<usize> = lines.iter().map(Line::width).collect();
assert!(
widths.iter().all(|w| *w == widths[0]),
"width {width}: {widths:?}"
);
if width >= PRODUCT_NAME.len() {
assert!(widths[0] <= width, "width {width}: {widths:?}");
}
}
assert_eq!(splash_lines(80, /*compact*/ true).len(), 8);
assert_eq!(splash_lines(40, /*compact*/ true).len(), 4);
assert_eq!(splash_lines(30, /*compact*/ true).len(), 4);
assert_eq!(splash_lines(80, /*compact*/ false).len(), 8);
assert_eq!(splash_lines(52, /*compact*/ false).len(), 1);
assert!(splash_lines(40, /*compact*/ false).is_empty());
}
}

View File

@@ -0,0 +1,2 @@
{"run_id":"1794922138-404543000","line":393,"new":{"module_name":"akode_tui__chatwidget__rendering__tests","snapshot_name":"initial_session_header_starts_at_the_top_of_the_viewport","metadata":{"source":"tui/src/chatwidget/rendering_tests.rs","assertion_line":393,"expression":"header.replace(&cwd, \"/tmp/project\")"},"snapshot":"\n ▄▄████▄▄ aKode v<VERSION>\n██▀▀██▀▀██ loading"},"old":{"module_name":"akode_tui__chatwidget__rendering__tests","metadata":{},"snapshot":">_ aKode (v<VERSION>)\n /tmp/project"}}
{"run_id":"1794922381-669152000","line":393,"new":null,"old":null}

View File

@@ -391,8 +391,9 @@ async fn initial_session_header_starts_at_the_top_of_the_viewport() {
let cwd = widget.config.cwd.as_path().display().to_string();
insta::assert_snapshot!(header.replace(&cwd, "/tmp/project"), @r"
>_ aKode (v<VERSION>)
/tmp/project
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
");
}

View File

@@ -2,6 +2,7 @@
source: tui/src/chatwidget/tests/app_server.rs
expression: rendered
---
aKode (v<VERSION>)
aKode v<VERSION>
model: GPT-5.6 Luna high
provider: mock
directory: /tmp/thread-settings

View File

@@ -2,6 +2,7 @@
source: tui/src/chatwidget/tests/app_server.rs
expression: rendered
---
aKode (v<VERSION>)
aKode v<VERSION>
model: GPT-5.6 Luna high
provider: mock
directory: /tmp/thread-settings

View File

@@ -2,6 +2,7 @@
source: tui/src/chatwidget/tests/app_server.rs
expression: rendered
---
aKode (v<VERSION>)
aKode v<VERSION>
model: us.openai.gpt-5.6-luna high
provider: mock
directory: /tmp/thread-settings

View File

@@ -343,20 +343,7 @@ async fn pending_mcp_startup_dispatches_queued_slash_commands() {
assert_matches!(rx.try_recv(), Ok(AppEvent::OpenResumePicker));
assert_no_submit_op(&mut op_rx);
let area = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 48, /*height*/ 17,
);
let mut buffer = ratatui::buffer::Buffer::empty(area);
assert!(
chat.empty_state_animation
.borrow_mut()
.render_in(
area,
&mut buffer,
crate::empty_state_animation::Presentation::Animated,
)
.is_some()
);
assert!(chat.empty_state_animation.borrow().is_eligible());
}
#[tokio::test]

View File

@@ -3,8 +3,10 @@ source: tui/src/chatwidget/tests/history_replay.rs
expression: history
---
>_ aKode (v<VERSION>)
/home/user/project
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ test-model · mock
██▄▄██▄▄██ /home/user/project
██▀████▀██
› hello from user

View File

@@ -66,7 +66,6 @@ impl super::ChatWidget {
pub(crate) fn open_warnings(&mut self, cells: &[Arc<dyn HistoryCell>]) {
*self.rendered_selection.borrow_mut() = Default::default();
self.empty_state_animation.borrow_mut().pause_clock();
let entries = self.warning_display_state.visible_entries(cells);
let daemon_restart_hint_at = self
.remote_connection

View File

@@ -1,37 +1,17 @@
//! The blossom welcome animation for onboarding, with a full-color final pose.
//! Visible time pauses while hidden. Fresh conversations start settled and can replay on a click.
//! The static aKode splash shown in the middle of a fresh, empty conversation.
//! (The module keeps its historical name until the internal rebrand.)
//! Eligibility is latched per thread; the caller decides when the composer allows it.
mod geometry;
mod lighting;
mod paths;
mod policy;
mod renderer;
mod sequence;
use std::sync::OnceLock;
use std::time::Duration;
use std::time::Instant;
use crossterm::event::MouseButton;
use crossterm::event::MouseEvent;
use crossterm::event::MouseEventKind;
use ratatui::buffer::Buffer;
use ratatui::layout::Position;
use ratatui::layout::Rect;
use ratatui::style::Color;
use ratatui::widgets::Widget;
use crate::branding;
use crate::motion::MotionMode;
use crate::terminal_palette;
use lighting::Lighting;
pub(crate) use policy::Presentation;
pub(crate) use policy::is_startup_cell;
use renderer::MAX_COLUMNS;
use renderer::MAX_ROWS;
use renderer::Renderer;
pub(crate) const FRAME_INTERVAL: Duration = Duration::from_millis(/*millis*/ 50);
// The preview's first visible pose (10.8s / 7.2s), also the start of an idle-screen replay.
const SETTLED_BLOSSOM: f64 = 0.5;
#[derive(Clone, Copy, PartialEq, Eq)]
pub(crate) enum ComposerState {
@@ -42,15 +22,6 @@ pub(crate) enum ComposerState {
#[derive(Default)]
pub(crate) struct EmptyStateAnimation {
eligible: bool,
spin_elapsed: Duration,
last_frame: Option<Instant>,
fade_elapsed: Duration,
static_mark: Option<bool>,
opacity: f32,
fade_from: f32,
renderer: Option<Renderer>,
stage: Option<Rect>,
replaying: bool,
}
impl EmptyStateAnimation {
@@ -59,16 +30,10 @@ impl EmptyStateAnimation {
}
pub(crate) fn start_fresh(&mut self) {
self.cancel_replay();
self.eligible = true;
self.spin_elapsed = Duration::ZERO;
self.last_frame = None;
self.fade_elapsed = Duration::ZERO;
self.static_mark = None;
self.opacity = 1.0;
}
/// Keep the provisional pose when handing off to the live thread.
/// Keep eligibility when handing off from the startup draft to the live thread.
pub(crate) fn continue_from(&mut self, source: &mut Self) {
let mut previous = std::mem::take(source);
if !previous.is_eligible() {
@@ -79,136 +44,33 @@ impl EmptyStateAnimation {
pub(crate) fn dismiss(&mut self) {
self.eligible = false;
self.cancel_replay();
}
pub(crate) fn cancel_replay(&mut self) {
self.stage = None;
self.replaying = false;
self.pause_clock();
}
/// Replay only on the drawn blossom; unrelated gestures keep their normal owner.
pub(crate) fn handle_mouse(&mut self, mouse: MouseEvent) -> bool {
let inside = self
.stage
.is_some_and(|stage| stage.contains(Position::new(mouse.column, mouse.row)))
&& mouse.modifiers.is_empty();
match mouse.kind {
MouseEventKind::Down(MouseButton::Left) if inside => {
self.start_fresh();
self.spin_elapsed =
Duration::from_secs_f64(SETTLED_BLOSSOM * sequence::LOOP_SECONDS);
self.opacity = sequence::STATIC_OPACITY;
self.static_mark = Some(true);
self.replaying = true;
true
}
_ => false,
}
}
/// Stop visible time at the last painted frame, including when no hidden frame was drawn.
/// Resume (after process suspension) may call this after the interruption; phase is retained.
pub(crate) fn pause_clock(&mut self) {
self.last_frame = None;
}
/// Paint the shared logo sequence inside a caller-owned, reserved rectangle.
/// The caller clears the stage and keeps its layout stable after motion finishes.
pub(crate) fn render_in(
&mut self,
area: Rect,
buffer: &mut Buffer,
presentation: Presentation,
) -> Option<Duration> {
let now = Instant::now();
self.render_in_at(area, buffer, presentation, now)
}
fn render_in_at(
&mut self,
area: Rect,
buffer: &mut Buffer,
presentation: Presentation,
now: Instant,
) -> Option<Duration> {
if !self.eligible
|| presentation == Presentation::Hidden
|| area.is_empty()
|| area.width > MAX_COLUMNS
|| area.height > MAX_ROWS
|| area.intersection(buffer.area) != area
{
self.pause_clock();
return None;
}
let static_mark = presentation == Presentation::Faded;
let previous_frame = self.last_frame.replace(now);
if self.static_mark != Some(static_mark) {
self.fade_elapsed = if self.static_mark.is_none() {
sequence::STATIC_FADE
} else {
Duration::ZERO
};
self.fade_from = self.opacity;
} else if let Some(previous) = previous_frame {
let elapsed = now.saturating_duration_since(previous);
self.fade_elapsed += elapsed;
if !static_mark {
self.spin_elapsed += elapsed;
}
}
self.static_mark = Some(static_mark);
let finished = self.spin_elapsed >= sequence::SPIN_DURATION;
let phase =
self.spin_elapsed.min(sequence::SPIN_DURATION).as_secs_f64() / sequence::LOOP_SECONDS;
let settling = !finished && static_mark && self.fade_elapsed < sequence::STATIC_FADE;
self.opacity = if finished && self.replaying {
sequence::static_opacity(
self.spin_elapsed - sequence::SPIN_DURATION,
/*from*/ 1.0,
)
} else if finished {
1.0
} else if static_mark {
sequence::static_opacity(self.fade_elapsed, self.fade_from)
} else {
1.0
};
if !static_mark && !finished {
self.opacity = self.fade_from
+ (self.opacity - self.fade_from)
* sequence::progress(self.fade_elapsed, sequence::STATIC_FADE) as f32;
}
self.paint_frame(area, buffer, phase, self.opacity);
((!finished && (!static_mark || settling))
|| (self.replaying
&& self.spin_elapsed < sequence::SPIN_DURATION + sequence::STATIC_FADE))
.then_some(FRAME_INTERVAL)
}
/// Draw only in space the caller has cleared and owns. The centered blossom returns
/// on clear, without restarting or scheduling animation.
/// Draw only in space the caller has cleared and owns. The splash is centered on
/// `screen` and hidden, rather than shrunk or clipped, when it does not fit `available`.
pub(crate) fn render_first_screen(
&mut self,
&self,
screen: Rect,
available: Rect,
buffer: &mut Buffer,
composer: Option<ComposerState>,
motion: MotionMode,
) -> Option<Duration> {
const STAGE_ROWS: u16 = 21;
const MIN_STAGE_ROWS: u16 = 14;
let width = screen.width.saturating_sub(/*rhs*/ 4).min(MAX_COLUMNS);
let height = width * STAGE_ROWS / MAX_COLUMNS;
if motion == MotionMode::Reduced
|| composer != Some(ComposerState::Empty)
|| height < MIN_STAGE_ROWS
|| height > screen.height
) {
if !self.eligible || motion == MotionMode::Reduced || composer != Some(ComposerState::Empty)
{
self.cancel_replay();
return None;
return;
}
// The session header already shows the ghost, so narrow screens get only the welcome line.
let lines = branding::splash_lines(
usize::from(screen.width.saturating_sub(/*rhs*/ 4)),
/*compact*/ false,
);
let width = lines
.first()
.map_or(0, |line| u16::try_from(line.width()).unwrap_or(u16::MAX));
let height = u16::try_from(lines.len()).unwrap_or(u16::MAX);
if width == 0 || width > screen.width || height > screen.height {
return;
}
let stage = Rect::new(
screen.x + (screen.width - width) / 2,
@@ -216,73 +78,12 @@ impl EmptyStateAnimation {
width,
height,
);
if stage.intersection(available) != stage {
self.cancel_replay();
return None;
if stage.intersection(available) != stage || stage.intersection(buffer.area) != stage {
return;
}
self.stage = Some(stage);
if self.replaying {
if let Some(delay) = self.render_in(stage, buffer, Presentation::Animated) {
return Some(delay);
}
// The replay has faded back to the idle pose and no longer needs redraws.
self.replaying = false;
}
self.paint_frame(stage, buffer, SETTLED_BLOSSOM, sequence::STATIC_OPACITY);
None
}
fn paint_frame(&mut self, area: Rect, buffer: &mut Buffer, phase: f64, opacity: f32) {
let background = terminal_palette::default_bg();
let color_level = if background.is_some() {
terminal_palette::effective_stdout_color_level()
} else {
terminal_palette::StdoutColorLevel::Unknown
};
let background = background.unwrap_or((15, 20, 37));
let light = Lighting::terminal(
terminal_palette::default_fg().unwrap_or((210, 221, 235)),
background,
);
let cells = self.renderer.get_or_insert_with(Renderer::default).frame(
area.width,
area.height,
phase,
&light,
);
for (i, cell) in cells.iter().enumerate().filter(|(_, cell)| cell.dots != 0) {
let [_, r, g, b] = cell.rgb.to_be_bytes();
let target = &mut buffer[(
area.x + i as u16 % area.width,
area.y + i as u16 / area.width,
)];
target.set_char(char::from_u32(0x2800 + u32::from(cell.dots)).unwrap_or(' '));
let color = crate::color::blend((r, g, b), background, opacity);
let color = if color_level == terminal_palette::StdoutColorLevel::Ansi256 {
// Four bits per channel bound the cache and avoid palette searches each frame.
static COLORS: [OnceLock<Color>; 4096] = [const { OnceLock::new() }; 4096];
let (r, g, b) = (color.0 >> 4, color.1 >> 4, color.2 >> 4);
let index = usize::from(r) * 256 + usize::from(g) * 16 + usize::from(b);
*COLORS[index].get_or_init(|| {
terminal_palette::best_color_for_level(
(r * 16 + 8, g * 16 + 8, b * 16 + 8),
color_level,
)
})
} else {
terminal_palette::best_color_for_level(color, color_level)
};
target.set_fg(color);
// Default-color terminals can only step between normal and dim intensity.
if opacity < 0.5
&& matches!(
color_level,
terminal_palette::StdoutColorLevel::Ansi16
| terminal_palette::StdoutColorLevel::Unknown
)
{
target.set_style(target.style().dim());
}
for (row, line) in lines.into_iter().enumerate() {
let row = u16::try_from(row).unwrap_or(u16::MAX);
line.render(Rect::new(stage.x, stage.y + row, width, 1), buffer);
}
}
}

View File

@@ -1,149 +0,0 @@
//! Cached signed distance fields of the original vector marks, preserving their cutouts.
use std::sync::LazyLock;
use super::paths;
pub(super) const GRID: usize = 160;
pub(super) const EXTENT: f64 = 1.08;
pub(super) const STEP: f64 = EXTENT * 2.0 / (GRID - 1) as f64;
pub(super) static FIELDS: LazyLock<[Vec<f32>; 2]> =
LazyLock::new(|| [field(paths::CODEX), field(paths::OPENAI)]);
struct Path<'a> {
remaining: &'a str,
}
impl Path<'_> {
#[expect(
clippy::expect_used,
reason = "coordinates come only from the embedded, reference-tested SVG paths"
)]
fn number(&mut self) -> f64 {
self.remaining = self.remaining.trim_start();
let end = self.remaining[1..]
.find(|c: char| !c.is_ascii_digit() && c != '.')
.map_or(self.remaining.len(), |i| i + 1);
let (number, remaining) = self.remaining.split_at(end);
self.remaining = remaining;
number.parse().expect("embedded logo coordinate")
}
fn point(&mut self) -> [f64; 2] {
[self.number(), self.number()]
}
}
fn field((path, bounds): (&str, [f64; 4])) -> Vec<f32> {
let mut path = Path { remaining: path };
let mut point = [0.0; 2];
let mut start = point;
let mut segments = Vec::new();
while let Some(command) = path.remaining.chars().next() {
path.remaining = &path.remaining[1..];
let next = match command {
'M' => {
point = path.point();
start = point;
continue;
}
'L' => path.point(),
'H' => [path.number(), point[1]],
'V' => [point[0], path.number()],
'Z' => start,
'C' => {
let origin = point;
let a = path.point();
let b = path.point();
let end = path.point();
for step in 1..=12 {
let t = f64::from(step) / 12.0;
let u = 1.0 - t;
let next = std::array::from_fn(|i| {
u.powi(/*n*/ 3) * origin[i]
+ 3.0 * u * u * t * a[i]
+ 3.0 * u * t * t * b[i]
+ t.powi(/*n*/ 3) * end[i]
});
segments.push((point, next));
point = next;
}
continue;
}
_ => unreachable!("embedded paths contain only M/L/H/V/C/Z"),
};
segments.push((point, next));
point = next;
}
let scale = (bounds[2] - bounds[0]).max(bounds[3] - bounds[1]) / 2.0;
for (a, b) in &mut segments {
for axis in 0..2 {
let center = (bounds[axis] + bounds[axis + 2]) / 2.0;
a[axis] = (a[axis] - center) / scale;
b[axis] = (b[axis] - center) / scale;
}
}
let mut inside = vec![false; GRID * GRID];
for row in 0..GRID {
let y = row as f64 * STEP - EXTENT;
let mut crossings = segments
.iter()
.filter(|&(a, b)| (a[1] <= y && b[1] > y) || (b[1] <= y && a[1] > y))
.map(|(a, b)| {
(
a[0] + (y - a[1]) / (b[1] - a[1]) * (b[0] - a[0]),
if b[1] > a[1] { 1 } else { -1 },
)
})
.collect::<Vec<_>>();
crossings.sort_by(|a, b| a.0.total_cmp(&b.0));
let (mut cursor, mut winding) = (0, 0);
for column in 0..GRID {
let x = column as f64 * STEP - EXTENT;
while cursor < crossings.len() && crossings[cursor].0 <= x {
winding += crossings[cursor].1;
cursor += 1;
}
inside[row * GRID + column] = winding != 0;
}
}
let mut distance = vec![GRID as f32; GRID * GRID];
for row in 1..GRID - 1 {
for column in 1..GRID - 1 {
let i = row * GRID + column;
if [i - 1, i + 1, i - GRID, i + GRID]
.into_iter()
.any(|j| inside[i] != inside[j])
{
distance[i] = 0.5;
}
}
}
for reverse in [false, true] {
for row in 1..GRID - 1 {
for column in 1..GRID - 1 {
let i = if reverse {
(GRID - 1 - row) * GRID + GRID - 1 - column
} else {
row * GRID + column
};
let neighbors = if reverse {
[i + 1, i + GRID, i + GRID - 1, i + GRID + 1]
} else {
[i - 1, i - GRID, i - GRID - 1, i - GRID + 1]
};
let value = neighbors
.into_iter()
.zip([1.0, 1.0, std::f64::consts::SQRT_2, std::f64::consts::SQRT_2])
.fold(f64::from(distance[i]), |d, (j, step)| {
d.min(f64::from(distance[j]) + step)
});
distance[i] = value as f32;
}
}
}
for (i, distance) in distance.iter_mut().enumerate() {
*distance = (f64::from(*distance) * STEP * if inside[i] { 1.0 } else { -1.0 }) as f32;
}
distance
}

View File

@@ -1,64 +0,0 @@
//! Fixed studio lighting, adapted to the terminal's foreground and background.
use crate::color::is_light;
pub(super) struct Lighting {
pub(super) background: [f64; 3],
pub(super) key: [f64; 3],
pub(super) shadow: [f64; 3],
pub(super) fill: [f64; 3],
pub(super) rim: [f64; 3],
pub(super) highlight: [f64; 3],
}
impl Lighting {
pub(super) fn terminal(fg: (u8, u8, u8), bg: (u8, u8, u8)) -> Self {
let background = [bg.0.into(), bg.1.into(), bg.2.into()];
if is_light(bg) {
let key = [fg.0.into(), fg.1.into(), fg.2.into()];
Self {
background,
key,
shadow: std::array::from_fn(|i| background[i] * 0.65 + key[i] * 0.35),
fill: key,
rim: key,
highlight: key,
}
} else {
Self {
background,
key: [210.0, 221.0, 235.0],
shadow: [52.0, 71.0, 105.0],
fill: [76.0, 118.0, 159.0],
rim: [91.0, 196.0, 216.0],
highlight: [255.0, 244.0, 218.0],
}
}
}
pub(super) fn shade(&self, [nx, ny, nz]: [f64; 3], depth: f64, grain: f64) -> u32 {
let diffuse = (nx * -0.410 + ny * -0.564 + nz * 0.718 + grain)
.clamp(/*min*/ 0.0, /*max*/ 1.0);
let bounce = (nx * 0.55 + ny * 0.2 - nz * 0.35).clamp(/*min*/ 0.0, /*max*/ 1.0)
* (1.0 - diffuse)
* 0.38;
let edge = (1.0 - nz.clamp(/*min*/ -1.0, /*max*/ 1.0).abs()).powf(/*n*/ 2.4)
* (nx * 0.85 - ny * 0.38).clamp(/*min*/ 0.0, /*max*/ 1.0)
* 0.82;
let gloss = (nx * -0.220 + ny * -0.302 + nz * 0.928)
.clamp(/*min*/ 0.0, /*max*/ 1.0)
.powi(/*n*/ 18)
* 0.96;
let base = (1.0 - bounce) * (1.0 - edge) * (1.0 - gloss);
let gain = (0.90 + depth * 0.18).clamp(/*min*/ 0.68, /*max*/ 1.0);
let rgb: [u8; 3] = std::array::from_fn(|i| {
let value = self.shadow[i] * (1.0 - diffuse) * base
+ self.key[i] * diffuse * base
+ self.fill[i] * bounce * (1.0 - edge) * (1.0 - gloss)
+ self.rim[i] * edge * (1.0 - gloss)
+ self.highlight[i] * gloss;
(self.background[i] + (value - self.background[i]) * gain).round() as u8
});
u32::from_be_bytes([0, rgb[0], rgb[1], rgb[2]])
}
}

View File

@@ -1,10 +0,0 @@
//! OpenAI and Codex mark geometry for the logo morph.
pub(super) const CODEX: (&str, [f64; 4]) = (
"M16.585 10C16.585 6.3632 13.6368 3.41504 10 3.41504C6.3632 3.41504 3.41504 6.3632 3.41504 10C3.41504 13.6368 6.3632 16.585 10 16.585C13.6368 16.585 16.585 13.6368 16.585 10ZM13.333 11.418L13.4678 11.4316C13.7705 11.4938 13.9979 11.7619 13.998 12.083C13.998 12.4042 13.7706 12.6722 13.4678 12.7344L13.333 12.748H10.833C10.4659 12.7479 10.168 12.4502 10.168 12.083C10.1681 11.716 10.466 11.4181 10.833 11.418H13.333ZM7.65332 12.4258C7.46427 12.7404 7.05603 12.8422 6.74121 12.6533C6.42642 12.4644 6.32391 12.0561 6.5127 11.7412L7.65332 12.4258ZM8.90332 9.6582C9.02956 9.86872 9.02956 10.1313 8.90332 10.3418L7.65332 12.4258L7.08301 12.083L6.5127 11.7412L7.55664 10L6.5127 8.25879L7.08301 7.91699L7.65332 7.57422L8.90332 9.6582ZM6.74121 7.34668C7.05603 7.15779 7.46427 7.25955 7.65332 7.57422L6.5127 8.25879C6.32391 7.94392 6.42642 7.53563 6.74121 7.34668ZM17.915 10C17.915 14.3713 14.3713 17.915 10 17.915C5.62867 17.915 2.08496 14.3713 2.08496 10C2.08496 5.62867 5.62867 2.08496 10 2.08496C14.3713 2.08496 17.915 5.62867 17.915 10Z",
[2.08496, 2.08496, 17.915, 17.915],
);
pub(super) const OPENAI: (&str, [f64; 4]) = (
"M11.6475 18.3409C11.0975 18.3409 10.575 18.2364 10.08 18.0274C9.58502 17.8184 9.14502 17.5269 8.76002 17.1529C8.34202 17.2959 7.90751 17.3674 7.45651 17.3674C6.71951 17.3674 6.03751 17.1859 5.41051 16.8229C4.78351 16.4599 4.27751 15.9649 3.89251 15.3379C3.51851 14.7109 3.33151 14.0124 3.33151 13.2424C3.33151 12.9234 3.37551 12.5769 3.46351 12.2029C3.02351 11.7959 2.68251 11.3284 2.44051 10.8004C2.19851 10.2614 2.07751 9.70044 2.07751 9.11744C2.07751 8.52344 2.20401 7.95144 2.45701 7.40144C2.71001 6.85144 3.06201 6.37844 3.51301 5.98244C3.97501 5.57544 4.50851 5.29494 5.11351 5.14094C5.23451 4.51394 5.48751 3.95294 5.87251 3.45794C6.26851 2.95194 6.75252 2.55594 7.32452 2.26994C7.89652 1.98394 8.50702 1.84094 9.15602 1.84094C9.70602 1.84094 10.2285 1.94544 10.7235 2.15444C11.2185 2.36344 11.6585 2.65494 12.0435 3.02894C12.4615 2.88594 12.896 2.81444 13.347 2.81444C14.084 2.81444 14.766 2.99594 15.393 3.35894C16.02 3.72194 16.5205 4.21694 16.8945 4.84394C17.2795 5.47094 17.472 6.16944 17.472 6.93944C17.472 7.25844 17.428 7.60494 17.34 7.97894C17.78 8.38594 18.121 8.85894 18.363 9.39794C18.605 9.92594 18.726 10.4814 18.726 11.0644C18.726 11.6584 18.5995 12.2304 18.3465 12.7804C18.0935 13.3304 17.736 13.8089 17.274 14.2159C16.823 14.6119 16.295 14.8869 15.69 15.0409C15.569 15.6679 15.3105 16.2289 14.9145 16.7239C14.5295 17.2299 14.051 17.6259 13.479 17.9119C12.907 18.1979 12.2965 18.3409 11.6475 18.3409ZM7.57201 16.2784C8.12201 16.2784 8.60051 16.1629 9.00751 15.9319L12.1095 14.1499C12.2195 14.0729 12.2745 13.9684 12.2745 13.8364V12.4174L8.28152 14.7109C8.03952 14.8539 7.79751 14.8539 7.55552 14.7109L4.43701 12.9124C4.43701 12.9454 4.43151 12.9839 4.42051 13.0279C4.42051 13.0719 4.42051 13.1379 4.42051 13.2259C4.42051 13.7869 4.55252 14.3039 4.81651 14.7769C5.09152 15.2389 5.47101 15.6019 5.95501 15.8659C6.43901 16.1409 6.97801 16.2784 7.57201 16.2784ZM7.73701 13.5889C7.80301 13.6219 7.86351 13.6384 7.91851 13.6384C7.97351 13.6384 8.02852 13.6219 8.08352 13.5889L9.32101 12.8794L5.34451 10.5694C5.10251 10.4264 4.98151 10.2119 4.98151 9.92594V6.34544C4.43151 6.58744 3.99151 6.96144 3.66151 7.46744C3.33151 7.96244 3.16651 8.51244 3.16651 9.11744C3.16651 9.65644 3.30401 10.1734 3.57901 10.6684C3.85401 11.1634 4.21151 11.5374 4.65151 11.7904L7.73701 13.5889ZM11.6475 17.2519C12.2305 17.2519 12.7585 17.1199 13.2315 16.8559C13.7045 16.5919 14.0785 16.2289 14.3535 15.7669C14.6285 15.3049 14.766 14.7879 14.766 14.2159V10.6519C14.766 10.5199 14.711 10.4209 14.601 10.3549L13.347 9.62894V14.2324C13.347 14.5184 13.226 14.7329 12.984 14.8759L9.86551 16.6744C10.4045 17.0594 10.9985 17.2519 11.6475 17.2519ZM12.2745 11.2129V8.96894L10.41 7.91294L8.52902 8.96894V11.2129L10.41 12.2689L12.2745 11.2129ZM7.45651 5.94944C7.45651 5.66344 7.57752 5.44894 7.81952 5.30594L10.938 3.50744C10.399 3.12244 9.80502 2.92994 9.15602 2.92994C8.57302 2.92994 8.04501 3.06194 7.57201 3.32594C7.09902 3.58994 6.72502 3.95294 6.45002 4.41494C6.18602 4.87694 6.05401 5.39394 6.05401 5.96594V9.51344C6.05401 9.64544 6.10901 9.74994 6.21902 9.82694L7.45651 10.5529V5.94944ZM15.8385 13.8364C16.3885 13.5944 16.823 13.2204 17.142 12.7144C17.472 12.2084 17.637 11.6584 17.637 11.0644C17.637 10.5254 17.4995 10.0084 17.2245 9.51344C16.9495 9.01844 16.592 8.64444 16.152 8.39144L13.0665 6.60944C13.0005 6.56544 12.94 6.54894 12.885 6.55994C12.83 6.55994 12.775 6.57644 12.72 6.60944L11.4825 7.30244L15.4755 9.62894C15.5965 9.69494 15.6845 9.78294 15.7395 9.89294C15.8055 9.99194 15.8385 10.1129 15.8385 10.2559V13.8364ZM12.522 5.45444C12.764 5.30044 13.006 5.30044 13.248 5.45444L16.383 7.28594C16.383 7.20894 16.383 7.10994 16.383 6.98894C16.383 6.46094 16.251 5.96044 15.987 5.48744C15.734 5.00344 15.3655 4.61844 14.8815 4.33244C14.4085 4.04644 13.8585 3.90344 13.2315 3.90344C12.6815 3.90344 12.203 4.01894 11.796 4.24994L8.69402 6.03194C8.58402 6.10894 8.52902 6.21344 8.52902 6.34544V7.76444L12.522 5.45444Z",
[2.07751, 1.84094, 18.726, 18.3409],
);

View File

@@ -1,183 +0,0 @@
//! Deterministic surface projection and Braille rasterization of the Codex logo morph.
//!
//! Fields and depth use Float32 sampling; all other math uses Float64.
use std::f64::consts::TAU;
use super::geometry::EXTENT;
use super::geometry::FIELDS;
use super::geometry::GRID;
use super::geometry::STEP;
use super::lighting::Lighting;
pub(super) const MAX_COLUMNS: u16 = 60;
pub(super) const MAX_ROWS: u16 = 24;
const DOT_BITS: [u8; 8] = [1, 8, 2, 16, 4, 32, 64, 128];
// First three mulberry32 samples with the reference's seed 3371.
const HALF_DEPTH: f64 = 0.1642880353482906;
const WOBBLE: f64 = 0.11242630996974184;
const GRAIN_PHASE: f64 = 3.8990964158506114;
fn smooth(value: f64) -> f64 {
let t = value.clamp(/*min*/ 0.0, /*max*/ 1.0);
t * t * t * (t * (t * 6.0 - 15.0) + 10.0)
}
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub(super) struct Cell {
pub(super) dots: u8,
pub(super) rgb: u32,
}
pub(super) struct Renderer {
shape: Vec<f32>,
depth: Vec<f32>,
colors: Vec<u32>,
cells: Vec<Cell>,
}
impl Default for Renderer {
fn default() -> Self {
let samples = usize::from(MAX_COLUMNS) * usize::from(MAX_ROWS) * 8;
Self {
shape: vec![0.0; GRID * GRID],
depth: vec![f32::NEG_INFINITY; samples],
colors: vec![0; samples],
cells: vec![Cell::default(); samples / 8],
}
}
}
impl Renderer {
pub(super) fn frame(
&mut self,
columns: u16,
rows: u16,
phase: f64,
light: &Lighting,
) -> &[Cell] {
assert!(columns <= MAX_COLUMNS && rows <= MAX_ROWS);
let columns = usize::from(columns);
let rows = usize::from(rows);
let phase = phase.rem_euclid(/*rhs*/ 1.0);
let second = if phase >= 0.5 { 1.0 } else { 0.0 };
let spin = smooth((phase * 2.0 - second) / 0.82);
let morph = smooth((spin - 2.0 / 3.0) * 3.0);
let rotation = (second + spin) * TAU;
let blend = if second == 1.0 { 1.0 - morph } else { morph };
let (sx, cx) = (rotation.sin() * WOBBLE).sin_cos();
let (sy, cy) = rotation.sin_cos();
let (sz, cz) = ((phase * TAU).sin() * 0.045).sin_cos();
let bevel = 0.075 + blend * 0.012;
let dot_columns = columns * 2;
let dot_rows = rows * 4;
let dot_width = 800.0 / dot_columns as f64;
let dot_height = 550.0 / dot_rows as f64;
self.depth.fill(f32::NEG_INFINITY);
for (i, value) in self.shape.iter_mut().enumerate() {
*value =
(f64::from(FIELDS[0][i]) * (1.0 - blend) + f64::from(FIELDS[1][i]) * blend) as f32;
}
let mut project = |[x, y, mut z]: [f64; 3], [mut nx, mut ny, mut nz]: [f64; 3]| {
let u = x * 2.2 + y * 0.7;
let v = y * 2.8 - x * 0.4;
z += u.sin() * 0.075 + v.sin() * 0.04;
nx -= nz * (u.cos() * 0.165 - v.cos() * 0.016);
ny -= nz * (u.cos() * 0.0525 + v.cos() * 0.112);
let length = nx.hypot(ny).hypot(nz);
let length = if length == 0.0 { 1.0 } else { length };
nx /= length;
ny /= length;
nz /= length;
let x1 = x * cy + z * sy;
let z1 = -x * sy + z * cy;
let y2 = y * cx - z1 * sx;
let z2 = y * sx + z1 * cx;
let x3 = x1 * cz - y2 * sz;
let y3 = x1 * sz + y2 * cz;
let perspective = 4.4 / (4.4 - z2);
let column = ((400.0 + x3 * 206.0 * perspective) / dot_width).floor() as isize;
let row = ((275.0 + y3 * 206.0 * perspective) / dot_height).floor() as isize;
if column < 0 || column >= dot_columns as isize || row < 0 || row >= dot_rows as isize {
return;
}
let i = row as usize * dot_columns + column as usize;
if z2 <= f64::from(self.depth[i]) {
return;
}
let nx1 = nx * cy + nz * sy;
let nz1 = -nx * sy + nz * cy;
let ny2 = ny * cx - nz1 * sx;
let nz2 = ny * sx + nz1 * cx;
self.depth[i] = z2 as f32;
self.colors[i] = light.shade(
[nx1 * cz - ny2 * sz, nx1 * sz + ny2 * cz, nz2],
z2,
(x * 23.0 + y * 19.0 + GRAIN_PHASE).sin() * 0.01,
);
};
for row in 1..GRID - 1 {
for column in 1..GRID - 1 {
let i = row * GRID + column;
let d = f64::from(self.shape[i]);
if d < -STEP {
continue;
}
let x = column as f64 * STEP - EXTENT;
let y = row as f64 * STEP - EXTENT;
let dx = f64::from(self.shape[i + 1]) - f64::from(self.shape[i - 1]);
let dy = f64::from(self.shape[i + GRID]) - f64::from(self.shape[i - GRID]);
let length = dx.hypot(dy);
let length = if length == 0.0 { 1.0 } else { length };
let gx = dx / length;
let gy = dy / length;
if d > 0.0 {
let edge = (1.0 - d / bevel).clamp(/*min*/ 0.0, /*max*/ 1.0);
let nz = (1.0 - edge * edge).sqrt();
let z = HALF_DEPTH - bevel + bevel * nz;
project([x, y, z], [-gx * edge, -gy * edge, nz]);
project([x, y, -z], [-gx * edge, -gy * edge, -nz]);
}
if d.abs() < STEP * 0.8 {
let side_depth = HALF_DEPTH - bevel;
let layers = (side_depth * 2.0 / STEP).ceil() as usize;
for layer in 0..=layers {
project(
[
x - gx * d,
y - gy * d,
-side_depth + layer as f64 / layers as f64 * side_depth * 2.0,
],
[-gx, -gy, 0.0],
);
}
}
}
}
self.cells.fill(Cell::default());
for row in 0..rows {
for column in 0..columns {
let (mut dots, mut count, mut rgb) = (0, 0, [0; 3]);
for (point, bit) in DOT_BITS.into_iter().enumerate() {
let i = (row * 4 + point / 2) * dot_columns + column * 2 + point % 2;
if self.depth[i].is_finite() {
dots |= bit;
let channels = self.colors[i].to_be_bytes();
for channel in 0..3 {
rgb[channel] += u32::from(channels[channel + 1]);
}
count += 1;
}
}
let rgb = if count == 0 {
0
} else {
let channels = rgb.map(|value| ((value + count / 2) / count) as u8);
u32::from_be_bytes([0, channels[0], channels[1], channels[2]])
};
self.cells[row * columns + column] = Cell { dots, rgb };
}
}
&self.cells[..rows * columns]
}
}

View File

@@ -1,18 +0,0 @@
//! Timing and easing for smooth rotation and focus fades.
use std::time::Duration;
pub(super) const STATIC_FADE: Duration = Duration::from_millis(/*millis*/ 400);
pub(super) const STATIC_OPACITY: f32 = 0.18;
// The renderer performs two complete rotations per loop.
pub(super) const LOOP_SECONDS: f64 = 7.2;
pub(super) const SPIN_DURATION: Duration = Duration::from_millis(/*millis*/ 10_800);
pub(super) fn static_opacity(elapsed: Duration, from: f32) -> f32 {
STATIC_OPACITY + (from - STATIC_OPACITY) * (1.0 - progress(elapsed, STATIC_FADE)) as f32
}
pub(super) fn progress(elapsed: Duration, duration: Duration) -> f64 {
let t = (elapsed.as_secs_f64() / duration.as_secs_f64()).min(/*other*/ 1.0);
t * t * t * (t * (t * 6.0 - 15.0) + 10.0)
}

View File

@@ -1,469 +1,131 @@
//! Logo visibility, theme contrast, placement, and redraw lifecycle tests.
//! Splash placement, eligibility, and narrow-terminal fallback tests.
use super::*;
use crossterm::event::KeyModifiers;
use pretty_assertions::assert_eq;
fn draw(
splash: &EmptyStateAnimation,
screen: Rect,
available: Rect,
composer: Option<ComposerState>,
motion: MotionMode,
) -> Buffer {
let mut buffer = Buffer::empty(screen);
splash.render_first_screen(screen, available, &mut buffer, composer, motion);
buffer
}
fn rows(buffer: &Buffer) -> Vec<String> {
buffer
.content
.chunks(usize::from(buffer.area.width))
.map(|row| {
row.iter()
.map(ratatui::buffer::Cell::symbol)
.collect::<String>()
.trim_end()
.to_owned()
})
.collect()
}
fn is_blank(buffer: &Buffer) -> bool {
buffer.content.iter().all(|cell| cell.symbol() == " ")
}
#[test]
fn first_screen_stage_ignores_notices_and_hides_instead_of_shrinking() {
let mut animation = EmptyStateAnimation::default();
animation.start_fresh();
fn first_screen_splash_is_centered_and_hides_instead_of_shrinking() {
let mut splash = EmptyStateAnimation::default();
splash.start_fresh();
let screen = Rect::new(
/*x*/ 7, /*y*/ 3, /*width*/ 80, /*height*/ 44,
);
let mut buffer = Buffer::empty(screen);
for header_rows in [5, 7, 11] {
buffer.reset();
let free = Rect::new(
screen.x,
screen.y + header_rows,
screen.width,
screen.height - header_rows - 3,
);
assert_eq!(
animation.render_first_screen(
screen,
free,
&mut buffer,
Some(ComposerState::Empty),
MotionMode::Animated
),
None
);
assert_eq!(
animation.stage,
Some(Rect::new(
/*x*/ 17, /*y*/ 14, /*width*/ 60, /*height*/ 21
))
);
}
// Content which reaches the center must win; it must not move the stage down.
let free = Rect::new(screen.x, /*y*/ 20, screen.width, /*height*/ 24);
animation.render_first_screen(
screen,
free,
&mut buffer,
Some(ComposerState::Empty),
MotionMode::Animated,
);
assert_eq!(animation.stage, None);
// Both sides of the minimum size, and a terminal that is too short for the full logo.
for (width, height, expected) in [(44, 36, true), (43, 36, false), (80, 20, false)] {
let screen = Rect::new(/*x*/ 7, /*y*/ 3, width, height);
let mut buffer = Buffer::empty(screen);
animation.render_first_screen(
let buffer = draw(
&splash,
screen,
screen,
&mut buffer,
free,
Some(ComposerState::Empty),
MotionMode::Animated,
);
assert_eq!(animation.stage.is_some(), expected);
let rows = rows(&buffer);
// Eight rows (banner, spacer, welcome line) centered in 44 rows start at row 18.
assert!(rows[18].contains("█████╗"), "{rows:#?}");
assert!(rows[25].contains("Benvenuto in aKode"), "{rows:#?}");
}
}
#[test]
fn first_screen_single_click_replays_the_visible_blossom() {
let mut animation = EmptyStateAnimation::default();
animation.start_fresh();
let screen = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 80, /*height*/ 44,
);
let mut buffer = Buffer::empty(screen);
let click = MouseEvent {
kind: MouseEventKind::Down(MouseButton::Left),
column: 40,
row: 22,
modifiers: KeyModifiers::NONE,
};
let draw = |animation: &mut EmptyStateAnimation, buffer: &mut Buffer, composer| {
buffer.reset();
animation.render_first_screen(screen, screen, buffer, composer, MotionMode::Animated)
};
assert_eq!(
draw(&mut animation, &mut buffer, Some(ComposerState::Empty)),
None
);
let static_frame = buffer.clone();
for other in [
MouseEvent {
column: 0,
row: 0,
..click
},
MouseEvent {
modifiers: KeyModifiers::CONTROL,
..click
},
MouseEvent {
kind: MouseEventKind::Down(MouseButton::Right),
..click
},
] {
assert!(!animation.handle_mouse(other));
}
assert_eq!(
draw(&mut animation, &mut buffer, Some(ComposerState::Empty)),
None
);
assert_eq!(buffer, static_frame);
assert!(animation.handle_mouse(click));
// Release belongs to the transcript if it started a selection outside the logo.
assert!(!animation.handle_mouse(MouseEvent {
kind: MouseEventKind::Up(MouseButton::Left),
..click
}));
assert_eq!(
draw(&mut animation, &mut buffer, Some(ComposerState::Empty)),
Some(FRAME_INTERVAL)
);
assert_eq!(buffer, static_frame);
let started = animation.last_frame.unwrap();
let stage = animation.stage.unwrap();
buffer.reset();
assert_eq!(
animation.render_in_at(
stage,
&mut buffer,
Presentation::Animated,
started + sequence::STATIC_FADE,
),
Some(FRAME_INTERVAL)
);
assert_ne!(buffer, static_frame);
assert!(animation.handle_mouse(click));
assert_eq!(
draw(&mut animation, &mut buffer, Some(ComposerState::Empty)),
Some(FRAME_INTERVAL)
);
assert_eq!(buffer, static_frame);
let finished_at =
animation.last_frame.unwrap() + sequence::SPIN_DURATION - animation.spin_elapsed;
let mut fade_frames = Vec::new();
for elapsed in [
Duration::ZERO,
sequence::STATIC_FADE / 2,
sequence::STATIC_FADE,
] {
buffer.reset();
crate::terminal_palette::with_test_default_colors(
crate::terminal_probe::DefaultColors {
fg: (210, 221, 235),
bg: (15, 20, 37),
},
|| {
assert_eq!(
animation.render_in_at(
stage,
&mut buffer,
Presentation::Animated,
finished_at + elapsed,
),
(elapsed < sequence::STATIC_FADE).then_some(FRAME_INTERVAL)
);
},
);
let painted = buffer
.content
.iter()
.find(|cell| cell.symbol() != " ")
.unwrap();
fade_frames.push(format!(
"{}ms: {} {:?}",
elapsed.as_millis(),
painted.symbol(),
painted.fg,
));
}
insta::assert_snapshot!("first_screen_replay_fade", fade_frames.join("\n"));
assert_eq!(
draw(&mut animation, &mut buffer, Some(ComposerState::Empty)),
None
);
assert_eq!(buffer, static_frame);
assert!(!animation.replaying);
assert!(animation.handle_mouse(click));
assert_eq!(
draw(&mut animation, &mut buffer, Some(ComposerState::Draft)),
None
);
assert!(!animation.handle_mouse(click));
assert_eq!(
draw(&mut animation, &mut buffer, Some(ComposerState::Empty)),
None
);
assert_eq!(buffer, static_frame);
// Disabling motion removes both the logo and its click target.
buffer.reset();
animation.render_first_screen(
// Content which reaches the center must win; the splash must not move down.
let free = Rect::new(screen.x, /*y*/ 25, screen.width, /*height*/ 22);
assert!(is_blank(&draw(
&splash,
screen,
screen,
&mut buffer,
free,
Some(ComposerState::Empty),
MotionMode::Reduced,
);
assert_eq!(buffer, Buffer::empty(screen));
assert!(!animation.handle_mouse(click));
MotionMode::Animated,
)));
}
#[test]
fn loop_closes_and_light_themes_preserve_coverage() {
let mut renderer = Renderer::default();
let dark = Lighting::terminal(/*fg*/ (210, 221, 235), /*bg*/ (15, 20, 37));
let first = renderer
.frame(
/*columns*/ 60, /*rows*/ 21, /*phase*/ 0.0, &dark,
)
.to_vec();
assert_eq!(
renderer.frame(
/*columns*/ 60, /*rows*/ 21, /*phase*/ 1.0, &dark
),
first
fn splash_requires_eligibility_empty_composer_and_motion() {
let screen = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 80, /*height*/ 24,
);
let other_mark = renderer.frame(
/*columns*/ 60, /*rows*/ 21, /*phase*/ 0.5, &dark,
);
assert!(first.iter().any(|cell| cell.dots != 0));
assert!(other_mark.iter().any(|cell| cell.dots != 0));
assert_ne!(other_mark, first);
let light = Lighting::terminal(/*fg*/ (32, 32, 32), /*bg*/ (250, 250, 250));
let light_frame = renderer.frame(
/*columns*/ 60, /*rows*/ 21, /*phase*/ 0.0, &light,
);
assert_eq!(
light_frame.iter().map(|cell| cell.dots).collect::<Vec<_>>(),
first.iter().map(|cell| cell.dots).collect::<Vec<_>>()
);
for cell in light_frame.iter().filter(|cell| cell.dots != 0) {
let [_, r, g, b] = cell.rgb.to_be_bytes();
assert!(
r < 200 && g < 200 && b < 200,
"light-theme ink must contrast with the background"
);
}
}
#[test]
fn faded_presentation_settles_without_redraws_then_resumes() {
let area = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 48, /*height*/ 17,
);
let start = Instant::now();
for elapsed in [
Duration::from_secs(/*secs*/ 2),
sequence::SPIN_DURATION - FRAME_INTERVAL * 2,
let mut splash = EmptyStateAnimation::default();
assert!(is_blank(&draw(
&splash,
screen,
screen,
Some(ComposerState::Empty),
MotionMode::Animated,
)));
splash.start_fresh();
assert!(!is_blank(&draw(
&splash,
screen,
screen,
Some(ComposerState::Empty),
MotionMode::Animated,
)));
for (composer, motion) in [
(Some(ComposerState::Draft), MotionMode::Animated),
(None, MotionMode::Animated),
(Some(ComposerState::Empty), MotionMode::Reduced),
] {
let mut animation = EmptyStateAnimation::default();
animation.start_fresh();
animation.spin_elapsed = elapsed;
let mut buffer = Buffer::empty(area);
animation.render_in_at(area, &mut buffer, Presentation::Animated, start);
let moving = buffer.clone();
buffer.reset();
assert_eq!(
animation.render_in_at(
area,
&mut buffer,
Presentation::Faded,
start + FRAME_INTERVAL,
),
Some(FRAME_INTERVAL)
);
assert_eq!(buffer, moving);
let settled_at = start + FRAME_INTERVAL + sequence::STATIC_FADE;
buffer.reset();
assert_eq!(
animation.render_in_at(area, &mut buffer, Presentation::Faded, settled_at,),
None
);
assert!(buffer.content.iter().any(|cell| cell.symbol() != " "));
// Missing OSC colors must preserve the terminal's readable default foreground.
if terminal_palette::default_bg().is_none() {
assert!(
buffer
.content
.iter()
.filter(|cell| cell.symbol() != " ")
.all(|cell| cell.fg == ratatui::style::Color::Reset)
);
}
let settled = buffer.clone();
buffer.reset();
assert_eq!(
animation.render_in_at(
area,
&mut buffer,
Presentation::Faded,
settled_at + Duration::from_secs(/*secs*/ 60),
),
None
);
assert_eq!(buffer, settled);
buffer.reset();
assert_eq!(
animation.render_in_at(
area,
&mut buffer,
Presentation::Animated,
settled_at + Duration::from_secs(/*secs*/ 61),
),
Some(FRAME_INTERVAL)
);
assert_eq!(buffer, settled);
assert_eq!(animation.spin_elapsed, elapsed);
buffer.reset();
assert_eq!(
animation.render_in_at(
area,
&mut buffer,
Presentation::Animated,
settled_at + Duration::from_secs(/*secs*/ 61) + FRAME_INTERVAL,
),
Some(FRAME_INTERVAL)
);
assert_ne!(animation.opacity, sequence::STATIC_OPACITY);
assert!(is_blank(&draw(&splash, screen, screen, composer, motion)));
}
splash.dismiss();
assert!(is_blank(&draw(
&splash,
screen,
screen,
Some(ComposerState::Empty),
MotionMode::Animated,
)));
let mut handoff = EmptyStateAnimation::default();
handoff.continue_from(&mut splash);
assert!(handoff.is_eligible());
assert!(!splash.is_eligible());
}
#[test]
fn skipped_frames_preserve_spin_until_visible_time_resumes() {
let area = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 48, /*height*/ 17,
);
let start = Instant::now();
// The same pause is used before editor handoff and after a job-control resume.
// Calling it after an arbitrarily long interruption must still stop at the last frame.
let mut animation = EmptyStateAnimation::default();
animation.start_fresh();
let mut buffer = Buffer::empty(area);
animation.render_in_at(area, &mut buffer, Presentation::Animated, start);
let visible = Duration::from_millis(/*millis*/ 150);
buffer.reset();
animation.render_in_at(area, &mut buffer, Presentation::Animated, start + visible);
let before = buffer.clone();
animation.pause_clock();
let resumed = start + Duration::from_secs(/*secs*/ 3600);
buffer.reset();
assert_eq!(
animation.render_in_at(area, &mut buffer, Presentation::Animated, resumed),
Some(FRAME_INTERVAL)
);
assert_eq!(buffer, before);
assert_eq!(animation.spin_elapsed, visible);
buffer.reset();
animation.render_in_at(
area,
&mut buffer,
Presentation::Animated,
resumed + FRAME_INTERVAL,
);
assert_eq!(animation.spin_elapsed, visible + FRAME_INTERVAL);
}
#[test]
fn hidden_and_clipped_frames_preserve_spin_budget_without_restarting() {
let area = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 48, /*height*/ 17,
);
let start = Instant::now();
for hidden_area in [area, Rect::default()] {
let mut animation = EmptyStateAnimation::default();
animation.start_fresh();
animation.spin_elapsed = sequence::SPIN_DURATION - FRAME_INTERVAL;
let mut buffer = Buffer::empty(area);
animation.render_in_at(area, &mut buffer, Presentation::Animated, start);
let before = buffer.clone();
buffer.reset();
let hidden = if hidden_area.is_empty() {
Presentation::Animated
} else {
Presentation::Hidden
};
assert_eq!(
animation.render_in_at(
hidden_area,
&mut buffer,
hidden,
start + Duration::from_secs(/*secs*/ 20)
),
None
fn first_screen_splash_layouts() {
let mut splash = EmptyStateAnimation::default();
splash.start_fresh();
let mut frames = Vec::new();
for width in [80, 56, 40] {
let screen = Rect::new(/*x*/ 0, /*y*/ 0, width, /*height*/ 12);
let buffer = draw(
&splash,
screen,
screen,
Some(ComposerState::Empty),
MotionMode::Animated,
);
assert_eq!(buffer, Buffer::empty(area));
let resumed = start + Duration::from_secs(/*secs*/ 40);
animation.render_in_at(area, &mut buffer, Presentation::Animated, resumed);
assert_eq!(buffer, before);
buffer.reset();
assert_eq!(
animation.render_in_at(
area,
&mut buffer,
Presentation::Animated,
resumed + FRAME_INTERVAL
),
None
);
assert!(buffer.content.iter().any(|cell| cell.symbol() != " "));
assert_eq!(animation.opacity, 1.0);
animation.pause_clock();
frames.push(format!("width {width}:\n{}", rows(&buffer).join("\n")));
}
}
#[test]
fn onboarding_keeps_full_color_after_budget_and_pause() {
crate::terminal_palette::with_test_default_colors(
crate::terminal_probe::DefaultColors {
fg: (210, 221, 235),
bg: (15, 20, 37),
},
|| {
let area = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 48, /*height*/ 17,
);
let start = Instant::now();
let mut animation = EmptyStateAnimation::default();
animation.start_fresh();
let mut buffer = Buffer::empty(area);
animation.render_in_at(area, &mut buffer, Presentation::Animated, start);
buffer.reset();
assert_eq!(
animation.render_in_at(
area,
&mut buffer,
Presentation::Animated,
start + sequence::SPIN_DURATION
),
None
);
assert_eq!(animation.opacity, 1.0);
assert!(buffer.content.iter().any(|cell| cell.symbol() != " "));
insta::assert_snapshot!(
"onboarding_settled_logo",
buffer
.content
.chunks(usize::from(area.width))
.map(|row| row
.iter()
.map(ratatui::buffer::Cell::symbol)
.collect::<String>()
.trim_end()
.to_owned())
.collect::<Vec<_>>()
.join("\n")
);
let settled = buffer.clone();
animation.pause_clock();
buffer.reset();
assert_eq!(
animation.render_in_at(
area,
&mut buffer,
Presentation::Faded,
start + Duration::from_secs(/*secs*/ 3600)
),
None
);
assert_eq!(buffer, settled);
},
);
insta::assert_snapshot!("first_screen_splash", frames.join("\n\n"));
}

View File

@@ -1,6 +1,7 @@
//! Session headers, onboarding guidance, and transcript cards.
use super::*;
use crate::branding;
use crate::line_truncation::truncate_line_with_ellipsis_if_overflow;
use crate::style::accent_color;
use crate::width::display_width;
@@ -9,7 +10,7 @@ use crate::width::display_width;
pub(crate) fn codex_title(version: &str) -> Vec<Span<'static>> {
vec![
">_ ".fg(accent_color()),
"aKode".bold(),
branding::PRODUCT_NAME.bold(),
format!(" (v{version})").dim(),
]
}
@@ -175,7 +176,8 @@ pub(crate) fn new_session_info(
.with_yolo_mode(has_yolo_permissions(
session.approval_policy,
&session.permission_profile,
));
))
.with_provider_name(Some(config.model_provider.name.clone()));
let mut parts: Vec<Box<dyn HistoryCell>> = vec![Box::new(header)];
if is_first_event && local_settings.tui.show_tooltips {
@@ -285,6 +287,7 @@ pub(crate) struct SessionHeaderHistoryCell {
model: String,
reasoning_effort: Option<ReasoningEffortConfig>,
directory: PathBuf,
provider_name: Option<String>,
yolo_mode: bool,
}
@@ -300,10 +303,16 @@ impl SessionHeaderHistoryCell {
model,
reasoning_effort,
directory,
provider_name: None,
yolo_mode: false,
}
}
pub(crate) fn with_provider_name(mut self, provider_name: Option<String>) -> Self {
self.provider_name = provider_name.filter(|name| !name.trim().is_empty());
self
}
pub(crate) fn with_yolo_mode(mut self, yolo_mode: bool) -> Self {
self.yolo_mode = yolo_mode;
self
@@ -344,24 +353,60 @@ impl SessionHeaderHistoryCell {
}
impl HistoryCell for SessionHeaderHistoryCell {
/// Ghost avatar on the left; product/version, model/provider, and directory on the right.
/// Terminals too narrow for the avatar keep the text column alone.
fn display_lines(&self, width: u16) -> Vec<Line<'static>> {
const INDENT: &str = " ";
let width = usize::from(width);
let mut title = vec![" ".into()];
title.extend(codex_title(self.version));
let mut lines = vec![
Line::default(),
Line::from(title),
Line::from(vec![
" ".into(),
self.format_directory(Some(width.saturating_sub(/*rhs*/ 5)))
.dim(),
]),
let avatar_width = INDENT.len() + branding::GHOST_WIDTH + branding::GHOST_GAP;
let show_avatar = width >= avatar_width + 16;
let text_indent = if show_avatar {
avatar_width
} else {
INDENT.len()
};
let mut title: Vec<Span<'static>> = vec![
branding::PRODUCT_NAME.bold(),
format!(" v{}", self.version).dim(),
];
if self.yolo_mode {
lines.push(Line::from(vec![
" permissions: ".dim(),
"YOLO mode".magenta().bold(),
]));
if !show_avatar {
title.insert(0, ">_ ".fg(accent_color()));
}
let mut model: Vec<Span<'static>> =
vec![self.model.clone().into()];
if let Some(provider) = &self.provider_name {
model.push(" · ".dim());
model.push(provider.clone().dim());
}
let directory = vec![
self.format_directory(Some(width.saturating_sub(text_indent)))
.dim(),
];
let yolo = self
.yolo_mode
.then(|| vec!["permissions: ".dim(), "YOLO mode".magenta().bold()]);
let mut lines = vec![Line::default()];
if show_avatar {
let mut right = vec![Some(title), Some(model), Some(directory), yolo];
for (row, text) in right.iter_mut().enumerate() {
let mut spans = vec![INDENT.into(), branding::ghost_span(row)];
if let Some(text) = text.take() {
spans.push(" ".repeat(branding::GHOST_GAP).into());
spans.extend(text);
}
lines.push(Line::from(spans));
}
} else {
for text in [Some(title), Some(model), Some(directory), yolo]
.into_iter()
.flatten()
{
let mut spans = vec![INDENT.into()];
spans.extend(text);
lines.push(Line::from(spans));
}
}
lines
.into_iter()
@@ -371,10 +416,10 @@ impl HistoryCell for SessionHeaderHistoryCell {
fn raw_lines(&self) -> Vec<Line<'static>> {
let mut lines = vec![
Line::from(format!("aKode (v{})", self.version)),
Line::from(format!("{} v{}", branding::PRODUCT_NAME, self.version)),
Line::from(format!(
"model: {}{}",
self.model,
self.model.clone(),
self.reasoning_label()
.map(|reasoning| format!(" {reasoning}"))
.unwrap_or_default()
@@ -384,6 +429,9 @@ impl HistoryCell for SessionHeaderHistoryCell {
self.format_directory(/*max_width*/ None)
)),
];
if let Some(provider) = &self.provider_name {
lines.insert(2, Line::from(format!("provider: {provider}")));
}
if self.yolo_mode {
lines.push(Line::from("permissions: YOLO mode"));
}

View File

@@ -3,6 +3,7 @@ source: tui/src/history_cell/tests.rs
expression: "render_lines(&lines).join(\"\\n\")"
---
>_ aKode (vtest)
project
permissions: YOLO mode
▄▄████▄▄ aKode vtest
██▀▀██▀▀██ gpt-5.6-sol
██▄▄██▄▄██ project
██▀████▀██ permissions: YOLO mode

View File

@@ -3,45 +3,36 @@ source: tui/src/history_cell/tests.rs
expression: "format!(\"{buf:?}\")"
---
Buffer {
area: Rect { x: 0, y: 0, width: 42, height: 3 },
area: Rect { x: 0, y: 0, width: 42, height: 5 },
content: [
" ",
" >_ aKode (vtest) ",
" …ガパガパガパガパガパガパガパ-project", // hidden by multi-width symbols: [(7, " "), (9, " "), (11, " "), (13, " "), (15, " "), (17, " "), (19, " "), (21, " "), (23, " "), (25, " "), (27, " "), (29, " "), (31, " "), (33, " ")]
" ▄▄████▄▄ aKode vtest ",
" ██▀▀██▀▀██ gpt-5 ",
" ██▄▄██▄▄██ …ガパガパガパガパ-project ", // hidden by multi-width symbols: [(18, " "), (20, " "), (22, " "), (24, " "), (26, " "), (28, " "), (30, " "), (32, " ")]
" ██▀████▀██ ",
],
styles: [
x: 0, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 5, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 10, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 18, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 5, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 7, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 8, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 9, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 10, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 11, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 12, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 13, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 14, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 15, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 16, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 17, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 18, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 19, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 20, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 21, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 22, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 23, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 24, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 25, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 26, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 27, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 28, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 29, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 30, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 31, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 32, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 33, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 34, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 16, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 21, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 27, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 16, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 18, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 19, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 20, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 21, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 22, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 23, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 24, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 25, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 26, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 27, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 28, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 29, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 30, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 31, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 32, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 33, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 41, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
]
}

View File

@@ -3,6 +3,7 @@ source: tui/src/history_cell/tests.rs
expression: rendered
---
>_ aKode (vtest)
/tmp/project
permissions: YOLO mode
▄▄████▄▄ aKode vtest
██▀▀██▀▀██ gpt-5
██▄▄██▄▄██ /tmp/project
██▀████▀██ permissions: YOLO mode

View File

@@ -3,7 +3,9 @@ source: tui/src/history_cell/tests.rs
expression: rendered
---
>_ aKode (v0.10.0-pulito)
/tmp/project
▄▄████▄▄ aKode v0.10.0-pulito
██▀▀██▀▀██ gpt-5 · mock
██▄▄██▄▄██ /tmp/project
██▀████▀██
Tip: Model just became available

View File

@@ -107,6 +107,7 @@ mod approval_events;
mod async_question_reply;
mod backend_id;
mod bottom_pane;
mod branding;
mod branch_summary;
mod chatwidget;
mod cli;

View File

@@ -1,7 +1,6 @@
//! Fixed shortcuts used before users have had a chance to configure Codex.
use crossterm::event::KeyCode;
use crossterm::event::KeyModifiers;
use crate::key_hint;
use crate::key_hint::KeyBinding;
@@ -31,10 +30,3 @@ pub(crate) const QUIT: [KeyBinding; 3] = [
key_hint::ctrl(KeyCode::Char('c')),
key_hint::ctrl(KeyCode::Char('d')),
];
pub(crate) const TOGGLE_ANIMATION: [KeyBinding; 2] = [
key_hint::ctrl(KeyCode::Char('.')),
KeyBinding::new(
KeyCode::Char('.'),
KeyModifiers::CONTROL.union(KeyModifiers::SHIFT),
),
];

View File

@@ -139,7 +139,6 @@ impl OnboardingScreen {
let mut steps: Vec<Step> = Vec::new();
steps.push(Step::Welcome(WelcomeWidget::new(
!matches!(login_status, LoginStatus::NotAuthenticated),
tui.frame_requester(),
local_settings.tui.animations && local_settings.tui.effects.welcome,
)));
#[cfg(target_os = "windows")]

View File

@@ -2,24 +2,11 @@
source: tui/src/onboarding/welcome.rs
expression: visible.trim_end()
---
⢀⣀⣠⣤⣤⣤⣤⣤⣤⣀⣀
⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⡀
⢀⣠⣾⣿⣿⣿⣿⡿⠟⠛⠋⠉⠉⠙⠛⠛⠿⣿⣿⣿⣿⣿⣷⡄
⣠⣾⣿⣿⣿⠿⠋ ⠉⠛⣿⣿⣿⣿⣷⡀
⣰⣿⣿⣿⡟⠁ ⠹⣿⣿⣿⣿⡄
⣼⣿⣿⣿⠟ ⣀⣤⡀ ⠈⢿⣿⣿⣷⡀
⢠⣿⣿⣿⡟ ⣿⣿⣿⣄ ⠘⣿⣿⣿⣧
⢸⣿⣿⣿⠁ ⠙⣿⣿⣿⣆ ⢿⣿⣿⣿
⢾⣿⣿⣿ ⢸⣿⣿⣿⠆ ⢸⣿⣿⣿⠆
⣾⣿⣿⣿ ⣠⣿⣿⣿⠏ ⢀⣀⣀⣀⣀⣀⣀⡀ ⢸⣿⣿⣿
⠸⣿⣿⣿⡆ ⢰⣿⣿⣿⠇ ⣿⣿⣿⣿⣿⣿⣿⣿⡆ ⢀⣿⣿⣿⡟
⢻⣿⣿⣿⣄ ⠉⠛⠁ ⠙⠛⠛⠛⠛⠛⠛⠋ ⢀⣼⣿⣿⣿⠃
⠈⢻⣿⣿⣿⣦⡀ ⣠⣾⣿⣿⣿⠇
⠻⣿⣿⣿⣿⣤⣀ ⢀⣠⣾⣿⣿⣿⡿⠃
⠈⠻⣿⣿⣿⣿⣷⣶⣤⣄⣀⣀⣀⢀⣀⣠⣤⣴⣿⣿⣿⣿⣿⠛
⠙⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋
⠉⠙⠛⠿⠿⠿⠿⠿⠿⠿⠛⠋⠁
█████╗ ██╗ ██╗ ██████╗ ██████╗ ███████╗
▄▄████▄▄ ██╔══██╗██║ ██╔╝██╔═══██╗██╔══██╗██╔════╝
██▀▀██▀▀██ ███████║█████╔╝ ██║ ██║██║ ██║█████╗
██▄▄██▄▄██ ██╔══██║██╔═██╗ ██║ ██║██║ ██║██╔══╝
██▀████▀██ ██║ ██║██║ ██╗╚██████╔╝██████╔╝███████╗
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
Welcome to Codex, OpenAI's command-line coding agent
Benvenuto in aKode · il tuo agente di coding locale

View File

@@ -1,8 +1,7 @@
//! Shared welcome header for the onboarding sign-in picker.
//! The logo occupies a fixed stage so its motion never shifts the choices below it.
//! The static aKode splash sits above the choices; small viewports show only the welcome line.
use crossterm::event::KeyEvent;
use crossterm::event::KeyEventKind;
use ratatui::buffer::Buffer;
use ratatui::layout::Rect;
use ratatui::prelude::Widget;
@@ -13,62 +12,36 @@ use ratatui::widgets::Paragraph;
use ratatui::widgets::WidgetRef;
use ratatui::widgets::Wrap;
use std::cell::Cell;
use std::cell::RefCell;
use crate::empty_state_animation::EmptyStateAnimation;
use crate::branding;
use crate::empty_state_animation::Presentation;
use crate::key_hint::KeyBindingListExt;
use crate::onboarding::keys;
use crate::onboarding::onboarding_screen::KeyboardHandler;
use crate::onboarding::onboarding_screen::StepStateProvider;
use crate::tui::FrameRequester;
use super::onboarding_screen::StepState;
const MIN_ANIMATION_HEIGHT: u16 = 41;
const MIN_ANIMATION_WIDTH: u16 = 64;
const ANIMATION_WIDTH: u16 = 60;
const ANIMATION_HEIGHT: u16 = 21;
/// Below this viewport the splash would crowd out the onboarding choices.
const MIN_LOGO_HEIGHT: u16 = 24;
const INDENT: &str = " ";
pub(crate) struct WelcomeWidget {
pub is_logged_in: bool,
animation: RefCell<EmptyStateAnimation>,
request_frame: FrameRequester,
animations_enabled: bool,
show_logo: bool,
presentation: Cell<Presentation>,
focused: Cell<bool>,
layout_area: Cell<Option<Rect>>,
}
impl KeyboardHandler for WelcomeWidget {
/// Replay the welcome animation when the existing logo shortcut fires.
///
/// The key list includes compatibility variants for terminals that report
/// modifier bits differently.
fn handle_key_event(&mut self, key_event: KeyEvent) {
if !self.animations_enabled {
return;
}
if key_event.kind == KeyEventKind::Press && keys::TOGGLE_ANIMATION.is_pressed(key_event) {
self.animation.get_mut().start_fresh();
self.request_frame.schedule_frame();
}
}
/// The splash is static, so the welcome step has no keys of its own.
fn handle_key_event(&mut self, _key_event: KeyEvent) {}
}
impl WelcomeWidget {
pub(crate) fn new(
is_logged_in: bool,
request_frame: FrameRequester,
animations_enabled: bool,
) -> Self {
let mut animation = EmptyStateAnimation::default();
animation.start_fresh();
pub(crate) fn new(is_logged_in: bool, show_logo: bool) -> Self {
Self {
is_logged_in,
animation: RefCell::new(animation),
request_frame,
animations_enabled,
show_logo,
presentation: Cell::new(Presentation::Animated),
focused: Cell::new(/*value*/ true),
layout_area: Cell::new(None),
@@ -80,9 +53,6 @@ impl WelcomeWidget {
}
pub(crate) fn set_presentation(&self, presentation: Presentation) {
if presentation == Presentation::Hidden {
self.animation.borrow_mut().pause_clock();
}
self.presentation.set(presentation);
}
@@ -95,40 +65,28 @@ impl WidgetRef for &WelcomeWidget {
fn render_ref(&self, area: Rect, buf: &mut Buffer) {
Clear.render(area, buf);
let layout_area = self.layout_area.get().unwrap_or(area);
// Skip the animation entirely when the viewport is too small so we don't clip frames.
let show_animation = self.animations_enabled
let show_logo = self.show_logo
&& self.presentation.get() != Presentation::Hidden
&& layout_area.height >= MIN_ANIMATION_HEIGHT
&& layout_area.width >= MIN_ANIMATION_WIDTH;
&& layout_area.height >= MIN_LOGO_HEIGHT;
let faded = !self.focused.get() || self.presentation.get() == Presentation::Faded;
let presentation = if !show_animation {
Presentation::Hidden
} else if !self.focused.get() {
Presentation::Faded
let lines: Vec<Line> = if show_logo {
let width = usize::from(area.width).saturating_sub(INDENT.len());
branding::splash_lines(width, /*compact*/ true)
.into_iter()
.map(|line| {
let mut spans = vec![INDENT.into()];
spans.extend(line.spans);
let line = Line::from(spans);
if faded { line.dim() } else { line }
})
.collect()
} else {
self.presentation.get()
vec![Line::from(vec![
INDENT.into(),
branding::WELCOME_LINE.into(),
])]
};
let stage = Rect::new(area.x, area.y, ANIMATION_WIDTH, ANIMATION_HEIGHT);
if let Some(delay) = self
.animation
.borrow_mut()
.render_in(stage, buf, presentation)
{
self.request_frame.schedule_frame_in(delay);
}
let logo_rows = if show_animation {
ANIMATION_HEIGHT + 1
} else {
0
};
let mut lines: Vec<Line> = vec![Line::default(); usize::from(logo_rows)];
lines.push(Line::from(vec![
" ".into(),
"Welcome to ".into(),
"Codex".bold(),
", OpenAI's command-line coding agent".into(),
]));
Paragraph::new(lines)
.wrap(Wrap { trim: false })
@@ -163,47 +121,36 @@ mod tests {
}
#[test]
fn welcome_renders_animation_on_first_draw() {
let widget = WelcomeWidget::new(
/*is_logged_in*/ false,
FrameRequester::test_dummy(),
/*animations_enabled*/ true,
);
let area = Rect::new(0, 0, MIN_ANIMATION_WIDTH, MIN_ANIMATION_HEIGHT);
fn welcome_renders_logo_on_first_draw() {
let widget = WelcomeWidget::new(/*is_logged_in*/ false, /*show_logo*/ true);
let area = Rect::new(0, 0, /*width*/ 64, MIN_LOGO_HEIGHT);
let mut buf = Buffer::empty(area);
(&widget).render_ref(area, &mut buf);
let welcome_row = row_containing(&buf, "Welcome");
assert_eq!(welcome_row, Some(ANIMATION_HEIGHT + 1));
// Six banner rows and a spacer precede the welcome line.
let welcome_row = row_containing(&buf, "Benvenuto");
assert_eq!(welcome_row, Some(7));
assert_eq!(row_containing(&buf, "╚═╝"), Some(5));
widget.set_focused(/*focused*/ false);
(&widget).render_ref(area, &mut buf);
assert_eq!(row_containing(&buf, "Welcome"), welcome_row);
assert_eq!(row_containing(&buf, "Benvenuto"), welcome_row);
}
#[test]
fn welcome_skips_animation_below_height_breakpoint() {
let widget = WelcomeWidget::new(
/*is_logged_in*/ false,
FrameRequester::test_dummy(),
/*animations_enabled*/ true,
);
let area = Rect::new(0, 0, MIN_ANIMATION_WIDTH, MIN_ANIMATION_HEIGHT - 1);
fn welcome_skips_logo_below_height_breakpoint() {
let widget = WelcomeWidget::new(/*is_logged_in*/ false, /*show_logo*/ true);
let area = Rect::new(0, 0, /*width*/ 64, MIN_LOGO_HEIGHT - 1);
let mut buf = Buffer::empty(area);
(&widget).render_ref(area, &mut buf);
let welcome_row = row_containing(&buf, "Welcome");
let welcome_row = row_containing(&buf, "Benvenuto");
assert_eq!(welcome_row, Some(0));
}
#[test]
fn welcome_logo_layout() {
let (width, height) = (160, 48);
let widget = WelcomeWidget::new(
/*is_logged_in*/ false,
FrameRequester::test_dummy(),
/*animations_enabled*/ true,
);
// The first focused draw shows the intact logo at exactly zero elapsed time.
let widget = WelcomeWidget::new(/*is_logged_in*/ false, /*show_logo*/ true);
let area = Rect::new(/*x*/ 0, /*y*/ 0, width, height);
let mut buf = Buffer::empty(area);
(&widget).render_ref(area, &mut buf);

View File

@@ -3,5 +3,7 @@ source: tui/src/app/tests.rs
expression: rendered
---
>_ aKode (v<VERSION>)
/tmp/project
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ gpt-test
██▄▄██▄▄██ /tmp/project
██▀████▀██

View File

@@ -1,8 +0,0 @@
---
source: tui/src/empty_state_animation_tests.rs
assertion_line: 171
expression: "fade_frames.join(\"\\n\")"
---
0ms: ⣀ Rgb(195, 201, 206)
200ms: ⣀ Rgb(121, 126, 136)
400ms: ⣀ Rgb(47, 52, 67)

View File

@@ -0,0 +1,34 @@
---
source: tui/src/empty_state_animation_tests.rs
assertion_line: 128
expression: "frames.join(\"\\n\\n\")"
---
width 80:
█████╗ ██╗ ██╗ ██████╗ ██████╗ ███████╗
▄▄████▄▄ ██╔══██╗██║ ██╔╝██╔═══██╗██╔══██╗██╔════╝
██▀▀██▀▀██ ███████║█████╔╝ ██║ ██║██║ ██║█████╗
██▄▄██▄▄██ ██╔══██║██╔═██╗ ██║ ██║██║ ██║██╔══╝
██▀████▀██ ██║ ██║██║ ██╗╚██████╔╝██████╔╝███████╗
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
Benvenuto in aKode · il tuo agente di coding locale
width 56:
Benvenuto in aKode · il tuo agente di coding locale
width 40:

View File

@@ -1,18 +0,0 @@
---
source: tui/src/empty_state_animation_tests.rs
expression: "buffer.content.chunks(usize::from(area.width)).map(|row|\nrow.iter().map(|cell|\ncell.symbol()).collect::<String>().trim_end().to_owned()).collect::<Vec<_>>().join(\"\\n\")"
---
⣠⣴⣶⣿⣿⣷⣶⣤⣀⣀⣀⣀⣀
⢠⣾⣿⡿⠟⠛⠉⣻⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀
⢀⣀⣿⣿⡟⢀⣠⣶⣿⣿⠿⠛⢉⣀⣀ ⠙⢿⣿⣿⣆
⢀⣾⣿⣿⣿⣿ ⢸⣿⡿⠋⢁⣤⣶⣿⣿⣿⣿⣦⣄⣻⣿⣿
⢠⣿⣿⡟⢹⣿⣿ ⢸⣿⣷⣾⣿⣿⣿⣯⣀⠉⠛⢿⣿⣿⣿⣿
⣼⣿⣿ ⢸⣿⣿ ⢸⣿⡿⠛⠁⠈⠛⢿⣿⣿⣦⣄⡈⠙⢿⣿⣷⡀
⢸⣿⣿⡀⠸⣿⣿⣶⣼⣿⡇ ⢸⣿⣟⠿⣿⣿⡆ ⢻⣿⣧
⢻⣿⣿⣄⡈⠙⠻⣿⣿⣷⣤⡀⢀⣤⣾⣿⣿ ⢸⣿⡇ ⣸⣿⣿
⣿⣿⣿⣿⣷⣦⣀⠉⣻⣿⣿⣿⡿⢿⣿⣿ ⢸⣿⡇⣠⣿⣿⡟
⢿⣿⣧⠉⠻⣿⣿⣿⣿⡿⠛⠉⣀⣼⣿⣿ ⣸⣿⣿⣿⣿⠟
⠘⢿⣿⣷⣄⡀⠉⠉⢁⣠⣴⣿⣿⡿⠟⠋⢀⣿⣿⡟⠋⠁
⠈⠛⢿⣿⣿⣿⣿⣿⣿⣿⣛⣉⣀⣀⣴⣿⣿⡟
⠈⠉⠉⠉⠙⠻⣿⣿⣿⣿⣿⣿⠿⠋
⠈⠉⠉

View File

@@ -4,10 +4,10 @@ expression: "format!(\"cursor={:?}\\n{frame}\",\nlayout.cursor_pos(area)).replac
---
cursor=Some((13, 12))
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██

View File

@@ -5,8 +5,10 @@ expression: "snapshots.join(\"\\n---\\n\")"
resume lookup fallback:
before:
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
Resuming session…
› draft while loading
@@ -14,8 +16,10 @@ before:
after:
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
› draft while loading
@@ -25,8 +29,10 @@ after:
fork lookup fallback:
before:
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
Forking session…
› draft while loading
@@ -34,8 +40,10 @@ before:
after:
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
› draft while loading
@@ -47,11 +55,13 @@ before:
hidden while picker owns input
after:
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
› Ask aKode to do anything
› Chiedi ad aKode qualsiasi cosa
? for shortcuts
---
@@ -60,10 +70,12 @@ before:
hidden while picker owns input
after:
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
› Ask aKode to do anything
› Chiedi ad aKode qualsiasi cosa
? for shortcuts

View File

@@ -4,38 +4,46 @@ expression: "snapshots.join(\"\\n---\\n\")"
---
empty (48 columns):
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
› Ask aKode to do anything
› Chiedi ad aKode qualsiasi cosa
? for shortcuts
---
configured (48 columns):
>_ aKode (v<VERSION>)
workspace
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ workspace
██▀████▀██
› Ask aKode to do anything
› Chiedi ad aKode qualsiasi cosa
? for shortcuts
---
resuming (48 columns):
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
Resuming session…
› Ask aKode to do anything
› Chiedi ad aKode qualsiasi cosa
? for shortcuts
---
forking (48 columns):
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
Forking session…
› draft while loading
@@ -44,8 +52,10 @@ forking (48 columns):
---
multiline (48 columns):
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
› first startup line
@@ -55,8 +65,9 @@ multiline (48 columns):
---
narrow (18 columns):
>_ aKode (v0.10…
loading
>_ aKode v0.10.…
loading
loading
› first startup

View File

@@ -6,10 +6,12 @@ before onboarding: hidden (0x0 viewport)
---
after onboarding:
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
› Ask aKode to do anything
› Chiedi ad aKode qualsiasi cosa
? for shortcuts

View File

@@ -4,8 +4,10 @@ expression: "frames.join(\"\\n---\\n\").replace(crate::version::AKODE_CLI_VERSIO
---
terminal_app_over_ssh=false, owned=true
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
@@ -14,18 +16,18 @@ terminal_app_over_ssh=false, owned=true
› Ask aKode to do anything
› Chiedi ad aKode qualsiasi cosa
? for shortcuts
---
terminal_app_over_ssh=true, owned=false
>_ aKode (v<VERSION>)
loading
▄▄████▄▄ aKode v<VERSION>
██▀▀██▀▀██ loading
██▄▄██▄▄██ loading
██▀████▀██
› Ask aKode to do anything
› Chiedi ad aKode qualsiasi cosa
? for shortcuts

View File

@@ -458,9 +458,6 @@ impl StartupDraftPump {
frame.set_cursor_position((x, y));
}
})?;
if let Some(delay) = owned_layout.next_frame.get() {
tui.frame_requester().schedule_frame_in(delay);
}
Ok(())
}
}
@@ -518,7 +515,7 @@ fn startup_draft_bottom_pane(
frame_requester,
has_input_focus: true,
enhanced_keys_supported,
placeholder_text: "Ask aKode to do anything".to_string(),
placeholder_text: "Chiedi ad aKode qualsiasi cosa".to_string(),
disable_paste_burst: false,
animations_enabled: crate::system_motion::mode() == crate::motion::MotionMode::Animated,
effects: Default::default(),

View File

@@ -168,27 +168,8 @@ impl StartupDraftPump {
}
}
TuiEvent::Draw | TuiEvent::Resize(_) | TuiEvent::Resume | TuiEvent::FocusGained => {}
TuiEvent::FocusLost => {
self.blossom.borrow_mut().cancel_replay();
return Ok(());
}
TuiEvent::Mouse(mouse) => {
if !tui.is_owned_screen()
|| self.initial_screen != StartupDraftInitialScreen::Composer
|| !matches!(
self.session_action,
super::StartupDraftSessionAction::New
| super::StartupDraftSessionAction::NewFromCommandCenter
)
{
return Ok(());
}
// Size, composer, and modal ownership must be current before hit testing.
self.draw(tui, screen_size)?;
if !self.blossom.borrow_mut().handle_mouse(mouse) {
return Ok(());
}
}
// The static splash has no pointer or focus behavior of its own.
TuiEvent::FocusLost | TuiEvent::Mouse(_) => return Ok(()),
}
crate::startup_recovery::remember(self.bottom_pane.composer_recovery_snapshot());
if self.initial_screen == StartupDraftInitialScreen::Composer {

View File

@@ -8,8 +8,6 @@ use ratatui::layout::Rect;
use ratatui::style::Style;
use ratatui::style::Stylize;
use ratatui::widgets::Widget;
use std::cell::Cell;
use std::time::Duration;
use super::StartupDraftPump;
use super::StartupDraftSessionAction;
@@ -22,14 +20,12 @@ use crate::terminal_hyperlinks::HyperlinkParagraph;
pub(super) struct OwnedStartupLayout<'a> {
pump: &'a StartupDraftPump,
bottom: RenderableItem<'a>,
pub(super) next_frame: Cell<Option<Duration>>,
}
impl<'a> OwnedStartupLayout<'a> {
pub(super) fn new(pump: &'a StartupDraftPump) -> Self {
Self {
pump,
next_frame: Cell::new(/*value*/ None),
bottom: pump
.bottom_pane
.as_renderable_with_options(ComposerRenderOptions {
@@ -67,18 +63,17 @@ impl Renderable for OwnedStartupLayout<'_> {
let composer = (!self.pump.submission_pending)
.then(|| self.pump.bottom_pane.empty_state_composer())
.flatten();
self.next_frame
.set(self.pump.blossom.borrow_mut().render_first_screen(
area,
Rect {
y: header.bottom(),
height: bottom.y.saturating_sub(header.bottom()),
..area
},
buf,
composer,
self.pump.motion,
));
self.pump.blossom.borrow().render_first_screen(
area,
Rect {
y: header.bottom(),
height: bottom.y.saturating_sub(header.bottom()),
..area
},
buf,
composer,
self.pump.motion,
);
None
}
StartupDraftSessionAction::Resume => Some(" Resuming session…"),

View File

@@ -2,6 +2,17 @@
use super::*;
/// The splash is the only startup element that renders the welcome line.
fn has_splash(buffer: &Buffer) -> bool {
let width = usize::from(buffer.area.width);
buffer.content.chunks(width).any(|row| {
row.iter()
.map(ratatui::buffer::Cell::symbol)
.collect::<String>()
.contains(crate::branding::WELCOME_LINE)
})
}
#[test]
fn owned_startup_keeps_the_live_bottom_geometry() {
let mut pump = crate::startup_draft::tests::quiet_startup_test_pump();
@@ -56,11 +67,7 @@ fn new_startup_decoration_tracks_draft_and_session_action() {
let layout = OwnedStartupLayout::new(&pump);
let mut buffer = Buffer::empty(area);
layout.render(area, &mut buffer);
blossom_visible.push(buffer.content.iter().any(|cell| {
cell.symbol()
.chars()
.any(|ch| ('\u{2801}'..='\u{28ff}').contains(&ch))
}));
blossom_visible.push(has_splash(&buffer));
}
assert_eq!(
blossom_visible,
@@ -69,27 +76,22 @@ fn new_startup_decoration_tracks_draft_and_session_action() {
}
#[tokio::test]
async fn configured_welcome_opt_out_disables_blossom_and_clicks() -> anyhow::Result<()> {
use clap::Parser;
async fn configured_welcome_opt_out_disables_splash() -> anyhow::Result<()> {
use akode_config::LoaderOverrides;
use crossterm::event::KeyModifiers;
use crossterm::event::MouseButton;
use crossterm::event::MouseEvent;
use crossterm::event::MouseEventKind;
use clap::Parser;
let codex_home = tempfile::tempdir()?;
let cli = crate::Cli::try_parse_from(["codex"])?;
let area = Rect::new(
/*x*/ 0, /*y*/ 0, /*width*/ 80, /*height*/ 44,
);
let click = MouseEvent {
kind: MouseEventKind::Down(MouseButton::Left),
column: 40,
row: 22,
modifiers: KeyModifiers::NONE,
};
for (settings, enabled) in [
("", true),
("[tui]\nanimations = false\n", false),
// aKode: the splash is opt-in (`[tui.effects] welcome = true`).
("", false),
("[tui.effects]\nwelcome = true\n", true),
(
"[tui]\nanimations = false\n[tui.effects]\nwelcome = true\n",
false,
),
("[tui.effects]\nwelcome = false\n", false),
(
"[tui]\nanimations = false\n[tui.effects]\nwelcome = false\n",
@@ -117,16 +119,11 @@ async fn configured_welcome_opt_out_disables_blossom_and_clicks() -> anyhow::Res
}
let mut buffer = Buffer::empty(area);
OwnedStartupLayout::new(&pump).render(area, &mut buffer);
let visible = buffer.content.iter().any(|cell| {
cell.symbol()
.chars()
.any(|ch| ('\u{2801}'..='\u{28ff}').contains(&ch))
});
let visible = has_splash(&buffer);
assert_eq!(
visible, enabled,
"settings: {settings}, effective: {effective}"
);
assert_eq!(pump.blossom.borrow_mut().handle_mouse(click), enabled);
}
}
Ok(())

View File

@@ -177,7 +177,7 @@ fn terminal_app_ssh_fallback_renders_inline_startup() {
buffer
.content
.iter()
.any(|cell| { cell.symbol() == ">" && cell.fg == crate::style::accent_color() })
.any(|cell| { cell.symbol() == "█" && cell.fg == crate::style::accent_color() })
);
let frame = (0..height)
.map(|y| {