mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 21:32:13 +03:00
wezterm: add ClearScrollback key assignment
Bound to CMD-K and CTRL+SHIFT-K by default. This also functions while the output is filling up (eg: `find /` and hit the key binding to keep pruning the scrollback). closes: https://github.com/wez/wezterm/issues/194
This commit is contained in:
parent
33e387be7d
commit
b8acbac113
@ -19,6 +19,7 @@ brief notes about them may accumulate here.
|
||||
followed an example from the docs; migrate instead to using eg:
|
||||
`action=wezterm.action{ActivateTab=i-1}` to pass the integer argument.
|
||||
* Windows: now also available with a setup.exe installer
|
||||
* Added `ClearScrollback` key assignment to clear the scrollback. This is bound to CMD-K and CTRL-SHIFT-K by default.
|
||||
|
||||
### 20200517-122836-92c201c6
|
||||
|
||||
|
@ -62,6 +62,8 @@ The default key bindings are:
|
||||
| `SUPER` | `r` | `ReloadConfiguration` |
|
||||
| `CTRL+SHIFT` | `R` | `ReloadConfiguration` |
|
||||
| `SUPER` | `h` | `HideApplication` (macOS only) |
|
||||
| `SUPER` | `k` | `ClearScrollback` |
|
||||
| `CTRL+SHIFT` | `K` | `ClearScrollback` |
|
||||
|
||||
## Default Mouse Assignments
|
||||
|
||||
@ -538,6 +540,19 @@ return {
|
||||
}
|
||||
```
|
||||
|
||||
## ClearScrollback
|
||||
|
||||
Clears the lines that have scrolled off the top of the viewport, resetting
|
||||
the scrollbar thumb to the full height of the window.
|
||||
|
||||
```lua
|
||||
return {
|
||||
keys = {
|
||||
{key="K", mods="CTRL|SHIFT", action="ClearScrollback"}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ReloadConfiguration
|
||||
|
||||
Explicitly reload the configuration.
|
||||
|
@ -1469,6 +1469,11 @@ impl TermWindow {
|
||||
window.invalidate();
|
||||
}
|
||||
}
|
||||
ClearScrollback => {
|
||||
tab.erase_scrollback();
|
||||
let window = self.window.as_ref().unwrap();
|
||||
window.invalidate();
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ pub enum KeyAssignment {
|
||||
SpawnCommandInNewTab(SpawnCommand),
|
||||
SpawnCommandInNewWindow(SpawnCommand),
|
||||
ShowLauncher,
|
||||
ClearScrollback,
|
||||
|
||||
SelectTextAtMouseCursor(SelectionMode),
|
||||
ExtendSelectionToMouseCursor(Option<SelectionMode>),
|
||||
@ -158,6 +159,8 @@ impl InputMap {
|
||||
[KeyModifiers::SUPER, KeyCode::Char('n'), SpawnWindow],
|
||||
[ctrl_shift, KeyCode::Char('M'), Hide],
|
||||
[ctrl_shift, KeyCode::Char('N'), SpawnWindow],
|
||||
[KeyModifiers::SUPER, KeyCode::Char('k'), ClearScrollback],
|
||||
[ctrl_shift, KeyCode::Char('K'), ClearScrollback],
|
||||
// Font size manipulation
|
||||
[KeyModifiers::CTRL, KeyCode::Char('-'), DecreaseFontSize],
|
||||
[KeyModifiers::CTRL, KeyCode::Char('0'), ResetFontSize],
|
||||
|
@ -91,6 +91,10 @@ impl Tab for LocalTab {
|
||||
self.domain_id
|
||||
}
|
||||
|
||||
fn erase_scrollback(&self) {
|
||||
self.terminal.borrow_mut().erase_scrollback();
|
||||
}
|
||||
|
||||
fn is_mouse_grabbed(&self) -> bool {
|
||||
self.terminal.borrow().is_mouse_grabbed()
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ pub trait Tab: Downcast {
|
||||
fn palette(&self) -> ColorPalette;
|
||||
fn domain_id(&self) -> DomainId;
|
||||
|
||||
fn erase_scrollback(&self) {}
|
||||
|
||||
/// Returns true if the terminal has grabbed the mouse and wants to
|
||||
/// give the embedded application a chance to process events.
|
||||
/// In practice this controls whether the gui will perform local
|
||||
|
@ -487,6 +487,10 @@ impl TerminalState {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn erase_scrollback(&mut self) {
|
||||
self.screen_mut().erase_scrollback();
|
||||
}
|
||||
|
||||
pub fn is_mouse_grabbed(&self) -> bool {
|
||||
self.sgr_mouse
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user