core: on right click, only create selection if point isn't in prev sel

This commit is contained in:
Mitchell Hashimoto
2024-06-30 10:24:53 -07:00
parent a586eb9889
commit 32588a647f

View File

@ -2433,6 +2433,15 @@ pub fn mouseButtonCallback(
break :pin pin;
};
// If we already have a selection and the selection contains
// where we clicked then we don't want to modify the selection.
if (self.io.terminal.screen.selection) |prev_sel| {
if (prev_sel.contains(screen, pin)) break :sel;
// The selection doesn't contain our pin, so we create a new
// word selection where we clicked.
}
const sel = screen.selectWord(pin) orelse break :sel;
try self.setSelection(sel);
try self.queueRender();