Skip to content
Open
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
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tinyharness-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ rustyline = { version = "18.0.0", features = ["derive"] }
serde_json = "1.0.149"
regex = "1.11.1"
libc = "0.2"
signal-hook = "0.3"
signal-hook = "0.4"
unicode-width = "0.2"

[features]
default = []
Expand Down
323 changes: 101 additions & 222 deletions tinyharness-ui/src/tui/app.rs

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions tinyharness-ui/src/tui/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,22 @@ impl Style {
/// Each cell stores a character, foreground color, background color,
/// and style flags. When the screen is rendered, only cells that changed
/// from the previous frame are written to the terminal.
///
/// For wide (CJK/fullwidth) characters that occupy 2 columns, the first
/// column holds the character and `wide` is false. The second column
/// is a "continuation" cell with `wide = true`, which tells the renderer
/// not to write it separately (the terminal already rendered it as part
/// of the wide character).
#[derive(Clone, Debug, PartialEq)]
pub struct Cell {
pub char: char,
pub fg: Color,
pub bg: Color,
pub style: Style,
/// Whether this cell is the continuation (second column) of a wide
/// character. Continuation cells are skipped during rendering because
/// the terminal already drew them as part of the wide character.
pub wide: bool,
}

impl Default for Cell {
Expand All @@ -186,6 +196,7 @@ impl Default for Cell {
fg: Color::Default,
bg: Color::Default,
style: Style::default(),
wide: false,
}
}
}
Expand All @@ -206,6 +217,20 @@ impl Cell {
fg,
bg,
style,
wide: false,
}
}

/// Create a continuation cell for a wide character's second column.
/// These cells are skipped during rendering since the terminal
/// already drew them as part of the wide character.
pub fn wide_continuation(fg: Color, bg: Color, style: Style) -> Self {
Cell {
char: ' ',
fg,
bg,
style,
wide: true,
}
}
}
Expand Down
Loading
Loading