Skip to content

Commit

Permalink
Merge pull request #182 from kxxt/fix/render-cell-with-style
Browse files Browse the repository at this point in the history
fix: render cells that has no content but styles
  • Loading branch information
a-kenji authored May 3, 2024
2 parents 85dc831 + f3ce7a2 commit 5b41df4
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,24 @@ Buffer {
x: 18, y: 1, fg: Indexed(4), bg: Reset, underline: Reset, modifier: BOLD,
x: 24, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 55, y: 1, fg: Indexed(4), bg: Reset, underline: Reset, modifier: BOLD,
x: 61, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 61, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 18, y: 2, fg: Indexed(4), bg: Reset, underline: Reset, modifier: BOLD,
x: 28, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 67, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 81, y: 2, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 55, y: 3, fg: Indexed(4), bg: Reset, underline: Reset, modifier: BOLD,
x: 64, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 64, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 3, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 32, y: 4, fg: Indexed(4), bg: Reset, underline: Reset, modifier: BOLD,
x: 37, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 55, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 81, y: 4, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 33, y: 5, fg: Indexed(4), bg: Reset, underline: Reset, modifier: BOLD,
x: 41, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 56, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 81, y: 5, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 6, fg: Indexed(6), bg: Reset, underline: Reset, modifier: BOLD,
x: 9, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 13, y: 6, fg: Indexed(5), bg: Reset, underline: Reset, modifier: BOLD,
Expand All @@ -60,11 +62,40 @@ Buffer {
x: 25, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 30, y: 6, fg: Indexed(4), bg: Reset, underline: Reset, modifier: BOLD,
x: 51, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 52, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 81, y: 6, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 7, fg: Indexed(2), bg: Reset, underline: Reset, modifier: BOLD,
x: 2, y: 7, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 3, y: 7, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 9, fg: Gray, bg: Reset, underline: Reset, modifier: BOLD,
x: 2, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 81, y: 7, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 8, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 8, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 9, fg: Gray, bg: Reset, underline: Reset, modifier: NONE,
x: 2, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 9, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 10, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 10, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 11, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 11, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 12, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 12, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 13, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 13, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 14, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 14, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 15, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 15, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 16, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 16, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 17, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 17, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 18, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 18, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 19, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 19, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 20, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 20, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 21, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 21, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 1, y: 22, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 81, y: 22, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
]
}
6 changes: 2 additions & 4 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ pub fn handle<S: Screen>(term: &PseudoTerminal<S>, area: Rect, buf: &mut Buffer)
}

if let Some(screen_cell) = screen.cell(row, col) {
if screen_cell.has_contents() {
let cell = buf.get_mut(buf_col, buf_row);
screen_cell.apply(cell);
}
let cell = buf.get_mut(buf_col, buf_row);
screen_cell.apply(cell);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/vt100_imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ impl Cell for vt100::Cell {
fn fill_buf_cell(screen_cell: &vt100::Cell, buf_cell: &mut ratatui::buffer::Cell) {
let fg = screen_cell.fgcolor();
let bg = screen_cell.bgcolor();

buf_cell.set_symbol(&screen_cell.contents());
if screen_cell.has_contents() {
buf_cell.set_symbol(&screen_cell.contents());
}
let fg: Color = fg.into();
let bg: Color = bg.into();
let mut style = Style::reset();
Expand Down

0 comments on commit 5b41df4

Please sign in to comment.