mouse: set mouse to text when bypassing mouse reporting

When shift is held, we are bypassing mouse reporting mode. Change the
cursor to text to indicate this to the user. On release, change back to
whatever we were before.
This commit is contained in:
Tim Culverhouse
2023-10-02 16:51:45 -05:00
committed by Mitchell Hashimoto
parent c96cedcf22
commit 9a64697433
2 changed files with 12 additions and 0 deletions

View File

@ -1121,6 +1121,17 @@ pub fn keyCallback(
self.hideMouse();
}
if (self.io.terminal.flags.mouse_event != .none and
event.physical_key == .left_shift or
event.physical_key == .right_shift)
{
switch (event.action) {
.press => try self.rt_surface.setMouseShape(.text),
.release => try self.rt_surface.setMouseShape(self.io.terminal.mouse_shape),
else => {},
}
}
// No binding, so we have to perform an encoding task. This
// may still result in no encoding. Under different modes and
// inputs there are many keybindings that result in no encoding

View File

@ -2024,6 +2024,7 @@ const StreamHandler = struct {
self: *StreamHandler,
shape: terminal.MouseShape,
) !void {
self.terminal.mouse_shape = shape;
_ = self.ev.surface_mailbox.push(.{
.set_mouse_shape = shape,
}, .{ .forever = {} });