fix selection clearing after a key press

This commit is contained in:
Burak Yildiz
2023-11-27 21:03:24 +01:00
parent 1a813280a2
commit 44a3b22db8

View File

@ -1249,11 +1249,11 @@ pub fn keyCallback(
// If our event is any keypress that isn't a modifier and we generated // If our event is any keypress that isn't a modifier and we generated
// some data to send to the pty, then we move the viewport down to the // some data to send to the pty, then we move the viewport down to the
// bottom. If we generated literal text, then we also clear the selection. // bottom. We also clear the selection for any key other then modifiers.
if (!event.key.modifier()) { if (!event.key.modifier()) {
self.renderer_state.mutex.lock(); self.renderer_state.mutex.lock();
defer self.renderer_state.mutex.unlock(); defer self.renderer_state.mutex.unlock();
if (event.utf8.len > 0) self.setSelection(null); self.setSelection(null);
try self.io.terminal.scrollViewport(.{ .bottom = {} }); try self.io.terminal.scrollViewport(.{ .bottom = {} });
try self.queueRender(); try self.queueRender();
} }