Skip to content

Commit 0d2d4bb

Browse files
committed
fix(welcome): unify onboarding sections
1 parent 7532698 commit 0d2d4bb

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

src/agent/runloop/welcome.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fn render_welcome_text(
146146

147147
if !details.is_empty() {
148148
let mut section = Vec::with_capacity(details.len() + 1);
149-
section.push("**Project Overview**".to_string());
149+
section.push(style_section_title("Project Overview"));
150150
section.extend(details);
151151
sections.push(SectionBlock::new(section, SectionSpacing::Normal));
152152
}
@@ -159,7 +159,7 @@ fn render_welcome_text(
159159
if !trimmed.is_empty() {
160160
add_section(
161161
&mut sections,
162-
"Detected Languages",
162+
style_section_title("Detected Languages"),
163163
vec![trimmed.to_string()],
164164
SectionSpacing::Normal,
165165
);
@@ -363,7 +363,7 @@ fn add_list_section(
363363
.map(|entry| format!("- {}", entry))
364364
.collect();
365365

366-
add_section(sections, title, body, spacing);
366+
add_section(sections, style_section_title(title), body, spacing);
367367
}
368368

369369
fn add_keyboard_shortcut_section(sections: &mut Vec<SectionBlock>) {
@@ -431,13 +431,17 @@ fn add_slash_command_section(sections: &mut Vec<SectionBlock>) {
431431
let mut body = Vec::with_capacity(entries.len() + 1);
432432
let intro = ui_constants::WELCOME_SLASH_COMMAND_INTRO.trim();
433433
if !intro.is_empty() {
434-
body.push(intro.to_string());
434+
body.push(format!(
435+
"{}{}",
436+
ui_constants::WELCOME_SLASH_COMMAND_INDENT,
437+
intro
438+
));
435439
}
436440
body.extend(entries);
437441

438442
add_section(
439443
sections,
440-
ui_constants::WELCOME_SLASH_COMMAND_SECTION_TITLE,
444+
style_section_title(ui_constants::WELCOME_SLASH_COMMAND_SECTION_TITLE),
441445
body,
442446
SectionSpacing::Compact,
443447
);
@@ -607,21 +611,29 @@ mod tests {
607611
ui_constants::WELCOME_SHORTCUT_SECTION_TITLE
608612
);
609613

610-
assert!(welcome.contains("**Project Overview**"));
614+
let styled_overview = style_section_title("Project Overview");
615+
assert!(welcome.contains(&styled_overview));
611616
assert!(welcome.contains("**Project:"));
612617
assert!(welcome.contains("Tip one"));
613618
assert!(welcome.contains("Follow workspace guidelines"));
614619
assert!(welcome.contains(&styled_guidelines));
615620
assert!(welcome.contains(&styled_shortcuts));
616621
assert!(plain.contains("Keyboard Shortcuts"));
617622
assert!(plain.contains("Key Guidelines"));
618-
assert!(welcome.contains("Slash Commands"));
623+
let styled_slash_commands =
624+
style_section_title(ui_constants::WELCOME_SLASH_COMMAND_SECTION_TITLE);
625+
assert!(welcome.contains(&styled_slash_commands));
619626
assert!(welcome.contains(ui_constants::WELCOME_SLASH_COMMAND_INTRO));
620627
assert!(welcome.contains(&format!(
621628
"{}{}init",
622629
ui_constants::WELCOME_SLASH_COMMAND_INDENT,
623630
ui_constants::WELCOME_SLASH_COMMAND_PREFIX
624631
)));
632+
assert!(!welcome.contains(&format!(
633+
"{}{}help",
634+
ui_constants::WELCOME_SLASH_COMMAND_INDENT,
635+
ui_constants::WELCOME_SLASH_COMMAND_PREFIX
636+
)));
625637
assert!(welcome.contains(&format!(
626638
"{}Ctrl+Enter",
627639
ui_constants::WELCOME_SHORTCUT_INDENT
@@ -701,6 +713,11 @@ mod tests {
701713
ui_constants::WELCOME_SLASH_COMMAND_INDENT,
702714
ui_constants::WELCOME_SLASH_COMMAND_PREFIX
703715
)));
716+
assert!(!welcome.contains(&format!(
717+
"{}{}help",
718+
ui_constants::WELCOME_SLASH_COMMAND_INDENT,
719+
ui_constants::WELCOME_SLASH_COMMAND_PREFIX
720+
)));
704721
assert!(welcome.contains(&format!("{}Esc", ui_constants::WELCOME_SHORTCUT_INDENT)));
705722

706723
if let Some(value) = previous {

vtcode-core/src/config/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ pub mod ui {
355355
pub const WELCOME_SHORTCUT_SEPARATOR: &str = "•";
356356
pub const WELCOME_SHORTCUT_INDENT: &str = " ";
357357
pub const WELCOME_SLASH_COMMAND_SECTION_TITLE: &str = "Slash Commands";
358-
pub const WELCOME_SLASH_COMMAND_LIMIT: usize = usize::MAX;
358+
pub const WELCOME_SLASH_COMMAND_LIMIT: usize = 6;
359359
pub const WELCOME_SLASH_COMMAND_PREFIX: &str = "/";
360360
pub const WELCOME_SLASH_COMMAND_INTRO: &str =
361361
"To get started, describe a task or try one of these commands:";

0 commit comments

Comments
 (0)