fix(tui/auto): randomize placeholder and tweak spinner style

This commit is contained in:
James Peter
2025-09-30 22:55:09 +10:00
parent 3891143497
commit 86600f82bb
2 changed files with 7 additions and 10 deletions
+6 -5
View File
@@ -1,4 +1,4 @@
use std::sync::atomic::{AtomicU64, Ordering};
use rand::{rng, Rng};
const AUTO_DRIVE_PHRASES: [&str; 60] = [
"Plotting course…",
@@ -63,11 +63,12 @@ const AUTO_DRIVE_PHRASES: [&str; 60] = [
"Envisioning next move…",
];
static PHRASE_COUNTER: AtomicU64 = AtomicU64::new(0);
pub fn next_auto_drive_phrase() -> &'static str {
let idx = (PHRASE_COUNTER.fetch_add(1, Ordering::Relaxed) as usize)
% AUTO_DRIVE_PHRASES.len();
let len = AUTO_DRIVE_PHRASES.len();
if len == 0 {
return "";
}
let idx = rng().random_range(0..len);
AUTO_DRIVE_PHRASES[idx]
}
@@ -250,9 +250,7 @@ impl AutoCoordinatorView {
}
}
let title_y = area.y;
let style = Style::default()
.fg(colors::info())
.add_modifier(Modifier::BOLD);
let style = Style::default().fg(colors::info());
let mut x = start_x;
for ch in trimmed.chars() {
if x >= area.x.saturating_add(area.width) {
@@ -464,7 +462,6 @@ impl AutoCoordinatorView {
total += Self::wrap_count(prompt, inner_width).max(1);
}
if ctx.button.is_some() {
total += 1; // spacer before button block
total += button_height;
}
if ctrl_height > 0 {
@@ -477,7 +474,6 @@ impl AutoCoordinatorView {
total += Self::wrap_count(text, inner_width);
}
if ctx.button.is_some() {
total += 1; // spacer before button block
total += button_height;
}
if ctx.manual_hint.is_some() {