mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
core: only adjust selection on keypress
This commit is contained in:
1
TODO.md
1
TODO.md
@ -25,3 +25,4 @@ paged-terminal branch:
|
||||
|
||||
- tests and logic for overflowing page capacities:
|
||||
* graphemes
|
||||
- there is some bug around adjusting selection up out of viewport
|
||||
|
@ -1360,6 +1360,11 @@ pub fn keyCallback(
|
||||
defer self.renderer_state.mutex.unlock();
|
||||
var screen = self.io.terminal.screen;
|
||||
const sel = if (screen.selection) |*sel| sel else break :adjust_selection;
|
||||
|
||||
// Silently consume key releases. We only want to process selection
|
||||
// adjust on press.
|
||||
if (event.action != .press and event.action != .repeat) return .consumed;
|
||||
|
||||
sel.adjust(&screen, switch (event.key) {
|
||||
.left => .left,
|
||||
.right => .right,
|
||||
@ -1372,9 +1377,6 @@ pub fn keyCallback(
|
||||
else => break :adjust_selection,
|
||||
});
|
||||
|
||||
// Silently consume key releases.
|
||||
if (event.action != .press and event.action != .repeat) return .consumed;
|
||||
|
||||
// If the selection endpoint is outside of the current viewpoint,
|
||||
// scroll it in to view.
|
||||
// TODO(paged-terminal)
|
||||
|
Reference in New Issue
Block a user