Skip to content

fix insert_history modifier handling #1774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2025
Merged

Conversation

nornagon-openai
Copy link
Collaborator

This fixes a bug in insert_history_lines where writing Line::From(vec!["A".bold(), "B".into()]) would write "B" as bold, because "B" didn't explicitly subtract bold.

Comment on lines -548 to +558
let (icon, style): (&str, Style) = match status {
StepStatus::Completed => ("✓", Style::default().fg(Color::Green)),
StepStatus::InProgress => (
"▶",
Style::default()
.fg(Color::Yellow)
.add_modifier(Modifier::BOLD),
),
StepStatus::Pending => ("○", Style::default().fg(Color::Gray)),
let icon_span: Span = match status {
StepStatus::Completed => Span::from("✓").fg(Color::Green),
StepStatus::InProgress => Span::from("▶").fg(Color::Yellow).bold(),
StepStatus::Pending => Span::from("○").fg(Color::Gray),
};
let prefix = vec![
Span::raw(format!("{num:>2}. [")),
Span::styled(icon.to_string(), style),
Span::raw("] "),
];
let mut spans = prefix;
spans.push(Span::raw(step));
lines.push(Line::from(spans));
lines.push(Line::from(vec![
format!("{num:>2}. [").into(),
icon_span,
"] ".into(),
step.into(),
]));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is semantically unchanged, just refactored to be more readable.

next_modifier.insert(span.style.add_modifier);
next_modifier.remove(span.style.sub_modifier);
if next_modifier != modifier {
let mut modifier = Modifier::empty();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the bugfix.

B-Scott33

This comment was marked as spam.

@nornagon-openai nornagon-openai merged commit 8360c6a into main Aug 1, 2025
11 checks passed
@nornagon-openai nornagon-openai deleted the nornagon/fix-bold branch August 1, 2025 17:37
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants