`_skim_complete` handed its candidates to skim through a fifo at the fixed
path `$TMPDIR/skim-complete-fifo-$$`, created by `_skim_feed_fifo` and fed by
a backgrounded `cat`. Opening a fifo for reading blocks until a writer opens
the other end, so if the feeder ever fails to get there -- it dies, or a stale
fifo left behind by an interrupted completion makes `mkfifo` fail, or the
leftover in the world-writable temp dir belongs to someone else -- the widget
blocks forever with nothing drawn and no way to interrupt it. Interrupted
completions also leaked the fifos that set this up.
That rendezvous is the only step of the completion path that can block
indefinitely, and `kill` is the only completion that reaches it without the
`**` trigger, so `kill<TAB>` is where it surfaces.
The fifo is not needed in the first place: the `_skim_complete_*` helpers pass
their candidates on `_skim_complete`'s stdin, and the command substitution that
runs skim inherits fd 0, so skim can read them directly. (fzf relays through a
fifo because its completion functions cannot pass their own stdin along; this
file is zsh-only and has no such constraint.)
Verified in a pty, in tmux and under kitty that `kill`, `ssh`, `export`,
`unset`, `unalias` and the path/dir completions all still populate skim,
that multi-select still runs through the `_post` filters (`kill<TAB>` still
inserts bare PIDs), and that no fifos are left in the temp dir.
Refs: https://github.com/skim-rs/skim/issues/1161
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFgaE1MjSaUGAGtR4aqVzT
* fix(field): saturate out-of-range field indices to i32 bounds
Replace unwrap_or(1)/unwrap_or(-1) with saturation to i32 bounds so out-of-range indices don't silently become field 1. Affects --nth, --with-nth, --hide-nth and {N} in --output-format.
* test(field): assert exit status and stderr for the output-format cases
Per review feedback: an empty stdout alone could pass if the placeholder
errored out instead of rendering empty.
---------
Co-authored-by: VXNCXNX <VXNCXNX@users.noreply.github.com>
`cursor_pos` is a byte offset, as `move_cursor_to` shows by validating it with
`is_char_boundary` and clamping to `value.len()`. `insert_str` advanced it by
`chars().count()` instead, so any multibyte input left the cursor inside the
text that was just inserted.
The single-char `insert` already uses `c.len_utf8()` and was unaffected.
Pasting (or committing from an IME) "中文" left the cursor at byte 3 instead of
6, so the next chunk landed between the two characters: "中文" + "测试" came out
as "中测试文". Pure ASCII input never hit this because there char count equals
byte length.
Co-authored-by: zhuyang <zhuyang@qunhemail.com>
Co-authored-by: LoricAndre <57358788+LoricAndre@users.noreply.github.com>
* test: replace tmux e2e harness with cross-platform Zellij harness
Rewrite the end-to-end test harness to drive `sk` through Zellij instead of
tmux, keeping the same capabilities and public surface (ZellijController,
Keys, wait, sk, the sk_test! DSL and the line!/keys!/out! helpers) so the
existing tests port over with only import/type renames.
Zellij has no detached-server model like tmux, so the harness spawns a Zellij
client attached to an in-process pseudo-terminal via portable-pty (openpty on
Unix, ConPTY on Windows). Because Zellij 0.44+ and portable-pty are both
cross-platform, the harness — and the tests that only rely on it — are now
available on Windows too: the interactive tests (formerly unix.rs) are
un-gated. execute.rs, popup.rs and listen.rs stay unix-only for reasons
unrelated to the multiplexer (PermissionsExt, a mock sh/tmux binary, unix
sockets).
Key harness details:
- Session per test via `zellij attach --create` on a fixed 80x24 PTY.
- Keys injected as raw terminal bytes with `zellij action write`; screen read
back with `zellij action dump-screen [--ansi]`, reversed to match the old
bottom-anchored indexing.
- A generated config disables startup tips, pane frames, mouse mode and — the
crucial bit — the kitty keyboard protocol, so injected legacy escape
sequences (arrows, etc.) reach sk.
- All zellij CLI calls are run under a timeout and wait() has a wall-clock
budget, so a wedged server surfaces as a fast retryable error instead of
hanging a test.
popup.rs unsets $ZELLIJ and sets $TMUX so skim selects its tmux popup backend
(the mock) rather than the zellij one while running inside a Zellij pane.
Because each test spins up a full Zellij session, the e2e binaries are put in
a serialized nextest test-group; CI installs Zellij (all three OSes) in place
of tmux, and the obsolete tmux setup-scripts are removed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* ci: fix rustfmt and stop Windows from cancelling the other nextest legs
- Run `cargo +nightly fmt` on the new Zellij harness (rustfmt CI was red).
- Set `fail-fast: false` on the nextest matrix so a failing OS leg no longer
cancels the others, giving a clear pass/fail signal per platform.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* ci: install zellij via winget on Windows
taiki-e/install-action has no prebuilt Zellij binary for Windows and falls
back to `cargo install zellij`, which fails building openssl-sys from source
on the runner. Install via winget on Windows instead (taiki-e still handles
Linux/macOS), and expose winget's shim dir on PATH for the test step.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test/ci: address review feedback on the Zellij harness
- Pin the Windows winget Zellij install to 0.44.3 to match the Linux/macOS
runners (reproducible CI).
- Drop the unused `&locale` YAML anchor (actionlint flagged it).
- `wait` now surfaces the last predicate error on timeout instead of a
generic one, so a persistent failure keeps its diagnostic cause.
- `output_with_timeout` tears down the child and reader threads on a
`try_wait` error instead of leaking them.
- Add rustdoc to the public harness surface (`sk`, `wait`, `Keys`,
`ZellijController` and its methods).
Deliberately not changed: a non-zero `zellij` exit is still not treated as an
error (some `zellij action` calls exit non-zero in transient states — e.g.
inline `sk` viewport teardown — while returning usable output; propagating it
broke `inline_clear_on_exit`), and `to_lines` keeps trimming to preserve the
tmux-parity bottom-anchored indexing the ported tests rely on.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* ci: put the real zellij.exe dir on PATH for the Windows test step
The winget install succeeds, but its Links shim wasn't reliably visible to the
`cargo nextest` step's processes, so `which("zellij")` failed and every
interactive test panicked at setup. Locate the installed zellij.exe under the
WinGet Packages dir and add its directory to GITHUB_PATH instead, failing the
step loudly if it isn't found.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* ci: reload PATH from registry after the MSI zellij install on Windows
The winget Zellij package is an MSI installer that installs to Program Files
and updates the machine PATH in the registry, not a portable under
WinGet\Packages — so the previous "search Packages" lookup threw. Reload PATH
from the machine/user registry values (with a Program Files fallback), then
export zellij's directory via GITHUB_PATH for the test step.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test/ci: gate interactive e2e tests off Windows
Enabling the interactive tests on the Windows runner surfaced a real gap: the
PATH/install issues are fixed (winget install works), but under the Windows
runner's ConPTY the Zellij session never renders — dump-screen stays empty and
wait_ready times out with "pane not rendered yet" for every interactive test.
That's a harness-runtime gap on Windows (and sk's escape-code disambiguation on
Windows would be a further blocker), so gate interactive.rs `#![cfg(not(windows))]`
with a TODO, keeping the harness code cross-platform.
Since no Windows test now uses the harness, drop the winget Zellij install from
the Windows leg; Linux/macOS still install it via taiki-e. Adjust the docs that
claimed the e2e tests run on Windows.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): gate Zellij harness tests to Linux only
The Zellij-backed e2e harness renders reliably under the Linux CI runner,
but on the macOS and Windows runners the pane never comes up under their
PTY (`wait_ready` times out with "pane not rendered yet"). Restrict all
four e2e test files (interactive, execute, popup, listen) to
`#![cfg(target_os = "linux")]`, install Zellij only on the Linux runner,
and update the harness/agent/architecture docs to match.
The harness code stays cross-platform so macOS/Windows e2e can be
re-enabled once their runners render the session.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): make the Zellij harness render on macOS and Windows
The Zellij e2e harness previously only came up reliably on the Linux CI
runner; on macOS and Windows the pane never rendered and every e2e test
timed out with "pane not rendered yet". Root cause (surfaced by capturing
the Zellij client's PTY output): Zellij's client/server startup handshake
is racy — the client occasionally dies with "Received empty unknown from
server" and the session never renders. It's rare on Linux (flaky) but
frequent on the cold macOS/Windows runners.
Harden the harness so it renders everywhere instead of gating tests to
Linux:
- Detect a dead session fast (drain thread flags client PTY EOF) and
respawn a fresh session, up to SESSION_SPAWN_ATTEMPTS times, instead of
waiting out the whole render budget and failing.
- Resolve the pane's shell to an absolute `bash` path via `which`; the
Zellij server's own environment may not have `bash` on PATH on the
macOS/Windows runners, which would leave the pane with no shell to render.
- Nudge the client's terminal size until the server gives the pane a
non-zero geometry to render into (the initial size can be dropped under
ConPTY / a cold runner).
- Give the first render its own longer budget and, on timeout, surface a
tail of the Zellij client output for diagnosing runners we can't
reproduce locally.
Un-gate the tests accordingly: interactive.rs (pure harness) now runs on
Linux, macOS and Windows; execute.rs/popup.rs/listen.rs go back to
#![cfg(unix)] (Linux + macOS) — their Windows-incompatibility is POSIX
mock binaries / a unix socket, unrelated to the multiplexer. CI installs
Zellij on all three OSes (taiki-e on Linux/macOS, winget on Windows) and
the nextest job gets a 45-minute cap so a harness regression fails fast.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): fix macOS session-name rejection via short ZELLIJ_SOCKET_DIR
The macOS runner failed every Zellij e2e test at CLI-parse time:
error: Invalid value "skim_e2e_..." for '--session <SESSION>':
session name must be less than 0 characters
This is not the render race the previous commit addressed. Zellij places
each session's unix socket at `$ZELLIJ_SOCKET_DIR/<protocol>/<session>`,
and a unix socket path is length-capped by the OS (~104 bytes on macOS).
Zellij's default base is `$TMPDIR/zellij-<uid>`; on the macOS runners
`$TMPDIR` is a long `/var/folders/…` path that leaves ~0 bytes for the
session name, so Zellij rejects every name and the client exits before it
attaches (zellij-org/zellij#4211). Linux's short `/run`|`/tmp` base never
hits this, which is why it only failed on macOS.
- Export ZELLIJ_SOCKET_DIR=/tmp/skim-zj (a short base) on every zellij
invocation — the attached client, `action`, and `run` — so they share a
short socket path well under the cap on Linux and macOS alike.
- Shorten session names (`sk_<=10 chars_<6 rand>`): several were derived
from long test names (e.g. execute_interactive_child_keeps_receiving_
keys_fullscreen) and exceeded Zellij's ~36-char limit and ate socket
budget; the random suffix still keeps them unique.
Also fix a stale doc command in AGENTS.md (`cargo nextest --tests` ->
`cargo nextest run --tests`), per PR review.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): answer the DSR cursor-position probe so Windows renders
The Windows nextest leg hung on every interactive.rs e2e test:
Error: pane not rendered within 60s. zellij client output tail:
\u{1b}[6n
The captured client output was a single `ESC[6n` — a Device Status
Report requesting the cursor position. Under the Windows ConPTY the
Zellij client probes the terminal size by asking for the cursor position
and blocks until the terminal replies; on Unix the size comes from the
PTY ioctl, so the client never waits (which is why only Windows hung).
The harness owns the master PTY — it *is* the terminal — so the drain
thread now watches for `ESC[6n` and writes back a Cursor Position Report
(`ESC[24;80R`, reporting the 24x80 pane). This unblocks the client so the
pane renders. The reply is harmless on Linux/macOS (all 45 e2e tests
still pass there), keeping interactive.rs on all three platforms.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): address review nits in the Zellij harness
Follow-ups from PR review, none affecting the cross-platform fixes:
- zellij_socket_dir() now returns io::Result and propagates a
create_dir_all failure through run()/action()/spawn_once() instead of
swallowing it, so a socket-dir problem surfaces directly rather than as
a confusing downstream Zellij error.
- Fix a latent typo in the (currently unused) assert_line!/line! macro:
std::io::std::io::Error{,Kind} -> std::io::Error / std::io::ErrorKind,
so the macro compiles if a test ever uses it.
- tempfile() returns an InvalidData error instead of panicking on a
non-UTF-8 temp path.
Skipped the reviewer's suggestion to stop trimming captured output: the
trim is load-bearing. It drops Zellij's blank padding rows so capture()[0]
is the bottom content line that every test indexes against; stripping only
CR/LF would reintroduce ~20 empty rows and shift every index. No test
exercises intentionally-spaced items, so there is no real defect.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): silence unused_assignments warning in wait()
`last_err` was initialised to `None` and always overwritten before it
could be read, so the initial assignment was dead (unused_assignments
warning at the top of every test build). Return the current predicate
error directly on timeout instead of stashing it — same behaviour (the
most recent error is surfaced), no dead variable, no warning.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): wrap assert_line! timeout error to 120 columns
Pure formatting: split the Err/Error::new/format! construction in the
(rustfmt-skipped) assert_line! macro body across lines to satisfy the
repo's 120-column limit. No behaviour change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): guard against [-0] in the negative-index DSL macro
@method_neg_dispatch used `lines.len() >= $idx`, which is always true for
$idx == 0, so `@capture[-0]` would index `lines[lines.len()]` and panic.
Require `$idx > 0` in both the predicate and diagnostic paths so a `[-0]`
index falls through to the graceful "not enough lines" / "<no line>"
handling instead. No current test uses negative indices; this only closes
the latent edge case. Per PR review.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): use forward slashes for Windows paths in the bash command
With the DSR fix the Windows pane now renders and runs the command, which
surfaced the next issue: the harness drives a `bash` shell but embedded
native Windows paths (backslashes) into the command string. bash treats
`\` as an escape, so `.\target\release\sk.exe` collapsed to
`.targetreleasesk.exe` ("command not found") and the `C:\Users\...`
redirect/mv targets would mangle the same way.
Convert `\` to `/` for the `sk` binary and the outfile when building the
bash command in sk(); bash on Windows accepts `./target/release/sk.exe`
and `C:/Users/...`. On Unix the paths have no backslashes so it is a
no-op, and the stored outfile the test reads back keeps native separators.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
* test(e2e): reap the Zellij client child in Drop
ZellijController::drop killed the client with child.kill() but never
waited on it, so on Unix each dropped controller left a zombie until the
test binary exited — and many controllers are created per binary. Pair
the kill with child.wait() (matching output_with_timeout) so the process
is reaped immediately. Per PR review.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wTqRsi31RYJXEM3ZZQhQU
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Add `start` and `load` events alongside `change`
Introduce `start` and `load` bindable events, mirroring the existing
`change` event, so `--bind start:<action>` and `--bind load:<action>`
work.
To avoid scattering magic high-F-key literals (`F(255)` for `change`),
add a `SkimEvent` enum in `binds.rs` with `Start`, `Load` and `Change`
variants that transparently convert to the reserved `KeyEvent`s used to
route them through the keymap. `parse_key` now accepts the friendly
names `start`, `load` and `change` via `SkimEvent::from_name`. The keymap
key type stays `KeyEvent`, so the public API is unchanged.
Firing:
- `change` is emitted by `on_query_changed` (now via the named variant).
- `start` fires exactly once when skim enters its event loop
(`Skim::fire_start_event`).
- `load` fires once the reader has finished AND the freshly-read items
have been rendered into the list, so a `load` binding acts on a
fully-populated, stable list. It is re-armed on `reload`.
Add unit coverage for the event-name round-trip and integration tests
for `start` and `load` bindings, and document the events in
ARCHITECTURE.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QKxusGbxLxqWdYyeqrb68
* Add result/focus/zero/one events and action follow-up bindings
Extend the bindable-event set and generalise binding so that actions can
themselves be bound.
New finder events (fired from the post-draw `Event::Render` path, so a
binding sees a stable, up-to-date list):
- `result` — filtering for the current query completed
- `focus` — the focused item changed (cursor move or result update)
- `zero` — a completed search has no matches
- `one` — a completed search has exactly one match
`zero`/`one` read `MatcherControl::get_num_matched()` rather than the
rendered list count, which can briefly lag the matcher.
Actions as events: any action can be bound as if it were an event, so a
follow-up chain runs after it (e.g. `reload:first`, `first:last`). This is
parsed by `parse_action_binds` into `SkimOptions::action_binds` (keyed by
`Action::name`) and applied in `handle_action`, which now wraps the
per-variant `dispatch_action`.
- Keys win: a name shared by a key and an action binds the key; use an
`act-` prefix to target the action (`act-up:down`).
- New `skip` action suppresses the triggering action's own behaviour, so
`act-up:skip+down` remaps the up action to down and `up:skip` disables
the up key.
Also fixes `parse_key` so a non-numeric `f…` name (e.g. `focus`, `first`)
falls through to name/event matching instead of erroring on the function-
key branch.
Adds unit and snapshot tests and documents everything in ARCHITECTURE.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QKxusGbxLxqWdYyeqrb68
* Rename skip action to suppress and document it in the manpage
Rename the `skip` action to `suppress`, which more clearly conveys that
it cancels the triggering action's default behaviour. Add it to the
manpage actions list, noting that when bound to an action it suppresses
that action's default (so the rest of the chain runs in its place), and
when bound to a key it is equivalent to `ignore`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QKxusGbxLxqWdYyeqrb68
* Fire finder events from callbacks instead of the render path
Move the synthetic finder events off the per-render check:
- `focus` now rides along with `App::on_selection_changed` (via a small
`take_focus_event` helper), firing only when the focused item actually
changes on cursor movement.
- `load`/`result`/`zero`/`one` track async reader/matcher completion, which
has no synchronous callback, so `App::poll_completion_events` edge-triggers
them from the `Heartbeat` handler rather than the render path. A `Render`
is queued just before them so a list-inspecting binding (e.g. `load:first`)
still sees the finished results.
This removes the branching that previously ran on every render tick and
keeps the event logic out of the unrelated `dispatch_action` arms.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QKxusGbxLxqWdYyeqrb68
* misc tweaks incl. noremap
* fixes
* docs: document new binds
* coderabbit review
* fix: address Copilot review comments on action binds
- Split `--bind` specs with top-level comma splitting in `SkimOptions::build`
so commas inside parenthesized action arguments (e.g.
`act-up:execute(echo a,b)`) no longer garble follow-up bindings. Reuses the
existing `split_top_level` helper (now `pub(crate)`), matching
`KeyMap::add_keymaps_str`.
- Correct the misleading `load` event comment in `check_reader`: the event is
fired from `App::poll_completion_events` (the heartbeat handler), not the
render path.
- Add a unit test covering commas inside action arguments.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pxems1gNKKezFcxtZfURJp
* fix: harden action-trigger binds (logging, runtime bind/unbind, API surface)
Address three review findings on the action-trigger feature:
- Log dropped `--bind` specs: an unknown trigger name or an invalid
follow-up chain in parse_action_binds is now reported via debug!
instead of vanishing silently, matching the keymap path's behavior.
- Make the runtime `bind`/`unbind` actions manage action triggers as
well as keys: `bind(act-up:last)` merges into action_binds and
`unbind(act-up)` removes the trigger, with the same keys-win
precedence as `--bind`. Trigger-name resolution is shared through a
new binds::action_trigger_name helper.
- Narrow the new App fields (reader_done, load_event_fired,
result_pending) to pub(crate): they are a Skim<->App coordination
protocol, not public API.
Update the manpage (regenerated sk.1) and ARCHITECTURE.md accordingly,
and cover the new behavior with unit tests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TgSqqsXn1GfQRZhQWAWi7t
* fix: don't abort the event loop on an invalid if-* branch chain
`if-*` branch chains are stored unparsed by `parse_action`, so an invalid
action name only surfaces when the binding fires. `dispatch_conditional`
propagated that parse error out of `App::handle_event`, killing the whole
finder mid-session on a bind typo. Log and skip the chain instead,
matching the invalid-chain handling of `parse_action_binds`.
Also refresh the stale line numbers in the ARCHITECTURE.md
cross-reference table.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TgSqqsXn1GfQRZhQWAWi7t
* fix: make sure to render before start in sync mode
* chore: push snaps
* fix: misc
* fix: address review comments on start event, if-* logging and docs
- skim.rs: retry the one-shot `start` event from `tick()` so a momentarily
full bounded `event_tx` at the `start()`/`enter()` call sites can no longer
drop it permanently. Idempotent via the `start_fired` guard.
- app.rs: log an invalid `if-*` conditional action chain at `warn!` instead of
`debug!` so a misconfigured binding is discoverable by default.
- ARCHITECTURE.md: clarify that `Skim::check_reader` only records `reader_done`;
`App::poll_completion_events` owns and emits `load`/`result`/`zero`/`one`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QKxusGbxLxqWdYyeqrb68
* chore: minor formatting
---------
Co-authored-by: Claude <noreply@anthropic.com>
* fix(tui): stop input reader and give execute() children their own tty
Interactive/ncurses programs run via an `execute()` action (e.g. `ncdu`)
would freeze after a few keystrokes. Two independent problems caused it:
1. skim's background input reader (the `EventStream` task started in
`Tui::start`) kept reading the terminal while the child ran, so skim and
the child raced for keystrokes on the same tty — roughly half the keys
were stolen from the child.
2. The child inherited skim's stdin (fd 0), which is a pipe whenever items
are piped in (`find | sk`). An interactive child then had no keyboard
source at all.
Fix both:
- Add `Tui::stop_and_join`, which cancels the event-pump task and blocks
until it has dropped its `EventStream`, guaranteeing skim has released the
terminal before the child starts. `run_foreground` calls it before running
the child and `Tui::start` after.
- Give the child its own stdin opened from the controlling terminal
(`/dev/tty`, or `CONIN$` on Windows), falling back to inheriting skim's
stdin if that fails.
Because running a foreground process needs the `Tui` (which `handle_action`
does not have), `Execute` now only expands the command and returns a new
`Event::RunExecute`, which `handle_event` runs via `run_foreground`. This
mirrors the existing `RunPreview` pattern. `execute-silent` is unchanged.
Update ARCHITECTURE.md (event dispatch table, terminal lifecycle, and
cross-reference line numbers) and add tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QBQ1chjHyN3JNTWqMMED44
* test(execute): add tmux e2e test; fix reader restart and post-execute repaint
Add a tmux-based integration test (tests/execute.rs, unix-gated so it runs
on the Linux and macOS CI legs) that drives an interactive child through an
`execute` action and asserts it keeps receiving keystrokes, then that skim
is interactive again once the child exits. It covers both the fullscreen and
inline (`--height`) layouts.
Writing the test surfaced two bugs in the execute reader-suspend work that
unit tests could not catch:
1. Reader never resumed. `Tui::stop_and_join` cancels the shared
`CancellationToken`, but `Tui::start` reused that same token — and a
cancelled token stays cancelled — so the respawned reader observed the
cancellation immediately and exited without reading input. `start` now
installs a fresh token on every call (also fixing the latent
restart-while-running path).
2. Post-execute repaint hung when stdout was redirected. The repaint went
through `Event::Redraw` → `tui.clear()`, and ratatui's `Terminal::clear`
queries the cursor position, which crossterm writes to stdout via
`ESC [ 6 n`. skim renders to stderr and its stdout is routinely redirected
(`sk > file`), so the query reached no terminal, got no reply, and stalled
the UI for seconds before erroring out. Replace it with
`Tui::force_full_redraw`, which resets ratatui's diff buffers for a full
repaint with no cursor query and works for both fullscreen and inline
viewports.
Update ARCHITECTURE.md and the cross-reference table accordingly.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QBQ1chjHyN3JNTWqMMED44
* ci: fix matrix
* fix: pop kitty keyboard flag before entering execute
* chore: remove duplication in backend.rs
* chore: refactor
* fix: kitty maintains a different set of flags in alt screen
---------
Co-authored-by: Claude <noreply@anthropic.com>
* ci: add .deb and .rpm packages to releases via dist
Configure cargo-deb and cargo-generate-rpm to build Linux packages
containing the sk executable, the man pages (sk.1, sk-tmux.1) and the
bash/zsh/fish shell completions.
A new reusable workflow (package.yml) builds both packages and uploads
them under an artifacts-* name. It is wired into the release pipeline as
a dist global-artifacts-job in dist-workspace.toml, and release.yml is
regenerated with `dist generate` (not hand-edited) so dist's host job
attaches the packages to the GitHub Release.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw
* ci: drop sk-tmux man page from .deb and .rpm packages
Package only the sk.1 man page; the sk-tmux.1 page is no longer shipped.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw
* ci: temporarily build release artifacts on PRs
Set dist pr-run-mode = "upload" so the .deb and .rpm (and the other
release artifacts) are built and uploaded on pull requests, allowing the
packages to be downloaded and verified before merging.
This is temporary and should be reverted before merge.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw
* ci: install packaging tools via taiki-e/install-action
Address review feedback on package.yml:
- Install cargo-deb and cargo-generate-rpm with taiki-e/install-action
(prebuilt binaries) plus a Swatinem/rust-cache step, matching the
patterns used in test.yml, instead of compiling them with cargo install.
- Drop the `--output target/debian` flag from `cargo deb`; the default
target/debian/ directory is what the collect step expects.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw
* ci: build arm64 .deb and .rpm packages too
Turn the package job into a matrix that builds natively for both amd64
(ubuntu-22.04) and arm64 (ubuntu-22.04-arm), producing a .deb and .rpm
per architecture. Artifacts are uploaded under per-arch names so dist's
host job attaches all of them to the release.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw
* ci: submit releases to winget via winget-releaser
Add a dist publish job that, after the GitHub Release is created, submits
the new version to the Windows Package Manager Community Repository using
vedantmgoyal9/winget-releaser and the Windows .zip artifact dist already
attaches to the release.
Uses the package identifier and installer regex from skim-rs/skim#769:
identifier: skim-rs.skim
installers-regex: '-pc-windows-msvc\.zip$'
Wired in through publish-jobs in dist-workspace.toml; release.yml is
regenerated with `dist generate` (not hand-edited). Prereleases are never
submitted. Requires a WINGET_TOKEN secret (a public_repo-scoped PAT that
owns a microsoft/winget-pkgs fork under skim-rs).
Refs: skim-rs/skim#769
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw
* ci: validate package version against the release plan
Consume the `plan` input dist passes to the package job: assert the
crate version equals the version dist planned for this release, so the
source-built .deb/.rpm can't silently drift from the release.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw
* Update .github/workflows/winget.yml
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* Update .github/workflows/package.yml
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* docs: document .deb, .rpm, winget and scoop installation
Add the new install methods to the README: winget and Scoop rows plus a
Debian/RPM section with install commands, covering amd64 and arm64.
Also clarify in winget.yml that WINGET_TOKEN must be a classic PAT
(fine-grained tokens can't open the winget-pkgs PR).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmNevtS7EV3vXyYRTVu7Aw
* fix: install cargo-deb manually to avoid libc version mismatch
* ci: use blacksmith runners for long job
* fix: version spec for cargo install
* chore: revert pr action upload
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* feat: add `bind` and `unbind` actions
Add two new actions that allow programmatic (re)binding of keys at
runtime, both through `--bind` keybindings and the IPC/listen socket:
- `bind(key:action[+action][,key:action…])` adds one or more bindings,
reusing the same parsing/merging logic as the `--bind` CLI option.
Existing bindings for the same key are replaced.
- `unbind(key[,key…])` removes the bindings for a comma-separated list
of keys, mirroring fzf's `unbind(...)` semantics.
Because the `Action` enum derives serde when the `listen` feature is
enabled, both actions are drivable over the IPC socket for free.
Covered by unit tests for parsing (`event_tests.rs`) and dispatch
(`app_tests.rs`), plus IPC integration tests (`listen.rs`). Manpage and
ARCHITECTURE.md updated with the new actions.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JYqqomFjYqqXd5NvkVxfbQ
* feat: add `bind` and `unbind` actions
* chore: generate files
* fixes
* fixes
---------
Co-authored-by: Claude <noreply@anthropic.com>
* Add --hide-nth flag to hide fields while keeping them searchable
Introduce a `--hide-nth <fieldspec>` option that takes the same
comma-separated field index expressions as `--nth`/`--with-nth`. The
listed fields are removed from the displayed line but remain part of the
text used for matching, so a query can still match them. Characters in
the hidden fields are ignored for match highlighting and horizontal
scrolling.
Implementation:
- Resolve the fieldspec to byte ranges in the same coordinate space as
the matching/display text and store them as `hidden_ranges` in
DefaultSkimItem metadata, exposed via a new `SkimItem::hidden_ranges()`
trait method. text()/output() keep the full text so hidden fields stay
searchable and are preserved on output.
- DefaultSkimItem::display() removes hidden characters and remaps match
highlight positions into visible coordinates (project_visible_text /
project_match_indices); this path takes precedence over ANSI styling.
- ItemRenderer::render_item applies the same projection to derive the
visible sub-line text and hscroll match range, so hidden characters are
ignored for horizontal scrolling.
Add unit tests for range normalization/projection and item behavior,
plus insta snapshot tests covering display removal, searchability, and
hscroll. Update ARCHITECTURE.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCunXeAFMYAFduTc8SNjSM
* Preserve ANSI colors for surviving text under --hide-nth
Previously the hidden-field rendering path was applied ahead of the ANSI
display branch and rebuilt the line from the ANSI-stripped text, so
combining --hide-nth with --ansi dropped the colors of the visible
fields.
Integrate hidden-field removal into the ANSI branch instead: after
parsing the styled spans, drop the hidden characters while preserving
each span's style (retain_visible_spans) and remap the match positions
into the resulting visible coordinate space, then run the normal
highlighting. The plain (non-ANSI) branch keeps its project-and-to_line
handling. Surviving characters now keep their ANSI colors while hidden
fields stay searchable.
Add unit tests for ANSI color preservation and remapped highlighting,
plus ANSI color-snapshot integration tests. Update ARCHITECTURE.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCunXeAFMYAFduTc8SNjSM
* Set hidden fields via builder instead of DefaultSkimItem::new param
Remove the `hidden_fields` parameter from `DefaultSkimItem::new` and set
the hidden fields through a `hidden_fields(&[FieldRange], &Regex)`
builder method instead. The builder resolves the fields against the
item's own `text()` (the same coordinate space `new` would have used),
so the result is identical while keeping `new`'s signature unchanged for
its many existing call sites.
The reader chains `.hidden_fields(&opt.hidden_fields, &opt.delimiter)`
onto construction. Revert the extra `&[]` argument at the other call
sites (selector, fuzz target, tests) and update the hide-nth tests to
use the builder. Update ARCHITECTURE.md.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCunXeAFMYAFduTc8SNjSM
* chore: generate files
---------
Co-authored-by: Claude <noreply@anthropic.com>