Add "Clear scrollback" action
This commit is contained in:
parent
29aa3b4027
commit
4beabca14d
6 changed files with 23 additions and 0 deletions
|
|
@ -83,6 +83,7 @@ copy = Kopieren
|
||||||
paste = Einfügen
|
paste = Einfügen
|
||||||
select-all = Alles auswählen
|
select-all = Alles auswählen
|
||||||
find = Suchen
|
find = Suchen
|
||||||
|
clear-scrollback = Scrollverlauf löschen
|
||||||
|
|
||||||
## Ansicht
|
## Ansicht
|
||||||
view = Ansicht
|
view = Ansicht
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ copy = Copy
|
||||||
paste = Paste
|
paste = Paste
|
||||||
select-all = Select all
|
select-all = Select all
|
||||||
find = Find
|
find = Find
|
||||||
|
clear-scrollback = Clear scrollback
|
||||||
|
|
||||||
## View
|
## View
|
||||||
view = View
|
view = View
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ copy = Copy
|
||||||
paste = Paste
|
paste = Paste
|
||||||
select-all = Select all
|
select-all = Select all
|
||||||
find = Find
|
find = Find
|
||||||
|
clear-scrollback = Clear scrollback
|
||||||
|
|
||||||
## View
|
## View
|
||||||
view = View
|
view = View
|
||||||
|
|
|
||||||
|
|
@ -75,5 +75,8 @@ pub fn key_binds() -> HashMap<KeyBind, Action> {
|
||||||
bind!([Ctrl, Shift], Key::Named(Named::ArrowRight), PaneFocusRight);
|
bind!([Ctrl, Shift], Key::Named(Named::ArrowRight), PaneFocusRight);
|
||||||
bind!([Ctrl, Shift], Key::Character("L".into()), PaneFocusRight);
|
bind!([Ctrl, Shift], Key::Character("L".into()), PaneFocusRight);
|
||||||
|
|
||||||
|
// CTRL+Alt+L clears the scrollback.
|
||||||
|
bind!([Ctrl, Alt], Key::Character("L".into()), ClearScrollback);
|
||||||
|
|
||||||
key_binds
|
key_binds
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
src/main.rs
13
src/main.rs
|
|
@ -180,6 +180,7 @@ pub struct Flags {
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
About,
|
About,
|
||||||
|
ClearScrollback,
|
||||||
ColorSchemes(ColorSchemeKind),
|
ColorSchemes(ColorSchemeKind),
|
||||||
Copy,
|
Copy,
|
||||||
CopyOrSigint,
|
CopyOrSigint,
|
||||||
|
|
@ -224,6 +225,7 @@ impl Action {
|
||||||
fn message(&self, entity_opt: Option<segmented_button::Entity>) -> Message {
|
fn message(&self, entity_opt: Option<segmented_button::Entity>) -> Message {
|
||||||
match self {
|
match self {
|
||||||
Self::About => Message::ToggleContextPage(ContextPage::About),
|
Self::About => Message::ToggleContextPage(ContextPage::About),
|
||||||
|
Self::ClearScrollback => Message::ClearScrollback(entity_opt),
|
||||||
Self::ColorSchemes(color_scheme_kind) => {
|
Self::ColorSchemes(color_scheme_kind) => {
|
||||||
Message::ToggleContextPage(ContextPage::ColorSchemes(*color_scheme_kind))
|
Message::ToggleContextPage(ContextPage::ColorSchemes(*color_scheme_kind))
|
||||||
}
|
}
|
||||||
|
|
@ -280,6 +282,7 @@ impl MenuAction for Action {
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
AppTheme(AppTheme),
|
AppTheme(AppTheme),
|
||||||
|
ClearScrollback(Option<segmented_button::Entity>),
|
||||||
ColorSchemeCollapse,
|
ColorSchemeCollapse,
|
||||||
ColorSchemeDelete(ColorSchemeKind, ColorSchemeId),
|
ColorSchemeDelete(ColorSchemeKind, ColorSchemeId),
|
||||||
ColorSchemeExpand(ColorSchemeKind, Option<ColorSchemeId>),
|
ColorSchemeExpand(ColorSchemeKind, Option<ColorSchemeId>),
|
||||||
|
|
@ -1576,6 +1579,16 @@ impl Application for App {
|
||||||
config_set!(app_theme, app_theme);
|
config_set!(app_theme, app_theme);
|
||||||
return self.update_config();
|
return self.update_config();
|
||||||
}
|
}
|
||||||
|
Message::ClearScrollback(entity_opt) => {
|
||||||
|
if let Some(tab_model) = self.pane_model.active() {
|
||||||
|
let entity = entity_opt.unwrap_or_else(|| tab_model.active());
|
||||||
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
|
let terminal = terminal.lock().unwrap();
|
||||||
|
let mut term = terminal.term.lock();
|
||||||
|
term.grid_mut().clear_history();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Message::ColorSchemeCollapse => {
|
Message::ColorSchemeCollapse => {
|
||||||
self.color_scheme_expanded = None;
|
self.color_scheme_expanded = None;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ pub fn context_menu<'a>(
|
||||||
menu_item(fl!("paste"), Action::Paste),
|
menu_item(fl!("paste"), Action::Paste),
|
||||||
menu_item(fl!("select-all"), Action::SelectAll),
|
menu_item(fl!("select-all"), Action::SelectAll),
|
||||||
horizontal_rule(1),
|
horizontal_rule(1),
|
||||||
|
menu_item(fl!("clear-scrollback"), Action::ClearScrollback),
|
||||||
|
horizontal_rule(1),
|
||||||
menu_item(fl!("split-horizontal"), Action::PaneSplitHorizontal),
|
menu_item(fl!("split-horizontal"), Action::PaneSplitHorizontal),
|
||||||
menu_item(fl!("split-vertical"), Action::PaneSplitVertical),
|
menu_item(fl!("split-vertical"), Action::PaneSplitVertical),
|
||||||
menu_item(fl!("pane-toggle-maximize"), Action::PaneToggleMaximized),
|
menu_item(fl!("pane-toggle-maximize"), Action::PaneToggleMaximized),
|
||||||
|
|
@ -178,6 +180,8 @@ pub fn menu_bar<'a>(config: &Config, key_binds: &HashMap<KeyBind, Action>) -> El
|
||||||
MenuItem::Button(fl!("paste"), Action::Paste),
|
MenuItem::Button(fl!("paste"), Action::Paste),
|
||||||
MenuItem::Button(fl!("select-all"), Action::SelectAll),
|
MenuItem::Button(fl!("select-all"), Action::SelectAll),
|
||||||
MenuItem::Divider,
|
MenuItem::Divider,
|
||||||
|
MenuItem::Button(fl!("clear-scrollback"), Action::ClearScrollback),
|
||||||
|
MenuItem::Divider,
|
||||||
MenuItem::Button(fl!("find"), Action::Find),
|
MenuItem::Button(fl!("find"), Action::Find),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue