summaryrefslogtreecommitdiff
path: root/src/gui.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-07-06 21:08:40 -0300
committerGabriel Schneider <[email protected]>2026-08-01 15:02:07 -0300
commitf442004dcd8e91114765a918201ecabe99f69eeb (patch)
tree141d8991a753e82cb3d897c8a717230c2c82913e /src/gui.zig
parent49f8c696ea208d2653521699d77d7e8f48cac183 (diff)
downloadpardes-f442004dcd8e91114765a918201ecabe99f69eeb.tar.gz
pardes-f442004dcd8e91114765a918201ecabe99f69eeb.zip
horizontal scroll for file panes (terminals wrap at pty width — nothing to scroll): pane.hscroll cuts content columns after the lineno gutter in bodyText (post edit-splice, so typed runs shift with the text), no scrollbar. Drivers: horizontal wheel (new wheel_left/right Mouse.Buttons, SGR 66/67 via vaxis on the tty, SDL wheel.x on the gui, ±4 cols, clamped at 0, right overscroll allowed) and keyboard movement — ensureCursorVisible grew the horizontal mirror of the scrolloff reconcile, so $ pulls the view right with 3 columns of margin and 0 reels it home; the wheel never moves the cursor. Shifted alongside: syntax recolor pass, modal cursor paint (hidden when off-view), vsel highlight, click->content-col mapping, cursorWordSel. Byte columns like the rest of the file-pane code. New hscroll.snap golden: wheel shift with fixed gutter, left clamp, $ margin follow, 0 home. 30/30.
Diffstat (limited to 'src/gui.zig')
-rw-r--r--src/gui.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui.zig b/src/gui.zig
index 15631efa..60d9501f 100644
--- a/src/gui.zig
+++ b/src/gui.zig
@@ -1080,6 +1080,8 @@ const StdinFeed = struct {
.right => .right,
.wheel_up => .wheel_up,
.wheel_down => .wheel_down,
+ .wheel_left => .wheel_left,
+ .wheel_right => .wheel_right,
.none => .none,
else => null,
};
@@ -1266,16 +1268,22 @@ fn dispatch(g: *Gui, core: *pardes.Pardes, sev: *const c.SDL_Event) void {
},
c.SDL_EVENT_MOUSE_WHEEL => {
const w = sev.wheel;
- if (w.y == 0) return;
+ if (w.y == 0 and w.x == 0) return;
g.mouse_x = w.mouse_x;
g.mouse_y = w.mouse_y;
const mc = mouseCell(g, core, w.mouse_x, w.mouse_y);
- core.update(.{ .mouse = .{
+ if (w.y != 0) core.update(.{ .mouse = .{
.button = if (w.y > 0) .wheel_up else .wheel_down,
.kind = .press,
.col = mc.col,
.row = mc.row,
} });
+ if (w.x != 0) core.update(.{ .mouse = .{
+ .button = if (w.x > 0) .wheel_right else .wheel_left,
+ .kind = .press,
+ .col = mc.col,
+ .row = mc.row,
+ } });
},
c.SDL_EVENT_FINGER_DOWN, c.SDL_EVENT_FINGER_MOTION, c.SDL_EVENT_FINGER_UP, c.SDL_EVENT_FINGER_CANCELED => {
const f = sev.tfinger;