Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .wisp/settings.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
execute_agents = true
12 changes: 9 additions & 3 deletions wisp/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ pub fn finish(session_path: &str, is_dry_run: bool) {
}
emit(&rule);
emit("");
emit(&format!(" {GRAY}session {RESET}{DIM}{session_path}{RESET}"));
emit(&format!(
" {GRAY}session {RESET}{DIM}{session_path}{RESET}"
));
if is_dry_run {
emit(&format!(
" {GRAY} use {WHITE}/run <task>{GRAY} to execute for real{RESET}"
Expand All @@ -255,7 +257,9 @@ pub fn finish(session_path: &str, is_dry_run: bool) {
pub fn init_header() {
let rule = heavy_rule();
emit(&rule);
emit(&format!(" {ACCENT}✦{RESET} {BOLD}{WHITE}Wisp Init{RESET}"));
emit(&format!(
" {ACCENT}✦{RESET} {BOLD}{WHITE}Wisp Init{RESET}"
));
emit(&rule);
emit("");
}
Expand Down Expand Up @@ -300,7 +304,9 @@ pub fn init_error(path: &str, err: &dyn std::fmt::Display) {
pub fn doctor_header() {
let rule = heavy_rule();
emit(&rule);
emit(&format!(" {ACCENT}✦{RESET} {BOLD}{WHITE}Wisp Doctor{RESET}"));
emit(&format!(
" {ACCENT}✦{RESET} {BOLD}{WHITE}Wisp Doctor{RESET}"
));
emit(&rule);
emit("");
}
Expand Down
51 changes: 24 additions & 27 deletions wisp/src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,7 @@ impl App {
}
self.last_was_blank = is_blank;

let color = if is_blank {
WHITE
} else {
line_color(t)
};
let color = if is_blank { WHITE } else { line_color(t) };
self.push(line, color);
}
}
Expand Down Expand Up @@ -205,8 +201,11 @@ fn line_color(t: &str) -> Color {
RED
} else if t.starts_with("✦") || t.starts_with("┌") || t.starts_with("└") {
LAVENDER
} else if t.starts_with('·') || t.starts_with("files") || t.starts_with("task")
|| t.starts_with("branch") || t.starts_with("mode")
} else if t.starts_with('·')
|| t.starts_with("files")
|| t.starts_with("task")
|| t.starts_with("branch")
|| t.starts_with("mode")
{
DIM
} else {
Expand Down Expand Up @@ -296,20 +295,18 @@ fn handle_event(ev: Event, app: &mut App) -> anyhow::Result<()> {
Event::Key(k) if k.kind == KeyEventKind::Press => {
on_key(k.code, k.modifiers, app)?;
}
Event::Mouse(me) => {
match me.kind {
MouseEventKind::ScrollUp => {
app.auto_scroll = false;
app.scroll = app.scroll.saturating_sub(3);
}
MouseEventKind::ScrollDown => {
let max = app.lines.len().saturating_sub(1);
app.scroll = (app.scroll + 3).min(max);
app.auto_scroll = app.scroll >= max;
}
_ => {}
Event::Mouse(me) => match me.kind {
MouseEventKind::ScrollUp => {
app.auto_scroll = false;
app.scroll = app.scroll.saturating_sub(3);
}
}
MouseEventKind::ScrollDown => {
let max = app.lines.len().saturating_sub(1);
app.scroll = (app.scroll + 3).min(max);
app.auto_scroll = app.scroll >= max;
}
_ => {}
},
Event::Resize(_, _) => {}
_ => {}
}
Expand Down Expand Up @@ -569,7 +566,11 @@ fn draw(f: &mut Frame, app: &mut App) {
}

fn draw_header(f: &mut Frame, app: &App, area: Rect) {
let mode_str = if app.execute_agents { "execute" } else { "dry-run" };
let mode_str = if app.execute_agents {
"execute"
} else {
"dry-run"
};
let mode_col = if app.execute_agents { GREEN } else { WHITE };
let cfg_col = if app.config_ok { GREEN } else { RED };
let cfg_str = if app.config_ok { "ok" } else { "!" };
Expand Down Expand Up @@ -603,9 +604,7 @@ fn draw_header(f: &mut Frame, app: &App, area: Rect) {
let mut spans = vec![
Span::styled(
" Wisp ",
Style::default()
.fg(LAVENDER)
.add_modifier(Modifier::BOLD),
Style::default().fg(LAVENDER).add_modifier(Modifier::BOLD),
),
Span::styled(" │ ", Style::default().fg(DIM)),
Span::styled(app.branch.as_str(), Style::default().fg(WHITE)),
Expand Down Expand Up @@ -642,9 +641,7 @@ fn draw_output(f: &mut Frame, app: &App, area: Rect) {

let lines: Vec<Line> = app.lines[start..end]
.iter()
.map(|(text, color)| {
Line::from(Span::styled(text.as_str(), Style::default().fg(*color)))
})
.map(|(text, color)| Line::from(Span::styled(text.as_str(), Style::default().fg(*color))))
.collect();

f.render_widget(Paragraph::new(lines), area);
Expand Down
Loading