From 4423bc2f88fe2e88202056d6a11f759b4b143b74 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:02:01 -0300 Subject: modal, selection_pipe, syntax, sam_edit: helpers used once are inlined where they are used (consumeCount, clampLineCol, codepointAtCursor, isWordBoundary, wmIsPrev, tokenStopped, dropDiffPieces, Exec.text), and moveWord's doc comment goes back above moveWord Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/selection_pipe.zig | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/selection_pipe.zig') diff --git a/src/selection_pipe.zig b/src/selection_pipe.zig index 207d45c2..7bb919e1 100644 --- a/src/selection_pipe.zig +++ b/src/selection_pipe.zig @@ -505,12 +505,6 @@ pub fn runIn( return .{ .ok = stdout }; } -fn tokenStopped(token: u32) bool { - Running.take(); - defer Running.lock.unlock(); - return Running.isStopped(token); -} - /// Invoke the command independently for every selection. The response is all /// or nothing: one failure frees every earlier stdout and returns a failed, /// empty answer for the core to ignore. @@ -522,9 +516,13 @@ pub fn runJob(gpa: std.mem.Allocator, io: std.Io, job: *const Job) Response { for (job.inputs, 0..) |input, i| { const command = if (job.commands.len > 0) job.commands[i] else job.command; const cwd = if (job.cwds.len > 0) job.cwds[i] else job.cwd; - if (job.token != 0 and tokenStopped(job.token)) { - response.failure = .{ .kind = .signal, .index = @intCast(i) }; - break; + if (job.token != 0) { + Running.take(); + defer Running.lock.unlock(); + if (Running.isStopped(job.token)) { + response.failure = .{ .kind = .signal, .index = @intCast(i) }; + break; + } } const output = switch (runIn(gpa, io, job.shell, command, cwd, input, job.token, job.env)) { .ok => |bytes| bytes, -- cgit v1.3