summaryrefslogtreecommitdiff
path: root/dev/tui/tui.zig
diff options
context:
space:
mode:
Diffstat (limited to 'dev/tui/tui.zig')
-rw-r--r--dev/tui/tui.zig19
1 files changed, 13 insertions, 6 deletions
diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig
index f0011273..e2cdd2fa 100644
--- a/dev/tui/tui.zig
+++ b/dev/tui/tui.zig
@@ -1572,11 +1572,9 @@ const Shell = struct {
var motion: ?Msg = null;
var ev = first;
while (true) {
- if (s.split(ev)) break;
+ if (s.split(ev, motion)) break;
if (ev == .mouse and (ev.mouse.type == .motion or ev.mouse.type == .drag)) {
- if (motion) |m| if (m.mouse.button != ev.mouse.button or m.mouse.type != ev.mouse.type or
- @as(u3, @bitCast(m.mouse.mods)) != @as(u3, @bitCast(ev.mouse.mods)))
- {
+ if (motion) |m| if (!movesOn(m, ev)) {
_ = s.apply(m);
};
motion = ev;
@@ -1605,14 +1603,16 @@ const Shell = struct {
/// a person's input, and none after a pty's output: a step reads the
/// terminals as the clients' deltas bring them, sent after each unit
/// (docs/next-daemon.md, part B terminal notes). One that must wait is
- /// held for the next. Whether `ev` is.
- fn split(s: *Shell, ev: Msg) bool {
+ /// held for the next. Whether `ev` is; a motion that goes on this
+ /// wait's run of them (`streak`) is that one input, its last.
+ fn split(s: *Shell, ev: Msg, streak: ?Msg) bool {
if (!s.peers.recording) return false;
switch (ev) {
.key_press => if (s.in_paste) return false,
.mouse, .paste, .paste_end, .reply_dropped, .winsize, .focus_in, .focus_out => {},
else => return false,
}
+ if (streak) |m| if (movesOn(m, ev)) return false;
if (s.took_output or s.took_input) {
s.held = ev;
s.input_seen = true;
@@ -1622,6 +1622,13 @@ const Shell = struct {
return false;
}
+ /// Whether `ev` goes on the motion `streak`: one move to its last cell
+ /// (the same button, kind and modifiers).
+ fn movesOn(streak: Msg, ev: Msg) bool {
+ return ev == .mouse and ev.mouse.type == streak.mouse.type and ev.mouse.button == streak.mouse.button and
+ @as(u3, @bitCast(ev.mouse.mods)) == @as(u3, @bitCast(streak.mouse.mods));
+ }
+
fn apply(s: *Shell, event: Msg) bool {
const core = s.core;
const tz_event = tracy.zone(@src(), "event");