From 88ffba4a3a4d10fa68e31f0a2d6137691a7735cb Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 13 Feb 2025 01:50:27 +0100 Subject: Simplify preedit overlay creation --- winit/src/program/window_manager.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/winit/src/program/window_manager.rs b/winit/src/program/window_manager.rs index 25d3ad9c..4156e7c8 100644 --- a/winit/src/program/window_manager.rs +++ b/winit/src/program/window_manager.rs @@ -221,15 +221,10 @@ where if let Some(preedit) = preedit { if preedit.content.is_empty() { self.preedit = None; - } else if let Some(overlay) = &mut self.preedit { - overlay.update( - position, - &preedit, - self.state.background_color(), - &self.renderer, - ); } else { - let mut overlay = Preedit::new(); + let mut overlay = + self.preedit.take().unwrap_or_else(Preedit::new); + overlay.update( position, &preedit, -- cgit