summaryrefslogtreecommitdiff
path: root/src/tty
diff options
context:
space:
mode:
Diffstat (limited to 'src/tty')
-rw-r--r--src/tty/tty.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig
index a067ffce..f0f41747 100644
--- a/src/tty/tty.zig
+++ b/src/tty/tty.zig
@@ -2452,6 +2452,9 @@ fn mouseEvent(m: vaxis.Mouse) ?pardes.Event {
.wheel_down => .wheel_down,
.wheel_left => .wheel_left,
.wheel_right => .wheel_right,
+ // A mouse's side buttons, as xterm reports them: Back and Forward.
+ .button_8 => .back,
+ .button_9 => .forward,
.none => .none, // button-less motion: hover tracking
else => return null,
};
@@ -2471,6 +2474,13 @@ fn mouseEvent(m: vaxis.Mouse) ?pardes.Event {
} };
}
+test "a mouse's side buttons, xterm's 8 and 9, are Back and Forward, as SDL's X1 and X2 are" {
+ for ([_]vaxis.Mouse.Button{ .button_8, .button_9 }, [_]pardes.Mouse.Button{ .back, .forward }) |from, to| {
+ const event = mouseEvent(.{ .col = 3, .row = 2, .button = from, .mods = .{}, .type = .press }).?;
+ try std.testing.expectEqual(to, event.mouse.button);
+ }
+}
+
/// A blank whose ink alone changed is not sent: vaxis's render skips it
/// (pardes's patch to Vaxis.zig in build.zig), since a blank's ink shows
/// nowhere. Deciding that here cost every cell of every frame a look at the