diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:02:01 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:16:28 -0300 |
| commit | 4423bc2f88fe2e88202056d6a11f759b4b143b74 (patch) | |
| tree | 2e19a95e97a38088a288444b0e298251fe911506 /src/selection_pipe.zig | |
| parent | adc8a50289f17ba15867f6d8e45844f57ee1aaa8 (diff) | |
| download | pardes-4423bc2f88fe2e88202056d6a11f759b4b143b74.tar.gz pardes-4423bc2f88fe2e88202056d6a11f759b4b143b74.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/selection_pipe.zig')
| -rw-r--r-- | src/selection_pipe.zig | 16 |
1 files changed, 7 insertions, 9 deletions
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, |
