mirror of
https://github.com/wez/wezterm.git
synced 2024-09-11 14:25:57 +03:00
Remove ResetViewport, add helper for keys
This commit is contained in:
parent
69e8971400
commit
2291040e88
@ -689,7 +689,6 @@ pub enum CopyModeAssignment {
|
|||||||
JumpBackward { prev_char: bool },
|
JumpBackward { prev_char: bool },
|
||||||
JumpAgain,
|
JumpAgain,
|
||||||
JumpReverse,
|
JumpReverse,
|
||||||
ResetViewport,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type KeyTable = HashMap<(KeyCode, Modifiers), KeyTableEntry>;
|
pub type KeyTable = HashMap<(KeyCode, Modifiers), KeyTableEntry>;
|
||||||
|
@ -17,8 +17,8 @@ return {
|
|||||||
action = act.CopyMode 'MoveToStartOfNextLine',
|
action = act.CopyMode 'MoveToStartOfNextLine',
|
||||||
},
|
},
|
||||||
{ key = 'Escape', mods = 'NONE', action = act.Multiple {
|
{ key = 'Escape', mods = 'NONE', action = act.Multiple {
|
||||||
|
{ CopyMode = 'ScrollToBottom' },
|
||||||
{ CopyMode = 'Close' },
|
{ CopyMode = 'Close' },
|
||||||
{ CopyMode = 'ResetViewport' },
|
|
||||||
} },
|
} },
|
||||||
{
|
{
|
||||||
key = 'Space',
|
key = 'Space',
|
||||||
@ -128,8 +128,8 @@ return {
|
|||||||
{ key = 'b', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
|
{ key = 'b', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
|
||||||
{ key = 'b', mods = 'CTRL', action = act.CopyMode 'PageUp' },
|
{ key = 'b', mods = 'CTRL', action = act.CopyMode 'PageUp' },
|
||||||
{ key = 'c', mods = 'CTRL', action = act.Multiple {
|
{ key = 'c', mods = 'CTRL', action = act.Multiple {
|
||||||
|
{ CopyMode = 'ScrollToBottom' },
|
||||||
{ CopyMode = 'Close' },
|
{ CopyMode = 'Close' },
|
||||||
{ CopyMode = 'ResetViewport' },
|
|
||||||
} },
|
} },
|
||||||
{
|
{
|
||||||
key = 'd',
|
key = 'd',
|
||||||
@ -154,8 +154,8 @@ return {
|
|||||||
action = act.CopyMode 'MoveToScrollbackTop',
|
action = act.CopyMode 'MoveToScrollbackTop',
|
||||||
},
|
},
|
||||||
{ key = 'g', mods = 'CTRL', action = act.Multiple {
|
{ key = 'g', mods = 'CTRL', action = act.Multiple {
|
||||||
|
{ CopyMode = 'ScrollToBottom' },
|
||||||
{ CopyMode = 'Close' },
|
{ CopyMode = 'Close' },
|
||||||
{ CopyMode = 'ResetViewport' },
|
|
||||||
} },
|
} },
|
||||||
{ key = 'h', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
|
{ key = 'h', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
|
||||||
{ key = 'j', mods = 'NONE', action = act.CopyMode 'MoveDown' },
|
{ key = 'j', mods = 'NONE', action = act.CopyMode 'MoveDown' },
|
||||||
@ -172,8 +172,8 @@ return {
|
|||||||
action = act.CopyMode 'MoveToSelectionOtherEnd',
|
action = act.CopyMode 'MoveToSelectionOtherEnd',
|
||||||
},
|
},
|
||||||
{ key = 'q', mods = 'NONE', action = act.Multiple {
|
{ key = 'q', mods = 'NONE', action = act.Multiple {
|
||||||
|
{ CopyMode = 'ScrollToBottom' },
|
||||||
{ CopyMode = 'Close' },
|
{ CopyMode = 'Close' },
|
||||||
{ CopyMode = 'ResetViewport' },
|
|
||||||
} },
|
} },
|
||||||
{
|
{
|
||||||
key = 't',
|
key = 't',
|
||||||
@ -201,8 +201,8 @@ return {
|
|||||||
mods = 'NONE',
|
mods = 'NONE',
|
||||||
action = act.Multiple {
|
action = act.Multiple {
|
||||||
{ CopyTo = 'ClipboardAndPrimarySelection' },
|
{ CopyTo = 'ClipboardAndPrimarySelection' },
|
||||||
|
{ CopyMode = 'ScrollToBottom' },
|
||||||
{ CopyMode = 'Close' },
|
{ CopyMode = 'Close' },
|
||||||
{ CopyMode = 'ResetViewport' },
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PageUp' },
|
{ key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PageUp' },
|
||||||
|
@ -1206,7 +1206,6 @@ impl Pane for CopyOverlay {
|
|||||||
JumpBackward { prev_char } => render.jump(false, *prev_char),
|
JumpBackward { prev_char } => render.jump(false, *prev_char),
|
||||||
JumpAgain => render.jump_again(false),
|
JumpAgain => render.jump_again(false),
|
||||||
JumpReverse => render.jump_again(true),
|
JumpReverse => render.jump_again(true),
|
||||||
ResetViewport => render.set_viewport(None),
|
|
||||||
}
|
}
|
||||||
PerformAssignmentResult::Handled
|
PerformAssignmentResult::Handled
|
||||||
}
|
}
|
||||||
@ -1574,40 +1573,35 @@ pub fn search_key_table() -> KeyTable {
|
|||||||
table
|
table
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn scroll_to_bottom_and_close() -> KeyAssignment {
|
||||||
|
KeyAssignment::Multiple(vec![
|
||||||
|
KeyAssignment::ScrollToBottom,
|
||||||
|
KeyAssignment::CopyMode(CopyModeAssignment::Close),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
pub fn copy_key_table() -> KeyTable {
|
pub fn copy_key_table() -> KeyTable {
|
||||||
let mut table = KeyTable::default();
|
let mut table = KeyTable::default();
|
||||||
for (key, mods, action) in [
|
for (key, mods, action) in [
|
||||||
(
|
(
|
||||||
WKeyCode::Char('c'),
|
WKeyCode::Char('c'),
|
||||||
Modifiers::CTRL,
|
Modifiers::CTRL,
|
||||||
KeyAssignment::Multiple(vec![
|
scroll_to_bottom_and_close(),
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::Close),
|
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::ResetViewport),
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
WKeyCode::Char('g'),
|
WKeyCode::Char('g'),
|
||||||
Modifiers::CTRL,
|
Modifiers::CTRL,
|
||||||
KeyAssignment::Multiple(vec![
|
scroll_to_bottom_and_close(),
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::Close),
|
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::ResetViewport),
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
WKeyCode::Char('q'),
|
WKeyCode::Char('q'),
|
||||||
Modifiers::NONE,
|
Modifiers::NONE,
|
||||||
KeyAssignment::Multiple(vec![
|
scroll_to_bottom_and_close(),
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::Close),
|
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::ResetViewport),
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
WKeyCode::Char('\x1b'),
|
WKeyCode::Char('\x1b'),
|
||||||
Modifiers::NONE,
|
Modifiers::NONE,
|
||||||
KeyAssignment::Multiple(vec![
|
scroll_to_bottom_and_close(),
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::Close),
|
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::ResetViewport),
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
WKeyCode::Char('h'),
|
WKeyCode::Char('h'),
|
||||||
@ -1859,8 +1853,7 @@ pub fn copy_key_table() -> KeyTable {
|
|||||||
Modifiers::NONE,
|
Modifiers::NONE,
|
||||||
KeyAssignment::Multiple(vec![
|
KeyAssignment::Multiple(vec![
|
||||||
KeyAssignment::CopyTo(ClipboardCopyDestination::ClipboardAndPrimarySelection),
|
KeyAssignment::CopyTo(ClipboardCopyDestination::ClipboardAndPrimarySelection),
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::Close),
|
scroll_to_bottom_and_close(),
|
||||||
KeyAssignment::CopyMode(CopyModeAssignment::ResetViewport),
|
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user