Use Surface.hasSelection()

This commit is contained in:
Justin Su
2024-07-28 19:43:36 -04:00
parent 874c4e13d2
commit 32961d3e97

View File

@@ -2152,13 +2152,7 @@ pub fn mouseButtonCallback(
// Checking for selection requires the renderer state mutex which // Checking for selection requires the renderer state mutex which
// sucks but this should be pretty rare of an event so it won't // sucks but this should be pretty rare of an event so it won't
// cause a ton of contention. // cause a ton of contention.
const selection = selection: { if (self.hasSelection()) {
self.renderer_state.mutex.lock();
defer self.renderer_state.mutex.unlock();
break :selection self.io.terminal.screen.selection != null;
};
if (selection) {
const pos = try self.rt_surface.getCursorPos(); const pos = try self.rt_surface.getCursorPos();
try self.cursorPosCallback(pos); try self.cursorPosCallback(pos);
return true; return true;