mirror of
https://github.com/wez/wezterm.git
synced 2024-11-11 03:27:05 +03:00
copy mode: pressing v while in v mode toggles off v mode. Add yank.
refs: https://github.com/wez/wezterm/discussions/2246 refs: https://github.com/wez/wezterm/issues/993#issuecomment-1118512595
This commit is contained in:
parent
7e3b35303c
commit
10121790df
@ -48,6 +48,8 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
* Improved search performance
|
||||
* Quickselect: now defaults to searching 1000 lines above and below the current viewport, making it faster and the labels shorter for users with a larger scrollback. A new `scope_lines` parameter to [QuickSelectArgs](config/lua/keyassignment/QuickSelectArgs.md) allows controlling the search region explicitly. Thanks to [@yyogo](https://github.com/yyogo) for the initial PR! [#1317](https://github.com/wez/wezterm/pull/1317)
|
||||
* OSC 10, 11 and 12 (Set Default Text Background, Default Text Foreground Color, and Text Cursor Color) now support setting the alpha component [#2313](https://github.com/wez/wezterm/issues/2313)
|
||||
* Copy Mode: setting the same selection mode a second time will now toggle off that mode and clear the selection, preserving the current position [#2246](https://github.com/wez/wezterm/discussions/2246)
|
||||
* Copy Mode: new default vim-style `y` "yank" key assignment will copy the selection and close copy mode
|
||||
|
||||
#### Fixed
|
||||
* [ActivateKeyTable](config/lua/keyassignment/ActivateKeyTable.md)'s `replace_current` field was not actually optional. Made it optional. [#2179](https://github.com/wez/wezterm/issues/2179)
|
||||
|
@ -1,7 +1,8 @@
|
||||
use crate::selection::{SelectionCoordinate, SelectionRange, SelectionX};
|
||||
use crate::termwindow::{TermWindow, TermWindowNotif};
|
||||
use config::keyassignment::{
|
||||
CopyModeAssignment, KeyAssignment, KeyTable, KeyTableEntry, ScrollbackEraseMode, SelectionMode,
|
||||
ClipboardCopyDestination, CopyModeAssignment, KeyAssignment, KeyTable, KeyTableEntry,
|
||||
ScrollbackEraseMode, SelectionMode,
|
||||
};
|
||||
use mux::domain::DomainId;
|
||||
use mux::pane::{Pane, PaneId, Pattern, SearchResult};
|
||||
@ -767,11 +768,18 @@ impl CopyRenderable {
|
||||
match mode {
|
||||
None => {
|
||||
self.start.take();
|
||||
self.clear_selection();
|
||||
}
|
||||
Some(mode) => {
|
||||
if self.start.is_none() {
|
||||
let coord = SelectionCoordinate::x_y(self.cursor.x, self.cursor.y);
|
||||
self.start.replace(coord);
|
||||
} else if self.selection_mode == *mode {
|
||||
// We have a selection and we're trying to set the same mode
|
||||
// again; consider this to be a toggle that clears the selection
|
||||
self.start.take();
|
||||
self.clear_selection();
|
||||
return;
|
||||
}
|
||||
self.selection_mode = *mode;
|
||||
self.select_to_cursor_pos();
|
||||
@ -1356,6 +1364,14 @@ pub fn copy_key_table() -> KeyTable {
|
||||
Modifiers::SHIFT,
|
||||
KeyAssignment::CopyMode(CopyModeAssignment::MoveToSelectionOtherEndHoriz),
|
||||
),
|
||||
(
|
||||
WKeyCode::Char('y'),
|
||||
Modifiers::NONE,
|
||||
KeyAssignment::Multiple(vec![
|
||||
KeyAssignment::CopyTo(ClipboardCopyDestination::ClipboardAndPrimarySelection),
|
||||
KeyAssignment::CopyMode(CopyModeAssignment::Close),
|
||||
]),
|
||||
),
|
||||
] {
|
||||
table.insert((key, mods), KeyTableEntry { action });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user