Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

chore: bump skim from 5.6.6 to 5.7.0 (#4097)

dependabot[bot]f7be76af6b57
diff --git a/Cargo.lock b/Cargo.lock
index a134c0969..62b8b82c7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3312,9 +3312,9 @@ checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"
[[package]]
name = "skim"
-version = "5.6.6"
+version = "5.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bdf8d087c441a5484b3c5cde20280b923dafb2fb949555d8e78640d21b9e598"
+checksum = "6530d7097c20d79eb1c1436ae6a8f764f08da43b31a767424a382ad72a6a8d7a"
dependencies = [
"ansi-to-tui",
"assert_enum_variants",
diff --git a/Cargo.toml b/Cargo.toml
index b6ff94f78..f1edcb640 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -291,7 +291,7 @@ shared_child = "1.1"
# not panic on push/pop keyboard enhancement flags failure") and is
# Windows-green again. Kept as an exact pin; it can relax to a range now that
# the keyboard-enhancement path no longer regresses the legacy console.
-skim = { version = "=5.6.6", optional = true, default-features = false, features = ["frizbee"] }
+skim = { version = "=5.7.0", optional = true, default-features = false, features = ["frizbee"] }
# Pinned to skim's ratatui line so the `Line` type `display()` returns is the
# same one skim consumes. `ansi-to-tui` parses ANSI SGR codes into ratatui spans.
# Floor is 0.30.1: 0.30.0 is a broken release (its `#[instability::unstable]`
diff --git a/src/commands/picker/items.rs b/src/commands/picker/items.rs
index 24398da87..fcdd825a1 100644
--- a/src/commands/picker/items.rs
+++ b/src/commands/picker/items.rs
@@ -910,13 +910,19 @@ struct Tab {
/// Longest preview body handed to skim, in lines.
///
-/// skim keeps the pane's line count in a `u16` and `unwrap()`s the conversion
-/// (`total_lines` in skim 5.6.5's `src/tui/preview.rs`), so a body over 65,535
-/// lines aborts the whole process instead of rendering — the picker paints,
-/// then dies once the preview lands (#3958). A `git diff <default>...<branch>`
-/// on a long-lived branch clears that on its own. The cap sits under the
-/// ceiling rather than at it because the body isn't the whole pane: the tab bar
-/// and this notice ride above it and count toward the same total.
+/// skim scrolls the pane through ratatui's `Paragraph::scroll`, whose offset is
+/// a `u16` (`render_text` in skim 5.7.0's `src/tui/preview.rs` clamps with
+/// `u16::try_from(self.scroll_y).unwrap_or(u16::MAX)`), so a body over 65,535
+/// lines renders a tail the user can never scroll to and is given no sign of.
+/// A `git diff <default>...<branch>` on a long-lived branch clears that on its
+/// own. The cap sits under the ceiling rather than at it because the body isn't
+/// the whole pane: the tab bar and this notice ride above it and count toward
+/// the same total.
+///
+/// Through skim 5.6.6 the same ceiling was a `u16` line *count* that skim
+/// `unwrap()`ed, so an oversized body aborted the process instead — the picker
+/// painted, then died once the preview landed (#3958). 5.7.0 widened
+/// `total_lines` to `usize`, leaving the scroll offset as the live limit.
const MAX_PREVIEW_LINES: usize = 60_000;
/// Cap a preview body at [`MAX_PREVIEW_LINES`], returning the body to render
@@ -2885,11 +2891,12 @@ mod tests {
}
#[test]
- fn preview_caps_a_pane_longer_than_skim_can_count() {
- // skim keeps the pane's line count in a `u16` and unwraps the
- // conversion, so handing it a longer pane aborts the picker rather than
- // rendering (#3958). A `git diff <default>...<branch>` on a long-lived
- // branch clears 65,535 lines on its own.
+ fn preview_caps_a_pane_longer_than_skim_can_scroll() {
+ // skim's scroll offset is a `u16`, so the tail of a longer pane is
+ // unreachable and unannounced (#3958, where the same ceiling was a line
+ // count skim unwrapped and the picker aborted outright). A `git diff
+ // <default>...<branch>` on a long-lived branch clears 65,535 lines on
+ // its own.
let cache: PreviewCache = Arc::new(DashMap::new());
let row = worktree_test_row("feature", Arc::clone(&cache), None);
cache.insert(
@@ -2905,7 +2912,7 @@ mod tests {
let head = pane.lines().take(6).collect::<Vec<_>>().join("\n");
assert!(
lines < u16::MAX as usize,
- "pane must stay countable by skim's u16: {lines} lines"
+ "pane must stay inside skim's u16 scroll range: {lines} lines"
);
assert!(
head.contains("Preview truncated"),
diff --git a/src/commands/picker/preview.rs b/src/commands/picker/preview.rs
index 11ef10a00..8c12357f6 100644
--- a/src/commands/picker/preview.rs
+++ b/src/commands/picker/preview.rs
@@ -122,6 +122,15 @@ const MIN_COLS_FOR_RIGHT_LAYOUT: f64 = 80.0;
/// needs the available row budget — both layout arms in `dimensions_for`, the
/// picker's `num_items_estimate` cap, and the preview half-page scroll — derives
/// it here, so the definition can't drift between them.
+///
+/// The share is exact from 12 rows up. Below that, skim floors a non-fullscreen
+/// viewport at its `--min-height` (default 10, capped by the terminal) —
+/// `rect_with_min_height` in skim 5.7.0's `src/tui/backend.rs`, applied from
+/// `Skim::init_tui` and inert before 5.7.0 — so skim paints exactly one row more
+/// than this returns, scrolling the terminal up to claim it. That row falls to
+/// the list: the `down:{height}` band `spec_for` formats is sized against this
+/// budget, and on a terminal that short the floors (`MIN_PREVIEW_LINES`,
+/// `MIN_VISIBLE_ITEMS`, the half-page scroll's own) are already what bind.
pub(super) fn available_height(term_height: usize) -> usize {
term_height * SKIM_HEIGHT_PERCENT / 100
}