Improve look of context menu checkbox
This commit is contained in:
parent
898e3add26
commit
ccd507594b
3 changed files with 10 additions and 11 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
14
src/menu.rs
14
src/menu.rs
|
|
@ -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))
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue