refactor(tui): remove [i] prefix from system messages and use red color for errors#121
Merged
refactor(tui): remove [i] prefix from system messages and use red color for errors#121
Conversation
…or for errors - Remove [i] prefix from info system messages for cleaner output - Add error detection for provider overload and connection issues - Display error messages in red color (colors.error) - Display info messages in muted color without prefix - Simplify text wrapping loop without indent handling
Greptile OverviewGreptile SummaryThis PR improves the visual presentation of system messages in the TUI by removing the Key Changes
ImpactThe refactoring maintains the same functional behavior while improving code clarity and message readability. All 895 tests pass, confirming no regressions. Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/cortex-tui/src/views/minimal_session/rendering.rs | Removed [i] prefix from system messages, added error detection patterns for provider/connection issues, simplified text wrapping logic |
Sequence Diagram
sequenceDiagram
participant User
participant TUI as Terminal UI
participant Renderer as render_message_with_theme
participant WrapText as wrap_text
participant Display as Terminal Display
User->>TUI: System message (error/info)
TUI->>Renderer: Call with Message
alt MessageRole::System
Renderer->>Renderer: Detect error patterns<br/>("overloaded", "connection", etc.)
alt Is Error Message
Renderer->>Renderer: Set text_color = colors.error (red)
else Is Info Message
Renderer->>Renderer: Set text_color = colors.text_muted
end
Renderer->>Renderer: Calculate text_width<br/>(no prefix deduction)
Renderer->>WrapText: wrap_text(content, text_width)
WrapText-->>Renderer: Vec<String> (wrapped lines)
loop For each wrapped line
Renderer->>Renderer: Create Line with Span<br/>(no prefix, just colored text)
end
Renderer-->>TUI: Vec<Line> (all lines colored)
end
TUI->>Display: Render lines to buffer
Display->>User: Show message (red for errors, muted for info)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes the
[i]prefix from system messages and improves error message visibility.Changes
colors.error)Before
After
(displayed in red color for error messages)
Testing
cargo check)cargo test -p cortex-tui --lib)