From 1491a850901dcdfc6a322ba87ad701bf64b8106f Mon Sep 17 00:00:00 2001 From: Raphael Amorim Date: Mon, 6 Jan 2025 11:27:45 -0300 Subject: [PATCH] update line_height per update_config fn --- frontends/rioterm/src/context/grid.rs | 12 ++++++++++++ frontends/rioterm/src/screen/mod.rs | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/frontends/rioterm/src/context/grid.rs b/frontends/rioterm/src/context/grid.rs index 541f26eccc..c17127104d 100644 --- a/frontends/rioterm/src/context/grid.rs +++ b/frontends/rioterm/src/context/grid.rs @@ -357,6 +357,12 @@ impl ContextGrid { } } + pub fn update_line_height(&mut self, line_height: f32) { + for context in &mut self.inner { + context.val.dimension.update_line_height(line_height); + } + } + pub fn update_dimensions(&mut self, sugarloaf: &Sugarloaf) { for context in &mut self.inner { let layout = sugarloaf.rich_text_layout(&context.val.rich_text_id); @@ -916,6 +922,12 @@ impl ContextDimension { self.update(); } + #[inline] + pub fn update_line_height(&mut self, line_height: f32) { + self.line_height = line_height; + self.update(); + } + #[inline] pub fn update_dimensions(&mut self, dimensions: SugarDimensions) { self.dimension = dimensions; diff --git a/frontends/rioterm/src/screen/mod.rs b/frontends/rioterm/src/screen/mod.rs index 1068934b23..8bc4544198 100644 --- a/frontends/rioterm/src/screen/mod.rs +++ b/frontends/rioterm/src/screen/mod.rs @@ -374,6 +374,8 @@ impl Screen<'_> { self.renderer = Renderer::new(config, font_library); for context_grid in self.context_manager.contexts_mut() { + context_grid.update_line_height(config.line_height); + context_grid.update_margin(( config.padding_x, padding_y_top, @@ -384,6 +386,11 @@ impl Screen<'_> { for current_context in context_grid.contexts_mut() { let current_context = current_context.context_mut(); + self.sugarloaf.set_rich_text_line_height( + ¤t_context.rich_text_id, + current_context.dimension.line_height, + ); + let mut terminal = current_context.terminal.lock(); current_context.renderable_content = RenderableContent::from_cursor_config(&config.cursor);