Improve look of context menu checkbox

This commit is contained in:
Jeremy Soller 2023-12-22 16:08:43 -07:00
parent 898e3add26
commit ccd507594b
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
3 changed files with 10 additions and 11 deletions

View file

@ -109,7 +109,7 @@ pub struct Flags {
term_config: TermConfig, term_config: TermConfig,
} }
#[derive(Clone, Debug)] #[derive(Clone, Copy, Debug)]
pub enum Action { pub enum Action {
Copy, Copy,
Paste, Paste,

View file

@ -34,17 +34,13 @@ pub fn context_menu<'a>(config: &Config, entity: segmented_button::Entity) -> El
}; };
let menu_checkbox = |label, value, action| { let menu_checkbox = |label, value, action| {
let check: Element<_> = if value {
widget::icon::from_name("object-select-symbolic")
.size(16)
.into()
} else {
widget::Space::with_width(Length::Fixed(16.0)).into()
};
menu_button!( menu_button!(
check,
widget::Space::with_width(Length::Fixed(8.0)),
widget::text(label), widget::text(label),
widget::horizontal_space(Length::Fill),
widget::toggler(None, value, move |_| Message::TabContextAction(
entity, action
))
.size(16.0),
) )
.on_press(Message::TabContextAction(entity, action)) .on_press(Message::TabContextAction(entity, action))
}; };

View file

@ -290,7 +290,10 @@ impl Terminal {
let mut term = self.term.lock(); let mut term = self.term.lock();
let grid = term.grid(); let grid = term.grid();
let start = Point::new(Line(-(grid.history_size() as i32)), Column(0)); let start = Point::new(Line(-(grid.history_size() as i32)), Column(0));
let end = Point::new(Line(grid.screen_lines() as i32 - 1), Column(grid.columns() - 1)); let end = Point::new(
Line(grid.screen_lines() as i32 - 1),
Column(grid.columns() - 1),
);
let mut selection = Selection::new(SelectionType::Lines, start, Side::Left); let mut selection = Selection::new(SelectionType::Lines, start, Side::Left);
selection.update(end, Side::Right); selection.update(end, Side::Right);
term.selection = Some(selection); term.selection = Some(selection);