diff options
author | 2025-02-03 02:38:20 +0100 | |
---|---|---|
committer | 2025-02-03 02:38:20 +0100 | |
commit | c9abe25d3167bb12d935e3a095160a897dd98176 (patch) | |
tree | f48b310a3739df3effcb183d7747a5f59ba6914c /winit | |
parent | c83809adb907498ba2a573ec9fb50936601ac8fc (diff) | |
download | iced-c9abe25d3167bb12d935e3a095160a897dd98176.tar.gz iced-c9abe25d3167bb12d935e3a095160a897dd98176.tar.bz2 iced-c9abe25d3167bb12d935e3a095160a897dd98176.zip |
Use `text::Span::new` in `window_manager`
Diffstat (limited to 'winit')
-rw-r--r-- | winit/src/program/window_manager.rs | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/winit/src/program/window_manager.rs b/winit/src/program/window_manager.rs index 86cee973..ae214e7c 100644 --- a/winit/src/program/window_manager.rs +++ b/winit/src/program/window_manager.rs @@ -16,7 +16,6 @@ use crate::program::{Program, State}; use winit::dpi::{LogicalPosition, LogicalSize}; use winit::monitor::MonitorHandle; -use std::borrow::Cow; use std::collections::BTreeMap; use std::sync::Arc; @@ -304,33 +303,17 @@ where let spans = match &preedit.selection { Some(selection) => { vec![ - text::Span { - text: Cow::Borrowed( - &preedit.content[..selection.start], - ), - ..text::Span::default() - }, - text::Span { - text: Cow::Borrowed( - if selection.start == selection.end { - "\u{200A}" - } else { - &preedit.content[selection.start..selection.end] - }, - ), - color: Some(background), - ..text::Span::default() - }, - text::Span { - text: Cow::Borrowed(&preedit.content[selection.end..]), - ..text::Span::default() - }, + text::Span::new(&preedit.content[..selection.start]), + text::Span::new(if selection.start == selection.end { + "\u{200A}" + } else { + &preedit.content[selection.start..selection.end] + }) + .color(background), + text::Span::new(&preedit.content[selection.end..]), ] } - _ => vec![text::Span { - text: Cow::Borrowed(&preedit.content), - ..text::Span::default() - }], + _ => vec![text::Span::new(&preedit.content)], }; if spans != self.spans.as_slice() { |