Skip to content

Commit b6f8e17

Browse files
committed
Add auto suggestions to tutorial
1 parent a85778e commit b6f8e17

3 files changed

Lines changed: 28 additions & 6 deletions

File tree

src/app/ui.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impl<'a> App<'a> {
384384
if !self.mouse_state.is_enabled() {
385385
let red = Style::default().fg(Color::Red).slow_blink();
386386
let escape_hint = TaggedLine::from(vec![TaggedSpan::new(
387-
Span::styled("Press Escape to re-enable mouse mode.", red),
387+
Span::styled("Press Escape to re-enable mouse mode.", red),
388388
Tag::Tutorial,
389389
)]);
390390
for tagged_span in &escape_hint.spans {

src/content_builder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ pub enum ClipboardTypes {
141141
TutorialClickExample,
142142
TutorialRP1,
143143
TutorialMouseMode,
144+
TutorialAutoSuggest,
144145
TutorialRecommendedSettings,
145146
TutorialCursor0,
146147
TutorialCursor1,

src/tutorial.rs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,12 @@ pub enum TutorialStep {
9090
TutorialsTutorial,
9191
RecommendedSettings,
9292
MouseMode,
93-
AgentMode,
9493
FuzzyHistorySearch,
95-
Autocompletions,
94+
AutoSuggestions,
95+
TabSuggestions,
9696
AutoClosing,
9797
FineGrainDeletion,
98+
AgentMode,
9899
ThemeColours,
99100
CursorStyleEffects,
100101
Keybindings,
@@ -386,6 +387,26 @@ pub fn generate_tutorial_text(
386387
]));
387388
}
388389
}
390+
TutorialStep::AutoSuggestions => {
391+
lines.push(tl(Span::styled("Auto Suggestions", heading_style)));
392+
lines.push(empty());
393+
lines.push(tl(Span::styled(
394+
"As you type, flyline shows Intellisense style auto-suggestions based on Bash tab completions.",
395+
text_style,
396+
)));
397+
lines.push(empty());
398+
lines.push(tl(Span::styled(
399+
"You can disable these auto-suggestions by running:",
400+
text_style,
401+
)));
402+
lines.push(TaggedLine::from(vec![
403+
TaggedSpan::new(Span::styled(" ", text_style), Tag::Tutorial),
404+
ts_copiable(
405+
"flyline suggestions --auto-suggest false".to_string(),
406+
ClipboardTypes::TutorialAutoSuggest,
407+
),
408+
]));
409+
}
389410
TutorialStep::FuzzyHistorySearch => {
390411
lines.push(tl(Span::styled("Fuzzy History Search", heading_style)));
391412
lines.push(empty());
@@ -462,8 +483,8 @@ pub fn generate_tutorial_text(
462483
),
463484
]));
464485
}
465-
TutorialStep::Autocompletions => {
466-
lines.push(tl(Span::styled("Fuzzy Autocompletions", heading_style)));
486+
TutorialStep::TabSuggestions => {
487+
lines.push(tl(Span::styled("Fuzzy Completions", heading_style)));
467488
lines.push(empty());
468489
lines.push(TaggedLine::from(vec![
469490
TaggedSpan::new(Span::styled("Type ", text_style), Tag::Tutorial),
@@ -473,7 +494,7 @@ pub fn generate_tutorial_text(
473494
),
474495
ts_text(" and press "),
475496
ts_key("Tab"),
476-
ts_text(" to trigger autocompletions. If nothing comes up, first set normal Bash completions ("),
497+
ts_text(" to trigger completions. If nothing comes up, first set normal Bash completions ("),
477498
ts_copiable(
478499
"https://github.com/scop/bash-completion".to_string(),
479500
ClipboardTypes::TutorialBashCompletion,

0 commit comments

Comments
 (0)