Add spacing before queued status indicator messages (#3474)
<img width="687" height="174" alt="image" src="https://github.com/user-attachments/assets/e68f5a29-cb2d-4aa6-9cbd-f492878d8d0a" />
This commit is contained in:
@@ -3,10 +3,10 @@ source: tui/src/status_indicator_widget.rs
|
|||||||
expression: terminal.backend()
|
expression: terminal.backend()
|
||||||
---
|
---
|
||||||
" Working (0s • Esc to interrupt) "
|
" Working (0s • Esc to interrupt) "
|
||||||
|
" "
|
||||||
" ↳ first "
|
" ↳ first "
|
||||||
" ↳ second "
|
" ↳ second "
|
||||||
" ⌥↑ edit "
|
" ⌥↑ edit "
|
||||||
" "
|
" "
|
||||||
" "
|
" "
|
||||||
" "
|
" "
|
||||||
" "
|
|
||||||
|
|||||||
@@ -63,10 +63,13 @@ impl StatusIndicatorWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn desired_height(&self, width: u16) -> u16 {
|
pub fn desired_height(&self, width: u16) -> u16 {
|
||||||
// Status line + wrapped queued messages (up to 3 lines per message)
|
// Status line + optional blank line + wrapped queued messages (up to 3 lines per message)
|
||||||
// + optional ellipsis line per truncated message + 1 spacer line
|
// + optional ellipsis line per truncated message + 1 spacer line
|
||||||
let inner_width = width.max(1) as usize;
|
let inner_width = width.max(1) as usize;
|
||||||
let mut total: u16 = 1; // status line
|
let mut total: u16 = 1; // status line
|
||||||
|
if !self.queued_messages.is_empty() {
|
||||||
|
total = total.saturating_add(1); // blank line between status and queued messages
|
||||||
|
}
|
||||||
let text_width = inner_width.saturating_sub(3); // account for " ↳ " prefix
|
let text_width = inner_width.saturating_sub(3); // account for " ↳ " prefix
|
||||||
if text_width > 0 {
|
if text_width > 0 {
|
||||||
for q in &self.queued_messages {
|
for q in &self.queued_messages {
|
||||||
@@ -168,6 +171,9 @@ impl WidgetRef for StatusIndicatorWidget {
|
|||||||
// Build lines: status, then queued messages, then spacer.
|
// Build lines: status, then queued messages, then spacer.
|
||||||
let mut lines: Vec<Line<'static>> = Vec::new();
|
let mut lines: Vec<Line<'static>> = Vec::new();
|
||||||
lines.push(Line::from(spans));
|
lines.push(Line::from(spans));
|
||||||
|
if !self.queued_messages.is_empty() {
|
||||||
|
lines.push(Line::from(""));
|
||||||
|
}
|
||||||
// Wrap queued messages using textwrap and show up to the first 3 lines per message.
|
// Wrap queued messages using textwrap and show up to the first 3 lines per message.
|
||||||
let text_width = area.width.saturating_sub(3); // " ↳ " prefix
|
let text_width = area.width.saturating_sub(3); // " ↳ " prefix
|
||||||
for q in &self.queued_messages {
|
for q in &self.queued_messages {
|
||||||
|
|||||||
Reference in New Issue
Block a user