summaryrefslogtreecommitdiff
path: root/src/mouse.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 19:21:22 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit2580dd5ea85d86262c94363dfea9f990eaf56196 (patch)
treef6ef730304b57653c1ecfe31fac99b7ac0b00cc7 /src/mouse.zig
parentb08322345b33abcee114c05c85fa4c46c10f4701 (diff)
downloadpardes-2580dd5ea85d86262c94363dfea9f990eaf56196.tar.gz
pardes-2580dd5ea85d86262c94363dfea9f990eaf56196.zip
Everything a B1 chord does while B1 is down is one undo step
B1-B2 then B1-B3 cut and pasted as two undo steps. acme marks the file once per B1 hold (text.c:881, textselect), so the pair is a copy. The chord now takes one undo point when it begins and its edits share it until B1 comes up. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/mouse.zig')
-rw-r--r--src/mouse.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mouse.zig b/src/mouse.zig
index ac3e206b..61bd30e0 100644
--- a/src/mouse.zig
+++ b/src/mouse.zig
@@ -790,6 +790,7 @@ fn dragRelease(p: *Pardes, button: Mouse.Button) void {
// stream; only the button which began this gesture may end it.
if (p.drag.button() != button) return;
defer p.drag = .none;
+ defer p.chord_hold = false;
switch (p.drag) {
.border_v => |d| {
const c = d.left_col;
@@ -1027,6 +1028,11 @@ fn chordCutPaste(p: *Pardes, cut: bool) void {
}
if (!s.chorded) {
s.chorded = true;
+ // Everything done while B1 stays down is one undo step, as acme
+ // marks the file once per B1 hold (text.c:881 textselect, `state`
+ // and its one filemark): B1-B2 then B1-B3 is a copy.
+ edit.pushUndo(p, &pane.body);
+ p.chord_hold = true;
const sl = pane.sel[sel_slot];
pane.sel[sel_slot].state = .none;
const pfx: i32 = if (pane.file != null) panes.File.gutterWidth(pane) else 0;