From a5257330538c65e8224995e61890a6a2cf99d881 Mon Sep 17 00:00:00 2001 From: kxxt Date: Thu, 2 May 2024 22:08:39 +0800 Subject: [PATCH] fix: render cells that has no content but styles Fix #181 --- src/state.rs | 6 ++---- src/vt100_imp.rs | 7 +++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/state.rs b/src/state.rs index 67def41..d54939f 100644 --- a/src/state.rs +++ b/src/state.rs @@ -25,10 +25,8 @@ pub fn handle(term: &PseudoTerminal, 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); } } } diff --git a/src/vt100_imp.rs b/src/vt100_imp.rs index c63c3c2..a8aeb45 100644 --- a/src/vt100_imp.rs +++ b/src/vt100_imp.rs @@ -37,8 +37,11 @@ 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()); + } else { + buf_cell.set_symbol(" "); + } let fg: Color = fg.into(); let bg: Color = bg.into(); let mut style = Style::reset();