diff --git a/src/editor/mod.rs b/src/editor/mod.rs index a5df711..d644650 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -414,6 +414,9 @@ impl Editor { self.draw_command_batcher .queue(DrawCommand::FontChanged(guifont)) .ok(); + for window in self.windows.values() { + window.redraw(); + } } } } diff --git a/src/editor/window.rs b/src/editor/window.rs index 9506714..aeb99fb 100644 --- a/src/editor/window.rs +++ b/src/editor/window.rs @@ -200,8 +200,12 @@ impl Window { *previous_style = style; } + // Send a draw command for the given row starting from current_start up until the next style + // change. If the current_start is the same as line_start, this will also work backwards in the + // line in order to ensure that ligatures before the beginning of the grid cell are also + // updated. fn send_draw_command( - &mut self, + &self, row_index: u64, line_start: u64, current_start: u64, @@ -346,6 +350,20 @@ impl Window { self.send_command(WindowDrawCommand::Clear); } + pub fn redraw(&self) { + self.send_command(WindowDrawCommand::Clear); + for row in 0..self.grid.height { + let mut current_start = 0; + while current_start < self.grid.width { + if let Some(next_start) = self.send_draw_command(row, 0, current_start) { + current_start = next_start; + } else { + break; + } + } + } + } + pub fn hide(&self) { self.send_command(WindowDrawCommand::Hide); }