1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2025-04-21 18:02:37 -04:00

Don't switch semantic/line selection when control is pressed

Changing block selection to regular semantic one doesn't feel intuitive,
thus don't switch to it when user has control pressed.
This commit is contained in:
Kirill Chibisov 2024-12-29 00:47:47 +03:00 committed by GitHub
parent 62d5b134b3
commit 7bd3b8991c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 12 deletions

View file

@ -18,6 +18,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its
### Changed
- Always focus new windows on macOS
- Don't switch to semantic/line selection when control is pressed
### Fixed

View file

@ -1183,17 +1183,13 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
/// Expand the selection to the current mouse cursor position.
#[inline]
fn expand_selection(&mut self) {
let control = self.modifiers().state().control_key();
let selection_type = match self.mouse().click_state {
ClickState::Click => {
if self.modifiers().state().control_key() {
SelectionType::Block
} else {
SelectionType::Simple
}
},
ClickState::None => return,
_ if control => SelectionType::Block,
ClickState::Click => SelectionType::Simple,
ClickState::DoubleClick => SelectionType::Semantic,
ClickState::TripleClick => SelectionType::Lines,
ClickState::None => return,
};
// Load mouse point, treating message bar and padding as the closest cell.

View file

@ -637,6 +637,7 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
/// Handle left click selection and vi mode cursor movement.
fn on_left_click(&mut self, point: Point) {
let side = self.ctx.mouse().cell_side;
let control = self.ctx.modifiers().state().control_key();
match self.ctx.mouse().click_state {
ClickState::Click => {
@ -646,21 +647,21 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
self.ctx.clear_selection();
// Start new empty selection.
if self.ctx.modifiers().state().control_key() {
if control {
self.ctx.start_selection(SelectionType::Block, point, side);
} else {
self.ctx.start_selection(SelectionType::Simple, point, side);
}
},
ClickState::DoubleClick => {
ClickState::DoubleClick if !control => {
self.ctx.mouse_mut().block_hint_launcher = true;
self.ctx.start_selection(SelectionType::Semantic, point, side);
},
ClickState::TripleClick => {
ClickState::TripleClick if !control => {
self.ctx.mouse_mut().block_hint_launcher = true;
self.ctx.start_selection(SelectionType::Lines, point, side);
},
ClickState::None => (),
_ => (),
};
// Move vi mode cursor to mouse click position.