summaryrefslogtreecommitdiff
path: root/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'main.zig')
-rw-r--r--main.zig23
1 files changed, 4 insertions, 19 deletions
diff --git a/main.zig b/main.zig
index 184b1058..93c3324e 100644
--- a/main.zig
+++ b/main.zig
@@ -2629,8 +2629,9 @@ pub fn main(init: std.process.Init) !void {
var drain_pty_after = false;
switch (event) {
.mouse => |mouse| {
- const mcol: u16 = if (mouse.col < 0) 0 else @min(@as(u16, @intCast(mouse.col)), screen_w -| 1);
- const mrow: u16 = if (mouse.row < 0) 0 else @min(@as(u16, @intCast(mouse.row)), screen_h -| 1);
+ const mpos = pane_ui.clampMousePos(screen_w, screen_h, mouse);
+ const mcol = mpos.col;
+ const mrow = mpos.row;
hover_col = mcol;
hover_row = mrow;
@@ -3155,23 +3156,7 @@ pub fn main(init: std.process.Init) !void {
// resize-handle hint: overlay a dash on the boundary cells, keeping their
// colors (only the glyph changes). Shown while dragging a border and, in the
// else branch, on hover.
- switch (drag) {
- .border_v => |d| {
- pane_ui.drawBorderV(win, d.cur_x, screen_h);
- },
- .border_h => |d| {
- pane_ui.drawBorderH(win, col_x[d.col], col_w[d.col], d.cur_y);
- },
- .move => |d| {
- pane_ui.drawMovePreview(win, &layout, &col_x, &col_w, d.cur_x, d.cur_y, gray.mid);
- },
- else => {
- // not dragging: hint the resize handle under the cursor with the same
- // dash overlay. Vertical = the left pane's last column; horizontal =
- // the upper pane's last row (a's own last line, just above b's tag).
- pane_ui.drawHoverResizeHints(win, &layout, &rects, &col_x, &col_w, screen_h, hover_col, hover_row);
- },
- }
+ pane_ui.drawInteractionPreview(win, &layout, &rects, &col_x, &col_w, screen_h, drag, hover_col, hover_row, gray.mid);
// debug overlay: a small virtual-text box drawn last, on top of everything.
// ov_buf lives across vx.render() — vaxis keeps slices into it (retained).