mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 01:06:08 +03:00
Merge pull request #1576 from mitchellh/undefined
core: remove undefined access on variable
This commit is contained in:
@ -2799,8 +2799,9 @@ fn dragLeftClickSingle(
|
|||||||
// Resets the selection if we switched directions, depending on the select
|
// Resets the selection if we switched directions, depending on the select
|
||||||
// mode. See dragLeftClickSingle for more details.
|
// mode. See dragLeftClickSingle for more details.
|
||||||
fn checkResetSelSwitch(self: *Surface, screen_point: terminal.point.ScreenPoint) void {
|
fn checkResetSelSwitch(self: *Surface, screen_point: terminal.point.ScreenPoint) void {
|
||||||
var reset: bool = undefined;
|
const sel = self.io.terminal.screen.selection orelse return;
|
||||||
if (self.io.terminal.screen.selection) |sel| {
|
|
||||||
|
var reset: bool = false;
|
||||||
if (sel.rectangle) {
|
if (sel.rectangle) {
|
||||||
// When we're in rectangle mode, we reset the selection relative to
|
// When we're in rectangle mode, we reset the selection relative to
|
||||||
// the click point depending on the selection mode we're in, with
|
// the click point depending on the selection mode we're in, with
|
||||||
@ -2824,10 +2825,8 @@ fn checkResetSelSwitch(self: *Surface, screen_point: terminal.point.ScreenPoint)
|
|||||||
else
|
else
|
||||||
screen_point.before(sel.start);
|
screen_point.before(sel.start);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (reset)
|
if (reset) self.setSelection(null);
|
||||||
self.setSelection(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handles how whether or not the drag screen point is before the click point.
|
// Handles how whether or not the drag screen point is before the click point.
|
||||||
|
Reference in New Issue
Block a user