1 parent
01f587d1d0
commit
c964b69b1d
4 files changed
+38
No files matched your search
@@ -174,6 +174,7 @@ pub enum KeyAssignment {
|
||||
MoveTabRelative(isize),
|
||||
MoveTab(usize),
|
||||
ScrollByPage(isize),
|
||||
ScrollByLine(isize),
|
||||
ScrollToPrompt(isize),
|
||||
ShowTabNavigator,
|
||||
HideApplication,
|
||||
|
||||
@@ -21,6 +21,7 @@ brief notes about them may accumulate here.
|
||||
* Wayland: fixed an issue where key repeat processing could "run away" and hang the application
|
||||
* New: added [foreground_text_hsb](config/lua/config/foreground_text_hsb.md) setting to adjust hue, saturation and brightness when text is rendered.
|
||||
* New: added [ResetFontAndWindowSize](config/lua/keyassignment/ResetFontAndWindowSize.md) key assignment.
|
||||
* New: added [ScrollByLine](config/lua/keyassignment/ScrollByLine.md) key assignment.
|
||||
|
||||
### 20210203-095643-70a364eb
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# ScrollByLine
|
||||
|
||||
*Since: nightly*
|
||||
|
||||
Adjusts the scroll position by the number of lines specified by the argument.
|
||||
Negative values scroll upwards, while positive values scroll downwards.
|
||||
|
||||
```lua
|
||||
local wezterm = require 'wezterm';
|
||||
|
||||
return {
|
||||
keys = {
|
||||
{key="UpArrow", mods="SHIFT", action=wezterm.action{ScrollByLine=-1}},
|
||||
{key="DownArrow", mods="SHIFT", action=wezterm.action{ScrollByLine=1}},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1655,6 +1655,23 @@ impl TermWindow {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn scroll_by_line(&mut self, amount: isize) -> anyhow::Result<()> {
|
||||
let pane = match self.get_active_pane_or_overlay() {
|
||||
Some(pane) => pane,
|
||||
None => return Ok(()),
|
||||
};
|
||||
let dims = pane.get_dimensions();
|
||||
let position = self
|
||||
.get_viewport(pane.pane_id())
|
||||
.unwrap_or(dims.physical_top)
|
||||
.saturating_add(amount);
|
||||
self.set_viewport(pane.pane_id(), Some(position), dims);
|
||||
if let Some(win) = self.window.as_ref() {
|
||||
win.invalidate();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn move_tab_relative(&mut self, delta: isize) -> anyhow::Result<()> {
|
||||
let mux = Mux::get().unwrap();
|
||||
let window = mux
|
||||
@@ -2005,6 +2022,7 @@ impl TermWindow {
|
||||
MoveTab(n) => self.move_tab(*n)?,
|
||||
MoveTabRelative(n) => self.move_tab_relative(*n)?,
|
||||
ScrollByPage(n) => self.scroll_by_page(*n)?,
|
||||
ScrollByLine(n) => self.scroll_by_line(*n)?,
|
||||
ScrollToPrompt(n) => self.scroll_to_prompt(*n)?,
|
||||
ShowTabNavigator => self.show_tab_navigator(),
|
||||
ShowLauncher => self.show_launcher(),
|
||||
|
||||
Reference in new issue
Block a user