Skip to content

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

refactor(picker): migrate to skim 4.8 (ratatui), drop vendored skim-tuikit (#3137)

Maximilian Roos958b9c188aaa
diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml
index 89e76ffa4..b90c0dcc2 100644
--- a/.github/workflows/nightly.yaml
+++ b/.github/workflows/nightly.yaml
@@ -292,15 +292,15 @@ jobs:
key: minimal-versions
- name: Resolve to minimum versions
- run: |
- cargo update -Z minimal-versions
- # filedescriptor 0.8.3 declares `thiserror = "^1.0"` but uses `#[from]`,
- # which is unsupported in thiserror 1.0.0/1.0.1 (it was added in 1.0.2).
- # Under -Z minimal-versions the resolver picks 1.0.0, which fails to
- # compile. Bump the floor to a known-good version that has `#[from]`.
- # (Upstream filedescriptor hasn't been touched since 2025-02-11; we
- # can't fix this at the source.)
- cargo update -p thiserror@1 --precise 1.0.7
+ # `direct`, not full `-Z minimal-versions`: minimize only worktrunk's own
+ # direct deps and let transitive crates resolve normally. Full minimization
+ # also walks skim 4.8's TUI/image stack (ansi-to-tui, ratatui's
+ # `instability` macro, color-eyre, ratatui-image -> image/avif -> num-* and
+ # bitvec), whose crates under-declare their floors and don't compile at the
+ # picked versions — upstream brokenness, not ours, that we'd have to pin
+ # around. Direct minimization confines the check to floors we actually own;
+ # they're raised in the manifests to the minimums the tree builds against.
+ run: cargo update -Z direct-minimal-versions
- name: cargo check
run: cargo check --workspace --all-targets
diff --git a/Cargo.lock b/Cargo.lock
index 656fc1bea..1c02919c2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,21 @@
# It is not intended for manual editing.
version = 4
+[[package]]
+name = "addr2line"
+version = "0.25.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
+dependencies = [
+ "gimli",
+]
+
+[[package]]
+name = "adler2"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
+
[[package]]
name = "aho-corasick"
version = "1.1.4"
@@ -11,6 +26,24 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "aligned"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685"
+dependencies = [
+ "as-slice",
+]
+
+[[package]]
+name = "aligned-vec"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b"
+dependencies = [
+ "equator",
+]
+
[[package]]
name = "alloca"
version = "0.4.0"
@@ -20,6 +53,12 @@ dependencies = [
"cc",
]
+[[package]]
+name = "allocator-api2"
+version = "0.2.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
+
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -63,13 +102,26 @@ dependencies = [
"regex",
]
+[[package]]
+name = "ansi-to-tui"
+version = "8.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e42366bb9d958f042bf58f0a85e1b2d091997c1257ca49bddd7e4827aadc65fd"
+dependencies = [
+ "nom 8.0.0",
+ "ratatui-core",
+ "simdutf8",
+ "smallvec",
+ "thiserror 2.0.18",
+]
+
[[package]]
name = "ansitok"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0a8acea8c2f1c60f0a92a8cd26bf96ca97db56f10bbcab238bbe0cceba659ee"
dependencies = [
- "nom",
+ "nom 7.1.3",
"vte 0.14.1",
]
@@ -129,12 +181,47 @@ version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
+[[package]]
+name = "approx"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "arbitrary"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
+
+[[package]]
+name = "arg_enum_proc_macro"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
[[package]]
name = "arrayvec"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+[[package]]
+name = "as-slice"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
+dependencies = [
+ "stable_deref_trait",
+]
+
[[package]]
name = "askama"
version = "0.16.0"
@@ -159,7 +246,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustc-hash",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -182,6 +269,21 @@ dependencies = [
"winnow 1.0.0",
]
+[[package]]
+name = "assert_enum_variants"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1685feee7d06d8813fe963f814c5c398d90392b9c3c41e656ac3100d5c334536"
+
+[[package]]
+name = "atomic"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a89cbf775b137e9b968e67227ef7f775587cde3fd31b0d8599dbd0f598a48340"
+dependencies = [
+ "bytemuck",
+]
+
[[package]]
name = "autocfg"
version = "1.5.0"
@@ -189,10 +291,99 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
-name = "beef"
-version = "0.5.2"
+name = "av-scenechange"
+version = "0.14.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394"
+dependencies = [
+ "aligned",
+ "anyhow",
+ "arg_enum_proc_macro",
+ "arrayvec",
+ "log",
+ "num-rational",
+ "num-traits",
+ "pastey",
+ "rayon",
+ "thiserror 2.0.18",
+ "v_frame",
+ "y4m",
+]
+
+[[package]]
+name = "av1-grain"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"
+dependencies = [
+ "anyhow",
+ "arrayvec",
+ "log",
+ "nom 8.0.0",
+ "num-rational",
+ "v_frame",
+]
+
+[[package]]
+name = "avif-serialize"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38"
+dependencies = [
+ "arrayvec",
+]
+
+[[package]]
+name = "backtrace"
+version = "0.3.76"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6"
+dependencies = [
+ "addr2line",
+ "cfg-if",
+ "libc",
+ "miniz_oxide",
+ "object",
+ "rustc-demangle",
+ "windows-link",
+]
+
+[[package]]
+name = "base64"
+version = "0.22.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+[[package]]
+name = "base64-simd"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195"
+dependencies = [
+ "outref",
+ "vsimd",
+]
+
+[[package]]
+name = "bit-set"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"
+dependencies = [
+ "bit-vec",
+]
+
+[[package]]
+name = "bit-vec"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
+
+[[package]]
+name = "bit_field"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1"
+checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6"
[[package]]
name = "bitflags"
@@ -202,9 +393,33 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
-version = "2.10.0"
+version = "2.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
+dependencies = [
+ "serde_core",
+]
+
+[[package]]
+name = "bitstream-io"
+version = "4.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f"
+dependencies = [
+ "no_std_io2",
+]
+
+[[package]]
+name = "bitvec"
+version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
+checksum = "ddcec3d12c579d40898fe0a9a358a803c23e9c52ca3c425707f81c9436211837"
+dependencies = [
+ "funty",
+ "radium",
+ "tap",
+ "wyz",
+]
[[package]]
name = "block-buffer"
@@ -240,13 +455,13 @@ version = "3.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d0bd4c2f75335ad98052a37efb54f428b492f64340257143b3429c8a508fa7b"
dependencies = [
- "darling",
+ "darling 0.20.11",
"ident_case",
"prettyplease",
"proc-macro2",
"quote",
"rustversion",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -260,18 +475,71 @@ dependencies = [
"serde",
]
+[[package]]
+name = "built"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9"
+
[[package]]
name = "bumpalo"
version = "3.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"
+[[package]]
+name = "by_address"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06"
+
+[[package]]
+name = "bytemuck"
+version = "1.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
+dependencies = [
+ "bytemuck_derive",
+]
+
+[[package]]
+name = "bytemuck_derive"
+version = "1.10.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "byteorder-lite"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
+
+[[package]]
+name = "bytes"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593"
+
[[package]]
name = "cast"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
+[[package]]
+name = "castaway"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"
+dependencies = [
+ "rustversion",
+]
+
[[package]]
name = "cc"
version = "1.2.54"
@@ -279,6 +547,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583"
dependencies = [
"find-msvc-tools",
+ "jobserver",
+ "libc",
"shlex",
]
@@ -381,6 +651,16 @@ dependencies = [
"shlex",
]
+[[package]]
+name = "clap_complete_nushell"
+version = "4.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbb9e9715d29a754b468591be588f6b926f5b0a1eb6a8b62acabeb66ff84d897"
+dependencies = [
+ "clap",
+ "clap_complete",
+]
+
[[package]]
name = "clap_derive"
version = "4.6.1"
@@ -392,7 +672,7 @@ dependencies = [
"proc-macro2",
"pulldown-cmark",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -401,6 +681,21 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831"
+[[package]]
+name = "color-eyre"
+version = "0.6.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e5920befb47832a6d61ee3a3a846565cfa39b331331e68a3b1d1116630f2f26d"
+dependencies = [
+ "backtrace",
+ "color-spantrace",
+ "eyre",
+ "indenter",
+ "once_cell",
+ "owo-colors",
+ "tracing-error",
+]
+
[[package]]
name = "color-print"
version = "0.3.7"
@@ -416,18 +711,50 @@ version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692186b5ebe54007e45a59aea47ece9eb4108e141326c304cdc91699a7118a22"
dependencies = [
- "nom",
+ "nom 7.1.3",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "color-spantrace"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b8b88ea9df13354b55bc7234ebcce36e6ef896aca2e42a15de9e10edce01b427"
+dependencies = [
+ "once_cell",
+ "owo-colors",
+ "tracing-core",
+ "tracing-error",
]
+[[package]]
+name = "color_quant"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
+
[[package]]
name = "colorchoice"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
+[[package]]
+name = "compact_str"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9dfdd1c2274d9aa354115b09dc9a901d6c5576818cdf70d14cae2bdb47df00ab"
+dependencies = [
+ "castaway",
+ "cfg-if",
+ "itoa",
+ "rustversion",
+ "ryu",
+ "static_assertions",
+]
+
[[package]]
name = "console"
version = "0.16.3"
@@ -487,6 +814,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "crc32fast"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
+dependencies = [
+ "cfg-if",
+]
+
[[package]]
name = "criterion"
version = "0.8.2"
@@ -499,7 +835,7 @@ dependencies = [
"ciborium",
"clap",
"criterion-plot",
- "itertools",
+ "itertools 0.13.0",
"num-traits",
"oorandom",
"page_size",
@@ -519,9 +855,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea"
dependencies = [
"cast",
- "itertools",
+ "itertools 0.13.0",
]
+[[package]]
+name = "critical-section"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
+
[[package]]
name = "crokey"
version = "1.3.0"
@@ -545,7 +887,7 @@ dependencies = [
"proc-macro2",
"quote",
"strict",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -610,13 +952,16 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b"
dependencies = [
- "bitflags 2.10.0",
+ "bitflags 2.13.0",
"crossterm_winapi",
"derive_more",
"document-features",
+ "filedescriptor",
+ "futures-core",
+ "libc",
"mio",
"parking_lot",
- "rustix",
+ "rustix 1.1.4",
"signal-hook 0.3.18",
"signal-hook-mio",
"winapi",
@@ -656,14 +1001,34 @@ dependencies = [
"hybrid-array",
]
+[[package]]
+name = "csscolorparser"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb2a7d3066da2de787b7f032c736763eb7ae5d355f81a68bab2675a96008b0bf"
+dependencies = [
+ "lab",
+ "phf",
+]
+
[[package]]
name = "darling"
version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee"
dependencies = [
- "darling_core",
- "darling_macro",
+ "darling_core 0.20.11",
+ "darling_macro 0.20.11",
+]
+
+[[package]]
+name = "darling"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d"
+dependencies = [
+ "darling_core 0.23.0",
+ "darling_macro 0.23.0",
]
[[package]]
@@ -677,7 +1042,20 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
- "syn",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "darling_core"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0"
+dependencies = [
+ "ident_case",
+ "proc-macro2",
+ "quote",
+ "strsim",
+ "syn 2.0.117",
]
[[package]]
@@ -686,9 +1064,20 @@ version = "0.20.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
dependencies = [
- "darling_core",
+ "darling_core 0.20.11",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "darling_macro"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d"
+dependencies = [
+ "darling_core 0.23.0",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -706,14 +1095,10 @@ dependencies = [
]
[[package]]
-name = "defer-drop"
-version = "1.3.0"
+name = "deltae"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f613ec9fa66a6b28cdb1842b27f9adf24f39f9afc4dcdd9fdecee4aca7945c57"
-dependencies = [
- "crossbeam-channel",
- "once_cell",
-]
+checksum = "5729f5117e208430e437df2f4843f5e5952997175992d1414f94c57d61e270b4"
[[package]]
name = "deranged"
@@ -739,10 +1124,10 @@ version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8"
dependencies = [
- "darling",
+ "darling 0.20.11",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -752,7 +1137,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
dependencies = [
"derive_builder_core",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -774,7 +1159,8 @@ dependencies = [
"proc-macro2",
"quote",
"rustc_version",
- "syn",
+ "syn 2.0.117",
+ "unicode-xid",
]
[[package]]
@@ -807,16 +1193,6 @@ dependencies = [
"dirs-sys",
]
-[[package]]
-name = "dirs-next"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
-dependencies = [
- "cfg-if",
- "dirs-sys-next",
-]
-
[[package]]
name = "dirs-sys"
version = "0.5.0"
@@ -825,20 +1201,15 @@ checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
dependencies = [
"libc",
"option-ext",
- "redox_users 0.5.2",
+ "redox_users",
"windows-sys 0.61.2",
]
[[package]]
-name = "dirs-sys-next"
-version = "0.1.2"
+name = "doctest-file"
+version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
-dependencies = [
- "libc",
- "redox_users 0.4.6",
- "winapi",
-]
+checksum = "c2db04e74f0a9a93103b50e90b96024c9b2bdca8bce6a632ec71b88736d3d359"
[[package]]
name = "document-features"
@@ -886,32 +1257,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
[[package]]
-name = "env_filter"
-version = "1.0.0"
+name = "equator"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f"
+checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc"
dependencies = [
- "log",
- "regex",
+ "equator-macro",
]
[[package]]
-name = "env_home"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe"
-
-[[package]]
-name = "env_logger"
-version = "0.11.10"
+name = "equator-macro"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a"
+checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3"
dependencies = [
- "anstream",
- "anstyle",
- "env_filter",
- "jiff",
- "log",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
]
[[package]]
@@ -940,12 +1302,77 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "euclid"
+version = "0.22.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "exr"
+version = "1.74.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4300e043a56aa2cb633c01af81ca8f699a321879a7854d3896a0ba89056363be"
+dependencies = [
+ "bit_field",
+ "half",
+ "lebe",
+ "miniz_oxide",
+ "rayon-core",
+ "smallvec",
+ "zune-inflate",
+]
+
+[[package]]
+name = "eyre"
+version = "0.6.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec"
+dependencies = [
+ "indenter",
+ "once_cell",
+]
+
+[[package]]
+name = "fancy-regex"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2"
+dependencies = [
+ "bit-set",
+ "regex",
+]
+
+[[package]]
+name = "fast-srgb8"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1"
+
[[package]]
name = "fastrand"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
+[[package]]
+name = "fax"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a"
+
+[[package]]
+name = "fdeflate"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
+dependencies = [
+ "simd-adler32",
+]
+
[[package]]
name = "filedescriptor"
version = "0.8.3"
@@ -963,12 +1390,50 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db"
+[[package]]
+name = "finl_unicode"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9844ddc3a6e533d62bba727eb6c28b5d360921d5175e9ff0f1e621a5c590a4d5"
+
+[[package]]
+name = "fixedbitset"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
+
+[[package]]
+name = "flate2"
+version = "1.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
+dependencies = [
+ "crc32fast",
+ "miniz_oxide",
+]
+
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+[[package]]
+name = "foldhash"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
+
+[[package]]
+name = "frizbee"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca1f7b0dce1c25254457f2edcfcf611bf207113564b96f90659a3f54506016b2"
+dependencies = [
+ "itertools 0.14.0",
+ "raw-cpuid",
+]
+
[[package]]
name = "fs2"
version = "0.4.3"
@@ -979,28 +1444,82 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "funty"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
+
+[[package]]
+name = "futures"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-channel"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d"
+dependencies = [
+ "futures-core",
+ "futures-sink",
+]
+
[[package]]
name = "futures-core"
-version = "0.3.31"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
+
+[[package]]
+name = "futures-executor"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
+[[package]]
+name = "futures-io"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
+checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718"
[[package]]
name = "futures-macro"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
+checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
+[[package]]
+name = "futures-sink"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893"
+
[[package]]
name = "futures-task"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
+checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393"
[[package]]
name = "futures-timer"
@@ -1010,27 +1529,21 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
[[package]]
name = "futures-util"
-version = "0.3.31"
+version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
+checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
dependencies = [
+ "futures-channel",
"futures-core",
+ "futures-io",
"futures-macro",
+ "futures-sink",
"futures-task",
+ "memchr",
"pin-project-lite",
- "pin-utils",
"slab",
]
-[[package]]
-name = "fuzzy-matcher"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
-dependencies = [
- "thread_local",
-]
-
[[package]]
name = "generic-array"
version = "0.14.7"
@@ -1060,10 +1573,37 @@ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
dependencies = [
"cfg-if",
"libc",
- "r-efi",
+ "r-efi 5.3.0",
"wasip2",
]
+[[package]]
+name = "getrandom"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "r-efi 6.0.0",
+]
+
+[[package]]
+name = "gif"
+version = "0.14.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159"
+dependencies = [
+ "color_quant",
+ "weezl",
+]
+
+[[package]]
+name = "gimli"
+version = "0.32.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
+
[[package]]
name = "glob"
version = "0.3.3"
@@ -1100,11 +1640,27 @@ version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
+[[package]]
+name = "hashbrown"
+version = "0.16.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
+dependencies = [
+ "allocator-api2",
+ "equivalent",
+ "foldhash",
+]
+
[[package]]
name = "hashbrown"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
+dependencies = [
+ "allocator-api2",
+ "equivalent",
+ "foldhash",
+]
[[package]]
name = "heck"
@@ -1112,6 +1668,12 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+[[package]]
+name = "hex"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
+
[[package]]
name = "home"
version = "0.5.12"
@@ -1148,7 +1710,7 @@ dependencies = [
"js-sys",
"log",
"wasm-bindgen",
- "windows-core",
+ "windows-core 0.62.2",
]
[[package]]
@@ -1160,6 +1722,16 @@ dependencies = [
"cc",
]
+[[package]]
+name = "icy_sixel"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85518b9086bf01117761b90e7691c0ef3236fa8adfb1fb44dd248fe5f87215d5"
+dependencies = [
+ "quantette",
+ "thiserror 2.0.18",
+]
+
[[package]]
name = "ident_case"
version = "1.0.1"
@@ -1188,6 +1760,52 @@ dependencies = [
"winapi-util",
]
+[[package]]
+name = "image"
+version = "0.25.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104"
+dependencies = [
+ "bytemuck",
+ "byteorder-lite",
+ "color_quant",
+ "exr",
+ "gif",
+ "image-webp",
+ "moxcms",
+ "num-traits",
+ "png",
+ "qoi",
+ "ravif",
+ "rayon",
+ "rgb",
+ "tiff",
+ "zune-core",
+ "zune-jpeg",
+]
+
+[[package]]
+name = "image-webp"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3"
+dependencies = [
+ "byteorder-lite",
+ "quick-error",
+]
+
+[[package]]
+name = "imgref"
+version = "1.12.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89194689a993ab15268672e99e7b0e19da2da3268ac682e8f02d29d4d1434cd7"
+
+[[package]]
+name = "indenter"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
+
[[package]]
name = "indexmap"
version = "2.14.0"
@@ -1200,6 +1818,15 @@ dependencies = [
"serde_core",
]
+[[package]]
+name = "indoc"
+version = "2.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
+dependencies = [
+ "rustversion",
+]
+
[[package]]
name = "insta"
version = "1.48.0"
@@ -1228,6 +1855,45 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "instability"
+version = "0.3.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5eb2d60ef19920a3a9193c3e371f726ec1dafc045dac788d0fb3704272458971"
+dependencies = [
+ "darling 0.23.0",
+ "indoc",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "interpolate_name"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "interprocess"
+version = "2.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "069323743400cb7ab06a8fe5c1ed911d36b6919ec531661d034c89083629595b"
+dependencies = [
+ "doctest-file",
+ "futures-core",
+ "libc",
+ "recvmsg",
+ "tokio",
+ "widestring",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "is_executable"
version = "1.0.5"
@@ -1253,33 +1919,28 @@ dependencies = [
]
[[package]]
-name = "itoa"
-version = "1.0.17"
+name = "itertools"
+version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
+dependencies = [
+ "either",
+]
[[package]]
-name = "jiff"
-version = "0.2.23"
+name = "itoa"
+version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359"
-dependencies = [
- "jiff-static",
- "log",
- "portable-atomic",
- "portable-atomic-util",
- "serde_core",
-]
+checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
[[package]]
-name = "jiff-static"
-version = "0.2.23"
+name = "jobserver"
+version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a8c8b344124222efd714b73bb41f8b5120b27a7cc1c75593a6ff768d9d05aa4"
+checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33"
dependencies = [
- "proc-macro2",
- "quote",
- "syn",
+ "getrandom 0.3.4",
+ "libc",
]
[[package]]
@@ -1292,6 +1953,33 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "kanal"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9e3953adf0cd667798b396c2fa13552d6d9b3269d7dd1154c4c416442d1ff574"
+dependencies = [
+ "futures-core",
+ "lock_api",
+]
+
+[[package]]
+name = "kasuari"
+version = "0.4.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bde5057d6143cc94e861d90f591b9303d6716c6b9602309150bd068853c10899"
+dependencies = [
+ "hashbrown 0.16.1",
+ "portable-atomic",
+ "thiserror 2.0.18",
+]
+
+[[package]]
+name = "lab"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf36173d4167ed999940f804952e6b08197cae5ad5d572eb4db150ce8ad5d58f"
+
[[package]]
name = "lazy-regex"
version = "3.5.1"
@@ -1312,7 +2000,7 @@ dependencies = [
"proc-macro2",
"quote",
"regex",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -1321,6 +2009,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+[[package]]
+name = "lebe"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a79a3332a6609480d7d0c9eab957bca6b455b91bb84e66d19f5ff66294b85b8"
+
[[package]]
name = "libc"
version = "0.2.186"
@@ -1328,17 +2022,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
[[package]]
-name = "libredox"
-version = "0.1.12"
+name = "libfuzzer-sys"
+version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616"
+checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2"
dependencies = [
- "bitflags 2.10.0",
- "libc",
+ "arbitrary",
+ "cc",
]
[[package]]
-name = "linux-raw-sys"
+name = "libm"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
+
+[[package]]
+name = "libmimalloc-sys"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870"
+dependencies = [
+ "cc",
+ "libc",
+]
+
+[[package]]
+name = "libredox"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616"
+dependencies = [
+ "bitflags 2.13.0",
+ "libc",
+]
+
+[[package]]
+name = "line-clipping"
+version = "0.3.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f50e8f47623268b5407192d26876c4d7f89d686ca130fdc53bced4814cd29f8"
+dependencies = [
+ "bitflags 2.13.0",
+]
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.4.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
+
+[[package]]
+name = "linux-raw-sys"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
@@ -1364,6 +2099,34 @@ version = "0.4.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a"
+[[package]]
+name = "loop9"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062"
+dependencies = [
+ "imgref",
+]
+
+[[package]]
+name = "lru"
+version = "0.18.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8a860605968fce16869fd239cf4237a82f3ac470723415db603b0e8b6c8d4fb9"
+dependencies = [
+ "hashbrown 0.17.0",
+]
+
+[[package]]
+name = "mac_address"
+version = "1.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0aeb26bf5e836cc1c341c8106051b573f1766dfa05aa87f0b98be5e51b02303"
+dependencies = [
+ "nix 0.29.0",
+ "winapi",
+]
+
[[package]]
name = "matchers"
version = "0.2.0"
@@ -1373,11 +2136,27 @@ dependencies = [
"regex-automata",
]
+[[package]]
+name = "maybe-rayon"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519"
+dependencies = [
+ "cfg-if",
+ "rayon",
+]
+
[[package]]
name = "memchr"
-version = "2.7.6"
+version = "2.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
+
+[[package]]
+name = "memmem"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
+checksum = "a64a92489e2744ce060c349162be1c5f33c6969234104dbd99ddb5feb08b8c15"
[[package]]
name = "memo-map"
@@ -1385,6 +2164,24 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b"
+[[package]]
+name = "memoffset"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
+dependencies = [
+ "autocfg",
+]
+
+[[package]]
+name = "mimalloc"
+version = "0.1.48"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8"
+dependencies = [
+ "libmimalloc-sys",
+]
+
[[package]]
name = "minijinja"
version = "2.20.0"
@@ -1410,11 +2207,21 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+[[package]]
+name = "miniz_oxide"
+version = "0.8.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
+dependencies = [
+ "adler2",
+ "simd-adler32",
+]
+
[[package]]
name = "mio"
-version = "1.1.1"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"
+checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
dependencies = [
"libc",
"log",
@@ -1430,13 +2237,29 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "moxcms"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b"
+dependencies = [
+ "num-traits",
+ "pxfm",
+]
+
+[[package]]
+name = "new_debug_unreachable"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
+
[[package]]
name = "nix"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"
dependencies = [
- "bitflags 2.10.0",
+ "bitflags 2.13.0",
"cfg-if",
"cfg_aliases 0.1.1",
"libc",
@@ -1448,10 +2271,11 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
- "bitflags 2.10.0",
+ "bitflags 2.13.0",
"cfg-if",
"cfg_aliases 0.2.1",
"libc",
+ "memoffset",
]
[[package]]
@@ -1460,12 +2284,21 @@ version = "0.31.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
dependencies = [
- "bitflags 2.10.0",
+ "bitflags 2.13.0",
"cfg-if",
"cfg_aliases 0.2.1",
"libc",
]
+[[package]]
+name = "no_std_io2"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "nohash-hasher"
version = "0.2.0"
@@ -1482,6 +2315,21 @@ dependencies = [
"minimal-lexical",
]
+[[package]]
+name = "nom"
+version = "8.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "noop_proc_macro"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
+
[[package]]
name = "normalize-path"
version = "0.2.1"
@@ -1497,12 +2345,53 @@ dependencies = [
"windows-sys 0.61.2",
]
+[[package]]
+name = "num-bigint"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
+dependencies = [
+ "num-integer",
+ "num-traits",
+]
+
[[package]]
name = "num-conv"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"
+[[package]]
+name = "num-derive"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "num-integer"
+version = "0.1.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "num-rational"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
+dependencies = [
+ "num-bigint",
+ "num-integer",
+ "num-traits",
+]
+
[[package]]
name = "num-traits"
version = "0.2.19"
@@ -1510,6 +2399,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
+ "libm",
]
[[package]]
@@ -1521,6 +2411,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "object"
+version = "0.37.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "once_cell"
version = "1.21.4"
@@ -1545,12 +2444,42 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
+[[package]]
+name = "ordered-float"
+version = "4.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951"
+dependencies = [
+ "num-traits",
+]
+
+[[package]]
+name = "ordered-float"
+version = "5.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7d950ca161dc355eaf28f82b11345ed76c6e1f6eb1f4f4479e0323b9e2fbd0e"
+dependencies = [
+ "num-traits",
+]
+
[[package]]
name = "osc8"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b2d2086a3a477709f0208181e65857a9c062064ab2b3bb9abaf64f17d148bf3"
+[[package]]
+name = "outref"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e"
+
+[[package]]
+name = "owo-colors"
+version = "4.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d"
+
[[package]]
name = "page_size"
version = "0.6.0"
@@ -1561,6 +2490,31 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "palette"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cbf71184cc5ecc2e4e1baccdb21026c20e5fc3dcf63028a086131b3ab00b6e6"
+dependencies = [
+ "approx",
+ "bytemuck",
+ "fast-srgb8",
+ "libm",
+ "palette_derive",
+]
+
+[[package]]
+name = "palette_derive"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f5030daf005bface118c096f510ffb781fc28f9ab6a32ab224d8631be6851d30"
+dependencies = [
+ "by_address",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
[[package]]
name = "parking_lot"
version = "0.12.5"
@@ -1584,6 +2538,18 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "paste"
+version = "1.0.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
+
+[[package]]
+name = "pastey"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec"
+
[[package]]
name = "path-slash"
version = "0.2.1"
@@ -1632,7 +2598,7 @@ dependencies = [
"pest_meta",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -1663,20 +2629,66 @@ checksum = "324239bd00dcf61f1a0e301d4d8f6f8c080a755248fc3fdc817ee1fdbbc27b8b"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
-name = "pin-project-lite"
-version = "0.2.16"
+name = "phf"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
+checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"
+dependencies = [
+ "phf_macros",
+ "phf_shared",
+]
[[package]]
-name = "pin-utils"
-version = "0.1.0"
+name = "phf_codegen"
+version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a"
+dependencies = [
+ "phf_generator",
+ "phf_shared",
+]
+
+[[package]]
+name = "phf_generator"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"
+dependencies = [
+ "phf_shared",
+ "rand 0.8.6",
+]
+
+[[package]]
+name = "phf_macros"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"
+dependencies = [
+ "phf_generator",
+ "phf_shared",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "phf_shared"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"
+dependencies = [
+ "siphasher",
+]
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
[[package]]
name = "plotters"
@@ -1707,19 +2719,23 @@ dependencies = [
]
[[package]]
-name = "portable-atomic"
-version = "1.13.0"
+name = "png"
+version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950"
+checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
+dependencies = [
+ "bitflags 2.13.0",
+ "crc32fast",
+ "fdeflate",
+ "flate2",
+ "miniz_oxide",
+]
[[package]]
-name = "portable-atomic-util"
-version = "0.2.4"
+name = "portable-atomic"
+version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
-dependencies = [
- "portable-atomic",
-]
+checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950"
[[package]]
name = "portable-pty"
@@ -1764,7 +2780,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
dependencies = [
"proc-macro2",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -1785,75 +2801,352 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "profiling"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5"
+dependencies = [
+ "profiling-procmacros",
+]
+
+[[package]]
+name = "profiling-procmacros"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb"
+dependencies = [
+ "quote",
+ "syn 2.0.117",
+]
+
[[package]]
name = "pulldown-cmark"
-version = "0.13.3"
+version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c3a14896dfa883796f1cb410461aef38810ea05f2b2c33c5aded3649095fdad"
+checksum = "e9f068eba8e7071c5f9511831b44f32c740d5adf574e990f946ddb53db2f314e"
dependencies = [
- "bitflags 2.10.0",
+ "bitflags 2.13.0",
"memchr",
"unicase",
]
+[[package]]
+name = "pxfm"
+version = "0.1.29"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e0c5ccf5294c6ccd63a74f1565028353830a9c2f5eb0c682c355c471726a6e3f"
+
+[[package]]
+name = "qoi"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7f6d64c71eb498fe9eae14ce4ec935c555749aef511cca85b5568910d6e48001"
+dependencies = [
+ "bytemuck",
+]
+
+[[package]]
+name = "quantette"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c98fecda8b16396ff9adac67644a523dd1778c42b58606a29df5c31ca925d174"
+dependencies = [
+ "bitvec",
+ "bytemuck",
+ "image",
+ "libm",
+ "num-traits",
+ "ordered-float 5.3.0",
+ "palette",
+ "rand 0.9.4",
+ "rand_xoshiro",
+ "rayon",
+ "ref-cast",
+ "wide",
+]
+
+[[package]]
+name = "quick-error"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3"
+
[[package]]
name = "quote"
version = "1.0.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
+checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "r-efi"
+version = "5.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
+
+[[package]]
+name = "r-efi"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
+
+[[package]]
+name = "radium"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
+
+[[package]]
+name = "rand"
+version = "0.8.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
+dependencies = [
+ "libc",
+ "rand_chacha 0.3.1",
+ "rand_core 0.6.4",
+]
+
+[[package]]
+name = "rand"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
+dependencies = [
+ "rand_chacha 0.9.0",
+ "rand_core 0.9.5",
+]
+
+[[package]]
+name = "rand"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207"
+dependencies = [
+ "rand_core 0.10.1",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.6.4",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
+dependencies = [
+ "ppv-lite86",
+ "rand_core 0.9.5",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+dependencies = [
+ "getrandom 0.2.17",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.9.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
+dependencies = [
+ "getrandom 0.3.4",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
+
+[[package]]
+name = "rand_xoshiro"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41"
+dependencies = [
+ "rand_core 0.9.5",
+]
+
+[[package]]
+name = "ratatui"
+version = "0.30.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1695748e3a735b34968c887ceea5a380b43545903868ae8f5b666593100f6b68"
+dependencies = [
+ "instability",
+ "ratatui-core",
+ "ratatui-crossterm",
+ "ratatui-macros",
+ "ratatui-termwiz",
+ "ratatui-widgets",
+ "serde",
+]
+
+[[package]]
+name = "ratatui-core"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "42d3603f354bba8c595fa47860e60142d7372b7210c27044c6a7d0e1a4336b44"
+dependencies = [
+ "bitflags 2.13.0",
+ "compact_str",
+ "critical-section",
+ "hashbrown 0.17.0",
+ "indoc",
+ "itertools 0.14.0",
+ "kasuari",
+ "lru",
+ "palette",
+ "serde",
+ "strum",
+ "thiserror 2.0.18",
+ "unicode-segmentation",
+ "unicode-truncate",
+ "unicode-width 0.2.2",
+]
+
+[[package]]
+name = "ratatui-crossterm"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b2867bedcbd6a690ca4f8672a687b730ec07660c79844517b084311b529980c"
+dependencies = [
+ "cfg-if",
+ "crossterm",
+ "instability",
+ "ratatui-core",
+]
+
+[[package]]
+name = "ratatui-image"
+version = "11.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f522f51185b7f2a2a76658dfb3f3995d35a85908afa559595c468b48f30ed6de"
dependencies = [
- "proc-macro2",
+ "base64-simd",
+ "icy_sixel",
+ "image",
+ "rand 0.8.6",
+ "ratatui",
+ "rustix 0.38.44",
+ "self_cell",
+ "thiserror 1.0.69",
+ "windows 0.58.0",
]
[[package]]
-name = "r-efi"
-version = "5.3.0"
+name = "ratatui-macros"
+version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
+checksum = "80fac59720679490d89d200df411faa249be728681adcabed3d047ae72c48f1d"
+dependencies = [
+ "ratatui-core",
+ "ratatui-widgets",
+]
[[package]]
-name = "rand"
-version = "0.9.4"
+name = "ratatui-termwiz"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea"
+checksum = "386b8ff8f74ed749509391c56d549761a2fcdb408e1f42e467286bcb7dac8967"
dependencies = [
- "rand_chacha",
- "rand_core 0.9.5",
+ "ratatui-core",
+ "termwiz",
]
[[package]]
-name = "rand"
-version = "0.10.1"
+name = "ratatui-widgets"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207"
+checksum = "7ef4f17dd7ac3abf5adc2b920a03c61eee4bfe6a88fa5191936895525371d79c"
dependencies = [
- "rand_core 0.10.1",
+ "bitflags 2.13.0",
+ "hashbrown 0.17.0",
+ "indoc",
+ "instability",
+ "itertools 0.14.0",
+ "line-clipping",
+ "ratatui-core",
+ "serde",
+ "strum",
+ "time",
+ "unicode-segmentation",
+ "unicode-width 0.2.2",
]
[[package]]
-name = "rand_chacha"
-version = "0.9.0"
+name = "rav1e"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"
+checksum = "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b"
dependencies = [
- "ppv-lite86",
- "rand_core 0.9.5",
+ "aligned-vec",
+ "arbitrary",
+ "arg_enum_proc_macro",
+ "arrayvec",
+ "av-scenechange",
+ "av1-grain",
+ "bitstream-io",
+ "built",
+ "cfg-if",
+ "interpolate_name",
+ "itertools 0.14.0",
+ "libc",
+ "libfuzzer-sys",
+ "log",
+ "maybe-rayon",
+ "new_debug_unreachable",
+ "noop_proc_macro",
+ "num-derive",
+ "num-traits",
+ "paste",
+ "profiling",
+ "rand 0.9.4",
+ "rand_chacha 0.9.0",
+ "simd_helpers",
+ "thiserror 2.0.18",
+ "v_frame",
+ "wasm-bindgen",
]
[[package]]
-name = "rand_core"
-version = "0.9.5"
+name = "ravif"
+version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"
+checksum = "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45"
dependencies = [
- "getrandom 0.3.4",
+ "avif-serialize",
+ "imgref",
+ "loop9",
+ "quick-error",
+ "rav1e",
+ "rayon",
+ "rgb",
]
[[package]]
-name = "rand_core"
-version = "0.10.1"
+name = "raw-cpuid"
+version = "11.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
+checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186"
+dependencies = [
+ "bitflags 2.13.0",
+]
[[package]]
name = "rayon"
@@ -1876,23 +3169,18 @@ dependencies = [
]
[[package]]
-name = "redox_syscall"
-version = "0.5.18"
+name = "recvmsg"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
-dependencies = [
- "bitflags 2.10.0",
-]
+checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175"
[[package]]
-name = "redox_users"
-version = "0.4.6"
+name = "redox_syscall"
+version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
dependencies = [
- "getrandom 0.2.17",
- "libredox",
- "thiserror 1.0.69",
+ "bitflags 2.13.0",
]
[[package]]
@@ -1923,7 +3211,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -1934,8 +3222,8 @@ checksum = "13362233b147e57674c37b802d216b7c5e3dcccbed8967c84f0d8d223868ae27"
dependencies = [
"cfg-if",
"libc",
- "rustix",
- "windows",
+ "rustix 1.1.4",
+ "windows 0.62.2",
]
[[package]]
@@ -1983,6 +3271,32 @@ dependencies = [
"tempfile",
]
+[[package]]
+name = "rgb"
+version = "0.8.53"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4"
+
+[[package]]
+name = "roff"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "323c417e1d9665a65b263ec744ba09030cfb277e9daa0b018a4ab62e57bc8189"
+
+[[package]]
+name = "ron"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4147b952f3f819eca0e99527022f7d6a8d05f111aeb0a62960c74eb283bec8fc"
+dependencies = [
+ "bitflags 2.13.0",
+ "once_cell",
+ "serde",
+ "serde_derive",
+ "typeid",
+ "unicode-ident",
+]
+
[[package]]
name = "rstest"
version = "0.26.1"
@@ -2008,10 +3322,16 @@ dependencies = [
"regex",
"relative-path",
"rustc_version",
- "syn",
+ "syn 2.0.117",
"unicode-ident",
]
+[[package]]
+name = "rustc-demangle"
+version = "0.1.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d"
+
[[package]]
name = "rustc-hash"
version = "2.1.1"
@@ -2027,16 +3347,29 @@ dependencies = [
"semver",
]
+[[package]]
+name = "rustix"
+version = "0.38.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
+dependencies = [
+ "bitflags 2.13.0",
+ "errno",
+ "libc",
+ "linux-raw-sys 0.4.15",
+ "windows-sys 0.59.0",
+]
+
[[package]]
name = "rustix"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
dependencies = [
- "bitflags 2.10.0",
+ "bitflags 2.13.0",
"errno",
"libc",
- "linux-raw-sys",
+ "linux-raw-sys 0.12.1",
"windows-sys 0.61.2",
]
@@ -2046,6 +3379,21 @@ version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
+[[package]]
+name = "ryu"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
+
+[[package]]
+name = "safe_arch"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "629516c85c29fe757770fa03f2074cf1eac43d44c02a3de9fc2ef7b0e207dfdd"
+dependencies = [
+ "bytemuck",
+]
+
[[package]]
name = "same-file"
version = "1.0.6"
@@ -2086,7 +3434,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde_derive_internals",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -2095,6 +3443,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
+[[package]]
+name = "self_cell"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b12e76d157a900eb52e81bc6e9f3069344290341720e9178cde2407113ac8d89"
+
[[package]]
name = "semver"
version = "1.0.27"
@@ -2128,7 +3482,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -2139,7 +3493,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -2294,6 +3648,27 @@ dependencies = [
"libc",
]
+[[package]]
+name = "simd-adler32"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
+
+[[package]]
+name = "simd_helpers"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6"
+dependencies = [
+ "quote",
+]
+
+[[package]]
+name = "simdutf8"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
+
[[package]]
name = "similar"
version = "2.7.0"
@@ -2309,69 +3684,88 @@ dependencies = [
"bstr",
]
+[[package]]
+name = "siphasher"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"
+
[[package]]
name = "skim"
-version = "0.20.5"
+version = "4.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60e10a7f70e8e532d8780d88210055e15e12d0df431bf5dab7bb1ed22b6fb4f2"
+checksum = "7639ff092ac35942237f995d926ba3bbf242d9225f7720a4b2e1d03ca5f9a049"
dependencies = [
- "beef",
- "bitflags 1.3.2",
- "chrono",
- "clap",
- "clap_complete",
- "crossbeam",
- "defer-drop",
+ "ansi-to-tui",
+ "assert_enum_variants",
+ "cfg_aliases 0.2.1",
+ "clap_complete_nushell",
+ "color-eyre",
+ "crossterm",
"derive_builder",
- "env_logger",
- "fuzzy-matcher",
+ "derive_more",
+ "frizbee",
+ "futures",
+ "image",
"indexmap",
+ "interprocess",
+ "kanal",
"log",
- "nix 0.29.0",
- "rand 0.9.4",
- "rayon",
+ "memchr",
+ "mimalloc",
+ "nix 0.31.3",
+ "portable-pty",
+ "ratatui",
+ "ratatui-image",
"regex",
+ "roff",
+ "ron",
+ "serde",
"shell-quote",
- "shlex",
- "skim-common",
- "skim-tuikit",
- "time",
- "timer",
- "unicode-width 0.2.2",
- "vte 0.15.0",
- "which 7.0.3",
+ "tempfile",
+ "thiserror 2.0.18",
+ "thread_local",
+ "tokio",
+ "tokio-util",
+ "tui-term",
+ "unicode-display-width",
+ "unicode-normalization",
+ "which",
]
[[package]]
-name = "skim-common"
-version = "0.2.0"
+name = "slab"
+version = "0.4.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
+
+[[package]]
+name = "smallvec"
+version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8312ae7ca1a5883e68042b9c6bce05bfc12f06b814ecfda06c34abfb6c88175"
+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
-name = "skim-tuikit"
-version = "0.6.6"
+name = "socket2"
+version = "0.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51"
dependencies = [
- "bitflags 1.3.2",
- "lazy_static",
- "log",
- "nix 0.29.0",
- "skim-common",
- "term",
- "unicode-width 0.2.2",
+ "libc",
+ "windows-sys 0.61.2",
]
[[package]]
-name = "slab"
-version = "0.4.11"
+name = "stable_deref_trait"
+version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
+checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
-name = "smallvec"
-version = "1.15.1"
+name = "static_assertions"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "streaming-iterator"
@@ -2430,7 +3824,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -2439,6 +3833,17 @@ version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91"
+[[package]]
+name = "syn"
+version = "1.0.109"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
[[package]]
name = "syn"
version = "2.0.117"
@@ -2472,6 +3877,12 @@ dependencies = [
"unicode-width 0.2.2",
]
+[[package]]
+name = "tap"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
+
[[package]]
name = "tempfile"
version = "3.27.0"
@@ -2481,21 +3892,10 @@ dependencies = [
"fastrand",
"getrandom 0.3.4",
"once_cell",
- "rustix",
+ "rustix 1.1.4",
"windows-sys 0.61.2",
]
-[[package]]
-name = "term"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
-dependencies = [
- "dirs-next",
- "rustversion",
- "winapi",
-]
-
[[package]]
name = "termimad"
version = "0.34.1"
@@ -2518,10 +3918,73 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874"
dependencies = [
- "rustix",
+ "rustix 1.1.4",
"windows-sys 0.61.2",
]
+[[package]]
+name = "terminfo"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4ea810f0692f9f51b382fff5893887bb4580f5fa246fde546e0b13e7fcee662"
+dependencies = [
+ "fnv",
+ "nom 7.1.3",
+ "phf",
+ "phf_codegen",
+]
+
+[[package]]
+name = "termios"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "termwiz"
+version = "0.23.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4676b37242ccbd1aabf56edb093a4827dc49086c0ffd764a5705899e0f35f8f7"
+dependencies = [
+ "anyhow",
+ "base64",
+ "bitflags 2.13.0",
+ "fancy-regex",
+ "filedescriptor",
+ "finl_unicode",
+ "fixedbitset",
+ "hex",
+ "lazy_static",
+ "libc",
+ "log",
+ "memmem",
+ "nix 0.29.0",
+ "num-derive",
+ "num-traits",
+ "ordered-float 4.6.0",
+ "pest",
+ "pest_derive",
+ "phf",
+ "sha2 0.10.9",
+ "signal-hook 0.3.18",
+ "siphasher",
+ "terminfo",
+ "termios",
+ "thiserror 1.0.69",
+ "ucd-trie",
+ "unicode-segmentation",
+ "vtparse",
+ "wezterm-bidi",
+ "wezterm-blob-leases",
+ "wezterm-color-types",
+ "wezterm-dynamic",
+ "wezterm-input-types",
+ "winapi",
+]
+
[[package]]
name = "thiserror"
version = "1.0.69"
@@ -2548,7 +4011,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -2559,7 +4022,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -2571,6 +4034,20 @@ dependencies = [
"cfg-if",
]
+[[package]]
+name = "tiff"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52"
+dependencies = [
+ "fax",
+ "flate2",
+ "half",
+ "quick-error",
+ "weezl",
+ "zune-jpeg",
+]
+
[[package]]
name = "time"
version = "0.3.47"
@@ -2600,27 +4077,72 @@ version = "0.2.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215"
dependencies = [
- "num-conv",
- "time-core",
+ "num-conv",
+ "time-core",
+]
+
+[[package]]
+name = "tinytemplate"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
+dependencies = [
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
+name = "tokio"
+version = "1.52.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe"
+dependencies = [
+ "bytes",
+ "libc",
+ "mio",
+ "pin-project-lite",
+ "socket2",
+ "tokio-macros",
+ "windows-sys 0.61.2",
]
[[package]]
-name = "timer"
-version = "0.2.0"
+name = "tokio-macros"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31d42176308937165701f50638db1c31586f183f1aab416268216577aec7306b"
+checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"
dependencies = [
- "chrono",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
]
[[package]]
-name = "tinytemplate"
-version = "1.2.1"
+name = "tokio-util"
+version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
+checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"
dependencies = [
- "serde",
- "serde_json",
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "pin-project-lite",
+ "tokio",
]
[[package]]
@@ -2717,7 +4239,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -2730,6 +4252,16 @@ dependencies = [
"valuable",
]
+[[package]]
+name = "tracing-error"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db"
+dependencies = [
+ "tracing",
+ "tracing-subscriber",
+]
+
[[package]]
name = "tracing-log"
version = "0.2.0"
@@ -2799,6 +4331,23 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae62f7eae5eb549c71b76658648b72cc6111f2d87d24a1e31fa907f4943e3ce"
+[[package]]
+name = "tui-term"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a338ded85dbe7f9ea2298321d126244f54e531e2b2006b97abdab8e47d6f3c88"
+dependencies = [
+ "ratatui-core",
+ "ratatui-widgets",
+ "vt100",
+]
+
+[[package]]
+name = "typeid"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
+
[[package]]
name = "typenum"
version = "1.19.0"
@@ -2817,18 +4366,47 @@ version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
+[[package]]
+name = "unicode-display-width"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a43273b656140aa2bb8e65351fe87c255f0eca706b2538a9bd4a590a3490bf3"
+dependencies = [
+ "unicode-segmentation",
+]
+
[[package]]
name = "unicode-ident"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
+[[package]]
+name = "unicode-normalization"
+version = "0.1.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
+dependencies = [
+ "tinyvec",
+]
+
[[package]]
name = "unicode-segmentation"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
+[[package]]
+name = "unicode-truncate"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5"
+dependencies = [
+ "itertools 0.14.0",
+ "unicode-segmentation",
+ "unicode-width 0.2.2",
+]
+
[[package]]
name = "unicode-width"
version = "0.1.14"
@@ -2841,6 +4419,12 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
+[[package]]
+name = "unicode-xid"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
+
[[package]]
name = "urlencoding"
version = "2.1.3"
@@ -2853,6 +4437,29 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
+[[package]]
+name = "uuid"
+version = "1.23.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "144d6b123cef80b301b8f72a9e2ca4370ddec21950d0a103dd22c437006d2db7"
+dependencies = [
+ "atomic",
+ "getrandom 0.4.3",
+ "js-sys",
+ "wasm-bindgen",
+]
+
+[[package]]
+name = "v_frame"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2"
+dependencies = [
+ "aligned-vec",
+ "num-traits",
+ "wasm-bindgen",
+]
+
[[package]]
name = "valuable"
version = "0.1.1"
@@ -2903,6 +4510,12 @@ version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+[[package]]
+name = "vsimd"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64"
+
[[package]]
name = "vt100"
version = "0.16.2"
@@ -2934,6 +4547,15 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "vtparse"
+version = "0.6.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d9b2acfb050df409c972a37d3b8e08cdea3bddb0c09db9d53137e504cfabed0"
+dependencies = [
+ "utf8parse",
+]
+
[[package]]
name = "wait-timeout"
version = "0.2.1"
@@ -3000,7 +4622,7 @@ dependencies = [
"bumpalo",
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
"wasm-bindgen-shared",
]
@@ -3024,15 +4646,81 @@ dependencies = [
]
[[package]]
-name = "which"
-version = "7.0.3"
+name = "weezl"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
+
+[[package]]
+name = "wezterm-bidi"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762"
+checksum = "0c0a6e355560527dd2d1cf7890652f4f09bb3433b6aadade4c9b5ed76de5f3ec"
dependencies = [
- "either",
- "env_home",
- "rustix",
- "winsafe",
+ "log",
+ "wezterm-dynamic",
+]
+
+[[package]]
+name = "wezterm-blob-leases"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "692daff6d93d94e29e4114544ef6d5c942a7ed998b37abdc19b17136ea428eb7"
+dependencies = [
+ "getrandom 0.3.4",
+ "mac_address",
+ "sha2 0.10.9",
+ "thiserror 1.0.69",
+ "uuid",
+]
+
+[[package]]
+name = "wezterm-color-types"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7de81ef35c9010270d63772bebef2f2d6d1f2d20a983d27505ac850b8c4b4296"
+dependencies = [
+ "csscolorparser",
+ "deltae",
+ "lazy_static",
+ "wezterm-dynamic",
+]
+
+[[package]]
+name = "wezterm-dynamic"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5f2ab60e120fd6eaa68d9567f3226e876684639d22a4219b313ff69ec0ccd5ac"
+dependencies = [
+ "log",
+ "ordered-float 4.6.0",
+ "strsim",
+ "thiserror 1.0.69",
+ "wezterm-dynamic-derive",
+]
+
+[[package]]
+name = "wezterm-dynamic-derive"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46c0cf2d539c645b448eaffec9ec494b8b19bd5077d9e58cb1ae7efece8d575b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "wezterm-input-types"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7012add459f951456ec9d6c7e6fc340b1ce15d6fc9629f8c42853412c029e57e"
+dependencies = [
+ "bitflags 1.3.2",
+ "euclid",
+ "lazy_static",
+ "serde",
+ "wezterm-dynamic",
]
[[package]]
@@ -3044,6 +4732,22 @@ dependencies = [
"libc",
]
+[[package]]
+name = "wide"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13ca908d26e4786149c48efcf6c0ea09ab0e06d1fe3c17dc1b4b0f1ca4a7e788"
+dependencies = [
+ "bytemuck",
+ "safe_arch",
+]
+
+[[package]]
+name = "widestring"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471"
+
[[package]]
name = "winapi"
version = "0.3.9"
@@ -3075,6 +4779,16 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+[[package]]
+name = "windows"
+version = "0.58.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
+dependencies = [
+ "windows-core 0.58.0",
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows"
version = "0.62.2"
@@ -3082,7 +4796,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
dependencies = [
"windows-collections",
- "windows-core",
+ "windows-core 0.62.2",
"windows-future",
"windows-numerics",
]
@@ -3093,7 +4807,20 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
dependencies = [
- "windows-core",
+ "windows-core 0.62.2",
+]
+
+[[package]]
+name = "windows-core"
+version = "0.58.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
+dependencies = [
+ "windows-implement 0.58.0",
+ "windows-interface 0.58.0",
+ "windows-result 0.2.0",
+ "windows-strings 0.1.0",
+ "windows-targets 0.52.6",
]
[[package]]
@@ -3102,11 +4829,11 @@ version = "0.62.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
dependencies = [
- "windows-implement",
- "windows-interface",
+ "windows-implement 0.60.2",
+ "windows-interface 0.59.3",
"windows-link",
- "windows-result",
- "windows-strings",
+ "windows-result 0.4.1",
+ "windows-strings 0.5.1",
]
[[package]]
@@ -3115,11 +4842,22 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
dependencies = [
- "windows-core",
+ "windows-core 0.62.2",
"windows-link",
"windows-threading",
]
+[[package]]
+name = "windows-implement"
+version = "0.58.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
+]
+
[[package]]
name = "windows-implement"
version = "0.60.2"
@@ -3128,7 +4866,18 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
+]
+
+[[package]]
+name = "windows-interface"
+version = "0.58.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.117",
]
[[package]]
@@ -3139,7 +4888,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -3154,10 +4903,19 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
dependencies = [
- "windows-core",
+ "windows-core 0.62.2",
"windows-link",
]
+[[package]]
+name = "windows-result"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-result"
version = "0.4.1"
@@ -3167,6 +4925,16 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "windows-strings"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
+dependencies = [
+ "windows-result 0.2.0",
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-strings"
version = "0.5.1"
@@ -3176,13 +4944,22 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "windows-sys"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-sys"
version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
dependencies = [
- "windows-targets",
+ "windows-targets 0.53.5",
]
[[package]]
@@ -3194,6 +4971,22 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
+ "windows_i686_gnullvm 0.52.6",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
+]
+
[[package]]
name = "windows-targets"
version = "0.53.5"
@@ -3201,14 +4994,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
dependencies = [
"windows-link",
- "windows_aarch64_gnullvm",
- "windows_aarch64_msvc",
- "windows_i686_gnu",
- "windows_i686_gnullvm",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_gnullvm",
- "windows_x86_64_msvc",
+ "windows_aarch64_gnullvm 0.53.1",
+ "windows_aarch64_msvc 0.53.1",
+ "windows_i686_gnu 0.53.1",
+ "windows_i686_gnullvm 0.53.1",
+ "windows_i686_msvc 0.53.1",
+ "windows_x86_64_gnu 0.53.1",
+ "windows_x86_64_gnullvm 0.53.1",
+ "windows_x86_64_msvc 0.53.1",
]
[[package]]
@@ -3220,48 +5013,96 @@ dependencies = [
"windows-link",
]
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
[[package]]
name = "windows_i686_gnu"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
[[package]]
name = "windows_i686_gnullvm"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
[[package]]
name = "windows_i686_msvc"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.53.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.53.1"
@@ -3295,12 +5136,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "winsafe"
-version = "0.0.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"
-
[[package]]
name = "wit-bindgen"
version = "0.51.0"
@@ -3313,6 +5148,7 @@ version = "0.60.0"
dependencies = [
"ansi-str",
"ansi-to-html",
+ "ansi-to-tui",
"anstream",
"anstyle",
"anyhow",
@@ -3345,6 +5181,7 @@ dependencies = [
"pathdiff",
"petname",
"portable-pty",
+ "ratatui",
"rayon",
"reflink-copy",
"regex",
@@ -3367,6 +5204,7 @@ dependencies = [
"tempfile",
"termimad",
"terminal_size",
+ "tokio",
"toml",
"toml_edit 0.25.5+spec-1.1.0",
"tracing",
@@ -3380,7 +5218,7 @@ dependencies = [
"vergen-gitcl",
"vt100",
"wait-timeout",
- "which 8.0.3",
+ "which",
"wrap-ansi",
"wt-perf",
]
@@ -3410,6 +5248,21 @@ dependencies = [
"worktrunk",
]
+[[package]]
+name = "wyz"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
+dependencies = [
+ "tap",
+]
+
+[[package]]
+name = "y4m"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448"
+
[[package]]
name = "zerocopy"
version = "0.8.33"
@@ -3427,7 +5280,7 @@ checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1"
dependencies = [
"proc-macro2",
"quote",
- "syn",
+ "syn 2.0.117",
]
[[package]]
@@ -3435,3 +5288,27 @@ name = "zmij"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65"
+
+[[package]]
+name = "zune-core"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cb8a0807f7c01457d0379ba880ba6322660448ddebc890ce29bb64da71fb40f9"
+
+[[package]]
+name = "zune-inflate"
+version = "0.2.54"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02"
+dependencies = [
+ "simd-adler32",
+]
+
+[[package]]
+name = "zune-jpeg"
+version = "0.5.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296"
+dependencies = [
+ "zune-core",
+]
diff --git a/Cargo.toml b/Cargo.toml
index 2cf3d306f..3102f9715 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -83,6 +83,9 @@ cli = [
"dep:crossterm",
"dep:humantime",
"dep:skim",
+ "dep:ratatui",
+ "dep:ansi-to-tui",
+ "dep:tokio",
"dep:termimad",
"dep:tracing-log",
"dep:tracing-subscriber",
@@ -132,14 +135,21 @@ path = "tests/integration.rs"
required-features = ["cli", "syntax-highlighting"]
[dependencies]
-anyhow = "1.0"
+anyhow = "1.0.102"
anstream = "1.0"
-anstyle = "1.0"
+anstyle = "1.0.13"
ansi-str = "0.9"
color-print = "0.3.7"
askama = { version = "0.16", default-features = false, features = ["derive", "std"] }
-chrono = "0.4"
-clap = { version = "4.6", features = ["derive", "unstable-ext", "wrap_help"], optional = true }
+# Floor is 0.4.31, not 0.4: `DateTime::from_timestamp` (utils.rs, statusline.rs,
+# backup.rs) landed in chrono 0.4.31. `-Z minimal-versions` otherwise resolves
+# 0.4.0 and our own lib fails to compile.
+chrono = "0.4.31"
+# `unstable-markdown` renders our `///` doc-comments as styled help (bold inline
+# code, literal `[experimental]`). skim 0.20 pulled it in transitively; skim 4
+# (default-features = false) does not, so depend on it explicitly to keep help
+# output stable rather than reverting to raw text.
+clap = { version = "4.6", features = ["derive", "unstable-ext", "wrap_help", "unstable-markdown"], optional = true }
clap_complete = { version = "4.6", features = ["unstable-dynamic"], optional = true }
crossbeam-channel = "0.5"
crossterm = { version = "0.29", optional = true }
@@ -147,11 +157,11 @@ indexmap = { version = "2.14", features = ["serde"] }
etcetera = "0.11"
# `log` is still used pervasively for application logging; events flow into
# `tracing` via `tracing-log::LogTracer` (CLI binary only).
-log = "0.4"
+log = "0.4.31"
# 0.1.30 added the `enabled!` macro `src/trace/emit.rs::Span::drop` uses to
# elide span emission when the subscriber doesn't care. Older versions only
# expose the per-level macros and dispatcher checks.
-tracing = "0.1.30"
+tracing = "0.1.35"
# Compatibility shim: forward `log::*` macros into `tracing`. ~100 call sites
# across the codebase keep using `log::debug!` etc.; only the routing layer
# moved.
@@ -165,14 +175,14 @@ tracing-subscriber = { version = "0.3.17", default-features = false, features =
# Only enable needed features - saves ~200KB by excluding debug, macros, multi_template
minijinja = { version = "2.20", default-features = false, features = ["builtins", "serde", "std_collections"] }
rayon = "1.12"
-serde = { version = "1.0", features = ["derive"] }
-serde_json = "1.0"
+serde = { version = "1.0.228", features = ["derive"] }
+serde_json = "1.0.145"
shell-escape = "0.1"
shellexpand = "3.1"
-strsim = "0.11"
+strsim = "0.11.1"
strum = { version = "0.28", features = ["derive"] }
synoptic = "2"
-terminal_size = "0.4"
+terminal_size = "0.4.3"
toml = { version = "1.0", features = ["preserve_order"] }
toml_edit = { version = "0.25", features = ["serde"] }
# tree-sitter and tree-sitter-highlight should use matching versions.
@@ -182,24 +192,24 @@ toml_edit = { version = "0.25", features = ["serde"] }
tree-sitter = { version = "0.26", optional = true }
tree-sitter-bash = { version = "0.25.1", optional = true }
tree-sitter-highlight = { version = "0.26", optional = true }
-unicode-width = "0.2"
+unicode-width = "0.2.1"
wrap-ansi = "0.1"
osc8 = "0.1.0"
supports-hyperlinks = "3"
home = "0.5.12"
humantime = { version = "2.2", optional = true }
-once_cell = "1.21"
+once_cell = "1.21.4"
dirs = "6.0"
normalize-path = "0.2.1"
path-slash = "0.2"
pathdiff = "0.2"
-which = "8.0"
+which = "8.0.2"
# Cross-platform path canonicalization that avoids Windows verbatim paths (\\?\)
# which external tools like git cannot handle. On Unix, it's a no-op wrapper.
dunce = "1.0"
termimad = { version = "0.34.1", optional = true }
urlencoding = "2.1"
-regex = "1.12"
+regex = "1.12.3"
ignore = "0.4"
reflink-copy = "0.1"
# Atomic, no-overwrite rename (renameat2 / renamex_np / MoveFileExW) for
@@ -226,17 +236,34 @@ tempfile = "3.27"
wait-timeout = "0.2"
[target.'cfg(unix)'.dependencies]
-# Pinned to the 0.20.x line. Newer skim releases (the 3.x / 4.x rewrite)
-# pin many of their direct dependencies with exact versions — e.g.,
-# `color-eyre = "=0.6.5"`, `derive_builder = "=0.20.2"`, `kanal = "=0.1.1"`,
-# `tokio-util = "=0.7.18"`, `unicode-normalization = "=0.1.25"`, and ~12
-# others. Depending on skim would lock worktrunk onto each of those exact
-# versions, so an upgrade blocks on upstream relaxing those pins.
-# Windows picker support (worktrunk#2223) landed in skim v4.3.0 but is
-# gated by the same constraint.
-skim = { version = "0.20", optional = true }
-nix = { version = "0.31", default-features = false, features = ["process", "signal"] }
-signal-hook = "0.4"
+# skim 4.x is the ratatui-based rewrite; the 0.20 line used the now-abandoned
+# tuikit backend (we previously vendored a patched skim-tuikit fork). The
+# picker feeds rows as a custom `SkimItem` whose `display()` returns a ratatui
+# `Line`, so `ratatui` + `ansi-to-tui` below convert the picker's pre-rendered
+# ANSI rows into styled lines.
+#
+# `default-features = false` drops skim's own CLI (`clap` / `clap_mangen` / …):
+# worktrunk embeds the picker as a library and never shells out to the `sk`
+# binary. `frizbee` keeps skim's default fuzzy matcher.
+# Floor is 4.8, not 4: the picker is written against 4.8's `ratatui 0.30.1`
+# API, and earlier 4.x compile against an incompatible ratatui (`-Z
+# minimal-versions` otherwise resolves skim 4.6 against ratatui 0.30.1 and fails
+# to build).
+skim = { version = "4.8", 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]`
+# attribute fails to compile).
+ratatui = { version = "0.30.1", optional = true }
+ansi-to-tui = { version = "8.0.1", optional = true }
+# Already in the tree via skim (its event loop is tokio-based). The picker drives
+# skim through the public `Skim::init`/`run` API rather than the all-in-one
+# `Skim::run_with` so it can grab `event_sender()` and push `Event::Render` while
+# collect mutates rows in place — skim 4.x renders on demand, not on a heartbeat.
+# `Runtime::new()` needs `rt-multi-thread`; `event_sender()` is a `sync::mpsc`.
+tokio = { version = "1.52.3", optional = true, default-features = false, features = ["rt-multi-thread", "sync"] }
+nix = { version = "0.31.3", default-features = false, features = ["process", "signal"] }
+signal-hook = "0.4.1"
[build-dependencies]
vergen-gitcl = { version = "10.0.0", features = ["build"] }
@@ -249,8 +276,8 @@ tempfile = "3.27"
toml = "1.0"
criterion = "0.8"
portable-pty = "0.9"
-regex = "1.12"
-vt100 = "0.16"
+regex = "1.12.3"
+vt100 = "0.16.2"
ansi-to-html = "0.2.3"
wt-perf = { path = "tests/helpers/wt-perf" }
similar = "3.1.1"
@@ -290,51 +317,3 @@ unsafe_code = "forbid"
[profile.dist]
inherits = "release"
lto = "thin"
-
-[patch.crates-io]
-# Local fork of skim-tuikit 0.6.6 carrying four small fixes. Run
-# `task vendor-diff` to see the full diff against the upstream tarball.
-#
-# Upstream status: skim-tuikit is effectively abandoned. Upstream skim
-# migrated to ratatui in skim-rs/skim#864 (merged 2026-01-12) and has
-# shipped several releases on the new backend; crates.io skim-tuikit is
-# frozen at 0.6.6 (Aug 2025) and will not receive another release. The
-# bugs below are resolved (or moot) in ratatui-era skim but not in the
-# vendored tuikit. These patches are permanent until we either migrate
-# our picker to a post-ratatui skim (breaking API change in
-# `src/commands/picker/`) or drop skim entirely.
-#
-# 1. Dropped-bytes bug in `Output::flush` — it used `write()` instead of
-# `write_all()`, so when the kernel accepted a partial write (common
-# under load or in tmux PTYs with small pipe buffers) the remainder of
-# the buffer was dropped by the subsequent `buffer.clear()`, leaving
-# the picker's first render missing whichever rows didn't fit in the
-# first chunk. See vendor/skim-tuikit/src/output.rs.
-#
-# 2. Asymmetric alternate-screen enter/exit in partial-height mode — in
-# full-height mode tuikit emits smcup on enter and rmcup on exit, but
-# in partial-height mode (e.g. `height("90%")`) it skips smcup yet
-# still emits rmcup on shutdown, leaving terminal artifacts. Fixed by
-# tracking whether smcup was actually emitted and gating rmcup on that
-# flag. See vendor/skim-tuikit/src/term.rs. Upstream bug was
-# skim-rs/skim#880, resolved via the ratatui migration rather than a
-# tuikit patch.
-#
-# 3. `usize` underflow panic in `Term::on_resize` — when the terminal is
-# smaller than the picker's preferred height, `screen_height - height`
-# underflowed and panicked with "attempt to subtract with overflow".
-# Reachable by running `wt switch` under `script(1)` with stdin closed,
-# or in any sufficiently small tmux pane. Fixed with `saturating_sub`,
-# which clamps `cursor_row` to 0 — matching the full-screen fallback
-# `ensure_height` already uses. See vendor/skim-tuikit/src/term.rs. No
-# known upstream tracking issue; moot post-ratatui.
-#
-# 4. `from_keyname` did not parse `alt-<digit>` tokens — it had `alt-a`..
-# `alt-z` but no `alt-0`..`alt-9`, so a keymap like `alt-1:...` silently
-# failed to bind (Input::bind early-returns on an unparseable key). The
-# input reader already decodes ESC-<digit> to `Alt(ch)`, so this was a
-# pure config-parser gap. The picker binds alt-1..alt-5 to jump directly
-# to preview tabs (bare digits are reserved for the query). Added the ten
-# missing arms, matching fzf's alt-1..alt-9. See
-# vendor/skim-tuikit/src/key.rs. Clean upstream PR candidate.
-skim-tuikit = { path = "vendor/skim-tuikit" }
diff --git a/Taskfile.yaml b/Taskfile.yaml
index 0c3b439d2..9fe719d73 100644
--- a/Taskfile.yaml
+++ b/Taskfile.yaml
@@ -13,29 +13,6 @@ tasks:
desc: Run tests with coverage report
cmd: cargo llvm-cov --html --features shell-integration-tests {{.CLI_ARGS}}
- vendor-diff:
- desc: Show the patch we carry in vendor/ vs the pristine upstream crate source
- cmds:
- - |
- set -e
- VENDORED=vendor/skim-tuikit
- if [ ! -d "$VENDORED" ]; then
- echo "no vendored source at $VENDORED"
- exit 0
- fi
- VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' "$VENDORED/Cargo.toml" | head -1)
- # Fetch the pristine tarball directly from crates.io rather than relying
- # on ~/.cargo/registry — `[patch.crates-io]` suppresses the download, so
- # that cache is never populated on a fresh checkout.
- TMP=$(mktemp -d)
- trap 'rm -rf "$TMP"' EXIT
- URL="https://static.crates.io/crates/skim-tuikit/skim-tuikit-${VERSION}.crate"
- if ! curl -sSfL "$URL" | tar -xz -C "$TMP"; then
- echo "failed to fetch pristine skim-tuikit-${VERSION} from $URL"
- exit 1
- fi
- diff -ruN "$TMP/skim-tuikit-${VERSION}" "$VENDORED" || true
-
setup-web:
desc: Setup Claude Code web environment for development
platforms: [linux]
diff --git a/flake.nix b/flake.nix
index 4c7d7c380..5a2880d2e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -56,19 +56,6 @@
|| (baseNameOf p == "gemini-extension.json");
};
- # Vendored path dependencies (vendor/skim-tuikit) need their real
- # source preserved during buildDepsOnly — crane's mkDummySrc stubs
- # all .rs files, but [patch.crates-io] path deps must compile for
- # downstream crates (skim) to resolve their imports. Kept as a
- # separate derivation so non-vendor source edits don't invalidate
- # the dependency cache.
- vendorSrc = pkgs.lib.cleanSourceWith {
- src = ./.;
- filter =
- path: _type:
- pkgs.lib.hasInfix "/vendor/" path || pkgs.lib.hasSuffix "/vendor" path;
- };
-
# Common arguments for crane builds
commonArgs = {
inherit src;
@@ -99,21 +86,7 @@
};
# Build just the cargo dependencies for caching.
- # extraDummyScript restores vendor/ after mkDummySrc stubs all .rs
- # files — without this, [patch.crates-io] path deps are empty crates.
- cargoArtifacts = craneLib.buildDepsOnly (
- commonArgs
- // {
- dummySrc = craneLib.mkDummySrc {
- src = commonArgs.src;
- extraDummyScript = ''
- rm -rf $out/vendor
- cp -r ${vendorSrc}/vendor $out/vendor
- chmod -R u+w $out/vendor
- '';
- };
- }
- );
+ cargoArtifacts = craneLib.buildDepsOnly commonArgs;
# Build the actual package
worktrunk = craneLib.buildPackage (
diff --git a/src/commands/list/collect/mod.rs b/src/commands/list/collect/mod.rs
index 73be63acd..847e3f92b 100644
--- a/src/commands/list/collect/mod.rs
+++ b/src/commands/list/collect/mod.rs
@@ -475,8 +475,8 @@ pub trait PickerProgressHandler: Send + Sync {
);
/// Fired after a single task result updates row `idx`. `rendered` is the
- /// new line — write it through the item's shared state so skim picks it
- /// up on the next heartbeat.
+ /// new line — write it through the item's shared state and wake the picker
+ /// to repaint (skim 4.x renders on demand, not on a timer).
fn on_update(&self, idx: usize, rendered: String);
/// Fired at the 200ms reveal deadline. One pre-rendered line per row,
@@ -1700,7 +1700,8 @@ pub fn collect(
log::debug!("Progressive table flush failed: {}", e);
}
}
- // Picker has no stall UI; heartbeat keeps it responsive.
+ // Picker has no stall UI; per-update repaints keep it
+ // responsive without a stall message.
}
}
},
diff --git a/src/commands/list/model/item.rs b/src/commands/list/model/item.rs
index dd2b46064..86e8d006c 100644
--- a/src/commands/list/model/item.rs
+++ b/src/commands/list/model/item.rs
@@ -127,7 +127,7 @@ pub enum BranchScope {
impl BranchScope {
/// The two-cell gutter sigil (`glyph` + trailing space) for a branch
/// row of this scope. ASCII single-width by design — the gutter must
- /// dodge skim's `width_cjk` clipping (see `vendor/NOTES.md`).
+ /// dodge skim's `width_cjk` clipping.
pub const fn gutter_sigil(self) -> &'static str {
match self {
BranchScope::Local => "/ ",
diff --git a/src/commands/list/render.rs b/src/commands/list/render.rs
index ec4d17bce..b5d87f6bc 100644
--- a/src/commands/list/render.rs
+++ b/src/commands/list/render.rs
@@ -412,8 +412,7 @@ impl ColumnLayout {
// glyphs in the Status column (WORKTREE_STATE `/`, upstream `|`
// are both dim) — bright worktree vs dim ref reinforces the
// presence gradient, glyph still primary. All single-width
- // ASCII — the gutter must dodge skim's `width_cjk` clipping
- // (see `vendor/NOTES.md`).
+ // ASCII — the gutter must dodge skim's `width_cjk` clipping.
//
// TODO(pr-rows): PR rows (open PRs with no local branch) land
// on a separate branch; add a `#` arm here (and a matching `#`
diff --git a/src/commands/picker/items.rs b/src/commands/picker/items.rs
index 803b4107b..0c90e0cad 100644
--- a/src/commands/picker/items.rs
+++ b/src/commands/picker/items.rs
@@ -6,13 +6,42 @@ use std::borrow::Cow;
use std::collections::HashSet;
use std::sync::{Arc, Mutex};
+use ansi_to_tui::IntoText;
use anstyle::Reset;
use color_print::cformat;
use dashmap::DashMap;
+use ratatui::text::{Line, Span};
use skim::prelude::*;
use worktrunk::git::Repository;
use worktrunk::styling::INFO_SYMBOL;
+/// Parse a pre-rendered ANSI string into a single ratatui `Line` for skim's
+/// item list. skim's `DisplayContext::to_line` only applies match-highlight
+/// styling to plain text, so the picker — whose rows already carry SGR color
+/// codes — converts them itself. Rows are single lines; spans from any parsed
+/// lines are flattened into one. A parse failure falls back to the raw text.
+///
+/// Each span's background is cleared to `None`. The rows are foreground-only,
+/// but an `\x1b[0m` reset in the source ANSI parses to an explicit
+/// `bg = Reset`, which would override skim's `highlight_line` fill and leave the
+/// selected row's gray highlight (`current_bg`) full of holes. Leaving `bg`
+/// unset lets the line-level current-row background show through uniformly.
+fn ansi_to_line(s: &str) -> Line<'static> {
+ match s.into_text() {
+ Ok(text) => Line::from(
+ text.lines
+ .into_iter()
+ .flat_map(|line| line.spans)
+ .map(|mut span| {
+ span.style.bg = None;
+ span
+ })
+ .collect::<Vec<Span<'static>>>(),
+ ),
+ Err(_) => Line::from(s.to_string()),
+ }
+}
+
use super::super::list::model::ListItem;
use super::log_formatter::{
FIELD_DELIM, batch_fetch_stats, format_log_output, process_log_with_dimming, strip_hash_markers,
@@ -44,8 +73,8 @@ impl SkimItem for HeaderSkimItem {
Cow::Borrowed(&self.display_text)
}
- fn display<'a>(&'a self, _context: skim::DisplayContext<'a>) -> skim::AnsiString<'a> {
- skim::AnsiString::parse(&self.display_text_with_ansi)
+ fn display(&self, _context: DisplayContext) -> Line<'_> {
+ ansi_to_line(&self.display_text_with_ansi)
}
fn output(&self) -> Cow<'_, str> {
@@ -92,9 +121,10 @@ fn compute_diff_preview(
/// Wrapper to implement SkimItem for ListItem.
///
/// Progressive updates live inside `rendered` — the picker handler rewrites
-/// the ANSI-colored display string in place as task results arrive. Skim
-/// redraws from `display()` on its 100ms heartbeat, so new values surface
-/// without any explicit re-send through the item channel.
+/// the ANSI-colored display string in place as task results arrive. skim 4.x
+/// renders on demand, so the handler pokes an `Event::Render` after each
+/// mutation (see `progressive_handler`); skim then re-reads `display()` and the
+/// new value surfaces — no re-send through the item channel.
///
/// `search_text` (what the matcher sees) stays based on fast-only fields
/// so cached ranks don't need to re-compute when a slow field lands.
@@ -125,12 +155,11 @@ impl SkimItem for WorktreeSkimItem {
Cow::Borrowed(&self.search_text)
}
- fn display<'a>(&'a self, _context: skim::DisplayContext<'a>) -> skim::AnsiString<'a> {
- // Clone-under-lock so AnsiString's input outlives the guard.
- // `AnsiString::parse` returns `AnsiString<'static>`, so the borrow
- // ends with this function.
+ fn display(&self, _context: DisplayContext) -> Line<'_> {
+ // Clone-under-lock so the parser's input outlives the guard;
+ // `ansi_to_line` returns an owned `Line<'static>`.
let snapshot = self.rendered.lock().unwrap().clone();
- skim::AnsiString::parse(&snapshot)
+ ansi_to_line(&snapshot)
}
fn output(&self) -> Cow<'_, str> {
@@ -161,18 +190,12 @@ impl WorktreeSkimItem {
/// and unselected modes dimmed. Controls shown below in normal text
/// for visual distinction from inactive tabs.
pub(super) fn render_preview_tabs(mode: PreviewMode) -> String {
- // Full SGR reset (\x1b[0m). color_print's `</>` emits \x1b[22m (intensity
- // reset), which skim's ANSI parser silently ignores — see
- // `skim-0.20.5/src/ansi.rs` `csi_dispatch`, which handles codes 0/1/2/4/5/7
- // but not 22. Without explicit [0m, dim/bold bleeds across the rest of
- // the line in the list and preview panels. Same reason the
+ // Full SGR reset (\x1b[0m) after each styled span. color_print's `</>`
+ // emits only \x1b[22m (intensity reset); pairing it with an explicit
+ // [0m keeps dim/bold from bleeding across the dividers and into the rest
+ // of the line in the list and preview panels. Same reason the
// `compute_*_preview` helpers below scatter `{reset}` after each styled
// span.
- //
- // TODO(vendor-skim): a one-line fix in skim's ANSIParser removes this
- // workaround everywhere. See `vendor/NOTES.md` → "SGR 22 (intensity
- // reset) handling"; revisit if more users report preview formatting
- // issues.
let reset = Reset;
/// Format a tab label with bold (active) or dimmed (inactive) styling
@@ -206,11 +229,10 @@ impl WorktreeSkimItem {
/// Render preview for the given mode with specified dimensions.
///
- /// Pure cache read: skim calls this synchronously on the UI thread
- /// (see `skim::model::draw_preview`), so any blocking here gates the
- /// entire first render — list included. Background tasks populate the
- /// cache out-of-band; a miss returns a placeholder, and skim will
- /// re-query on the next selection/query change.
+ /// Pure cache read: skim invokes `preview()` synchronously while drawing
+ /// the preview pane, so any blocking here gates the render. Background
+ /// tasks populate the cache out-of-band; a miss returns a placeholder, and
+ /// skim re-queries on the next selection/query change.
fn preview_for_mode(&self, mode: PreviewMode, width: usize, _height: usize) -> String {
let cache_key = (self.branch_name.clone(), mode);
let content = self
@@ -229,9 +251,8 @@ impl WorktreeSkimItem {
}
/// Placeholder shown while a background task is still computing the
- /// preview for this mode. Skim has no API to re-query preview from
- /// outside user interaction (see `skim::previewer::on_item_change` bail
- /// at `previewer.rs:187`), so the hint tells the user to press the mode
+ /// preview for this mode. Skim has no API to re-query the preview from
+ /// outside user interaction, so the hint tells the user to press the mode
/// key again to refresh once the background fill lands. `alt-N`
/// re-runs the same `echo N + refresh-preview` chain, re-reading the
/// now-populated cache.
diff --git a/src/commands/picker/mod.rs b/src/commands/picker/mod.rs
index 5c3cfeae6..6b8e32c15 100644
--- a/src/commands/picker/mod.rs
+++ b/src/commands/picker/mod.rs
@@ -4,7 +4,7 @@
//! shares `super::list::collect::collect` with `wt list` — see
//! `commands/list/collect/mod.rs` for the rendering-pipeline spec — but inverts
//! the ordering because skim's `preview_window` height is baked into
-//! `SkimOptions` before `Skim::run_with` takes over the terminal, so we have
+//! `SkimOptions` before skim takes over the terminal, so we have
//! to estimate the visible row count up front rather than learn it from
//! collect's skeleton pass.
//!
@@ -31,9 +31,10 @@
//! 5. Builds `SkimOptions` (immutable after this — which is why steps 1-4 have
//! to run first).
//! 6. Spawns the `picker-collect` bg thread, which calls `collect::collect`.
-//! 7. Calls `Skim::run_with(rx)`; skim paints the empty frame and then ingests
-//! skeleton rows from the channel as the bg thread streams them via
-//! `on_skeleton`.
+//! 7. Calls `run_skim(rx)` (a thin wrapper over skim's `init`/`run` that also
+//! hands the collect handler skim's event sender for progressive repaints);
+//! skim paints the empty frame and then ingests skeleton rows from the
+//! channel as the bg thread streams them via `on_skeleton`.
//!
//! Time-to-skeleton = steps 1-6 on the main thread *plus* collect's
//! pre-skeleton phase on the bg thread. See `commands/list/collect/mod.rs`
@@ -100,8 +101,9 @@ use std::cell::RefCell;
use std::io::IsTerminal;
use std::path::{Path, PathBuf};
use std::rc::Rc;
-use std::sync::atomic::AtomicUsize;
-use std::sync::{Arc, Mutex};
+use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
+use std::sync::{Arc, Mutex, OnceLock};
+use std::time::{Duration, Instant};
use ansi_str::AnsiStr;
use anyhow::Context;
@@ -181,7 +183,7 @@ impl PickerRemovalTarget {
/// branch name is the only handle.
///
/// Decoding `output()` rather than `downcast_ref::<WorktreeSkimItem>()` also
-/// sidesteps skim 0.20's cross-thread `TypeId` mismatch, which makes the
+/// sidesteps skim's cross-thread `TypeId` mismatch, which can make the
/// downcast fail when the item originates on the reader thread.
fn picker_item_identifier(item: &dyn SkimItem) -> String {
let output = item.output().to_string();
@@ -193,20 +195,25 @@ fn picker_item_identifier(item: &dyn SkimItem) -> String {
/// Custom command collector for skim's `reload` action.
///
-/// When alt-r is pressed, skim runs `execute-silent` to write the selected branch
-/// name to a signal file, then `reload` invokes this collector. The collector reads
-/// the signal file, removes the item from the list, and streams the remaining items
-/// back to skim — all without leaving the picker.
+/// When alt-r is pressed, skim's `reload(remove {})` action expands `{}` to the
+/// selected row's output() token and invokes this collector with it. The
+/// collector parses the token, removes that item from the list, and streams the
+/// remaining items back to skim — all without leaving the picker.
+///
+/// The token rides the reload command itself rather than a side-channel file:
+/// skim 4.x's `execute-silent` is fire-and-forget, so the old
+/// `execute-silent(echo {} > file)+reload` chain raced — the reader read the
+/// file before the echo landed and removed nothing (or, on a repeat press, the
+/// wrong worktree).
///
/// Git operations (worktree removal, branch deletion) are deferred to a background
-/// thread because skim 0.20 calls `invoke()` on the main event loop thread.
+/// thread because skim calls `invoke()` on the main event loop thread.
/// Blocking it freezes the TUI.
///
-/// Cursor position resets to the first item after reload (skim 0.20 limitation,
+/// Cursor position resets to the first item after reload (skim limitation,
/// tracked in #1695).
struct PickerCollector {
items: Arc<Mutex<Vec<Arc<dyn SkimItem>>>>,
- signal_path: PathBuf,
repo: Repository,
/// Approvals snapshot, loaded once at picker startup. A queued removal runs
/// its `pre-remove` / `post-remove` / `post-switch` hooks only when every
@@ -327,15 +334,31 @@ impl PickerCollector {
}
}
+/// Pull the selected row's `output()` token out of the `remove <token>` reload
+/// command skim builds for alt-r. skim expands `{}` to `output()` and shell-
+/// quotes it via single quotes (`'…'`, with any embedded `'` written as
+/// `'\''`); this reverses exactly that. An empty selection yields `''` →
+/// empty string, which `from_signal` treats as "nothing to remove".
+fn parse_reload_remove_token(cmd: &str) -> String {
+ let arg = cmd.strip_prefix("remove ").unwrap_or("").trim();
+ let unquoted = arg
+ .strip_prefix('\'')
+ .and_then(|inner| inner.strip_suffix('\''))
+ .unwrap_or(arg);
+ unquoted.replace("'\\''", "'")
+}
+
impl CommandCollector for PickerCollector {
fn invoke(
&mut self,
- _cmd: &str,
+ cmd: &str,
components_to_stop: Arc<AtomicUsize>,
) -> (SkimItemReceiver, Sender<i32>) {
- // Read the removal signal (item output token written by execute-silent)
- if let Ok(signal) = std::fs::read_to_string(&self.signal_path) {
- let selected_output = signal.trim().to_string();
+ // skim's `reload(remove {})` expands `{}` to the selected row's
+ // shell-quoted output() token; pull it back out (see
+ // `parse_reload_remove_token`). No signal file — that raced the reader.
+ {
+ let selected_output = parse_reload_remove_token(cmd);
if let Some(removal_target) = PickerRemovalTarget::from_signal(&selected_output) {
let preparation = self.prepare_removal(&removal_target);
@@ -347,9 +370,9 @@ impl CommandCollector for PickerCollector {
// drops exactly the selected row even when several
// detached rows share the `(detached)` branch label.
//
- // Note: skim's `as_any().downcast_ref::<WorktreeSkimItem>()` fails
- // at runtime (TypeId mismatch between reader thread and main thread
- // compilation units in skim 0.20). All item lookups use output()
+ // Note: skim's `as_any().downcast_ref::<WorktreeSkimItem>()` can
+ // fail at runtime (TypeId mismatch between reader thread and main
+ // thread compilation units). All item lookups use output()
// matching instead.
{
let mut items = self.items.lock().unwrap();
@@ -390,19 +413,16 @@ impl CommandCollector for PickerCollector {
log::info!("picker: cannot remove '{selected_output}': {e:#}");
}
}
-
- // Clear signal for next removal
- let _ = std::fs::write(&self.signal_path, "");
}
}
- // Stream remaining items through a channel for skim to consume.
- // Uses unbounded channel so all items are sent immediately without blocking.
+ // Stream remaining items through a channel for skim to consume. skim
+ // 4.x's item channel carries Vec batches, so send the whole list as a
+ // single batch; unbounded means the send never blocks.
let items = self.items.lock().unwrap();
let (tx, rx) = unbounded();
- for item in items.iter() {
- let _ = tx.send(Arc::clone(item));
- }
+ let batch: Vec<Arc<dyn SkimItem>> = items.iter().map(Arc::clone).collect();
+ let _ = tx.send(batch);
drop(tx);
// Dummy interrupt channel — no subprocess to kill.
@@ -607,25 +627,16 @@ pub fn handle_picker(
// the handler has already published them.
let shared_items: Arc<Mutex<Vec<Arc<dyn SkimItem>>>> = Arc::new(Mutex::new(Vec::new()));
- // Signal file for alt-r removal communication. execute-silent writes
- // the branch name here; the PickerCollector reads it on reload.
- // Cleaned up in PreviewState::Drop.
- let signal_path = state.path.with_extension("remove");
-
// Approvals snapshot for the session: alt-r removals consult it read-only
// to filter the hook plan; see `approved_removal_plan`.
let approvals = Arc::new(Approvals::load().context("Failed to load approvals")?);
let collector = PickerCollector {
items: Arc::clone(&shared_items),
- signal_path: signal_path.clone(),
repo: repo.clone(),
approvals,
};
- let signal_path_escaped =
- shell_escape::unix::escape(signal_path.display().to_string().into()).into_owned();
-
// Get state path for key bindings (shell-escaped for safety)
let state_path_display = state.path.display().to_string();
let state_path_str = shell_escape::unix::escape(state_path_display.into()).into_owned();
@@ -638,29 +649,18 @@ pub fn handle_picker(
// Configure skim options with Rust-based preview and mode switching keybindings
let options = SkimOptionsBuilder::default()
.height("90%".to_string())
- .layout("reverse".to_string())
- .header_lines(1) // Make first line (header) non-selectable
+ .reverse(true)
+ // Fill the whole selected row with the `current` background (set via
+ // `current_bg` in `.color(...)` below). skim 4.x applies the current-row
+ // style at the line level only when this is on; without it the selection
+ // shows just the `>` pointer (the row's own `display()` ANSI spans carry
+ // no background). skim 0.20's tuikit backend highlighted the row for free.
+ .highlight_line(true)
+ .header_lines(1usize) // Make first line (header) non-selectable
.multi(false)
.no_info(true) // Hide info line (matched/total counter)
- .preview(Some("".to_string())) // Enable preview (empty string means use SkimItem::preview())
- .preview_window(preview_window_spec)
- // Force the inline-mode clearing path on exit.
- //
- // tuikit only enters the alternate screen when the picker is full
- // height; at `height: "90%"` we're inline, so `smcup` is never
- // sent. But its `pause()` still emits `rmcup` whenever the option
- // `disable_alternate_screen` is false — and unmatched `rmcup`
- // varies by terminal: a no-op on most macOS terminals, but on some
- // Linux setups it leaves the picker frame on screen because no
- // explicit erase ran.
- //
- // skim plumbs `disable_alternate_screen = no_clear_start` (see
- // `skim/src/lib.rs` `Skim::run_with`), so setting `no_clear_start`
- // here forces pause() down the `cursor_goto + erase_down` branch,
- // which actually erases the rows skim drew on. The other side
- // effect, `clear_on_start = false`, is harmless for us — skim
- // immediately overdraws the rows it allocates.
- .no_clear_start(true)
+ .preview("") // Enable preview (empty string means use SkimItem::preview())
+ .preview_window(preview_window_spec.as_str())
// Color scheme using fzf's --color=light values: dark text (237) on light gray bg (251)
//
// Terminal color compatibility is tricky:
@@ -674,20 +674,16 @@ pub fn handle_picker(
// - On dark terminals: light gray highlight stands out clearly
// - On light terminals: light gray is subtle but visible
// - Dark text (237) ensures readability regardless of terminal theme
- .color(Some(
- "fg:-1,bg:-1,header:-1,matched:108,current:237,current_bg:251,current_match:108"
- .to_string(),
- ))
+ .color("fg:-1,bg:-1,header:-1,matched:108,current:237,current_bg:251,current_match:108")
.cmd_collector(Rc::new(RefCell::new(collector)) as Rc<RefCell<dyn CommandCollector>>)
.bind(vec![
// Preview-tab switching. Bare digits 1-5 are intentionally NOT
// bound — they flow to the query input so a number can be typed
// (a PR number, or digits within a branch name). Two ways to
// switch tabs remain:
- // * alt-1..alt-5 jump straight to a tab. `from_keyname` only
- // learns the alt-<digit> tokens via the vendor patch in
- // vendor/skim-tuikit/src/key.rs; without it these silently
- // no-op (Input::bind drops unparsable keys).
+ // * alt-1..alt-5 jump straight to a tab. skim 4.x parses
+ // `alt-<digit>` natively via crossterm; an unparsable bind is
+ // just logged and dropped.
// * tab / shift-tab cycle forward / backward (below).
format!(
"alt-1:execute-silent(echo 1 > {0})+refresh-preview",
@@ -713,18 +709,29 @@ pub fn handle_picker(
// digit; `tr` rotates it (1→2→3→4→5→1 forward, the reverse for
// btab) with wraparound, via a temp file + rename so the read and
// write don't race on one path. Two hard constraints shape this:
- // * Paren-free — skim parses the execute-silent argument up to
- // the first `)` (a naive `\([^\)]*?\)` regex), so `$(...)` /
- // `$(( ))` would truncate the command. The embedded `{0}` temp
- // path must stay `)`-free too (it does: `std::env::temp_dir()`
- // paths don't contain parens) — the alt-r/alt-N bindings share
- // this assumption.
+ // * Paren-free — skim 4.x parses an `execute-silent(…)` body by
+ // splitting at the first `(` and trimming the trailing `)`, and
+ // splits the action chain on `+`. So the body must contain no
+ // `+` and must not end in `)`; `$(...)` / `$(( ))` would do both.
+ // Keeping it paren-free entirely (the embedded `{0}` temp path
+ // is — `std::env::temp_dir()` paths have none) satisfies this,
+ // which the alt-r/alt-N bindings share.
// * Shell-agnostic — skim runs it under the user's $SHELL
// (fish/zsh/sh), so no shell-specific syntax: `tr` + `mv` are
// external and behave identically everywhere.
// This overrides skim's default Tab (toggle-select + cursor down)
// and Shift-Tab (toggle-select + cursor up); `bind` replaces the
// chain wholesale, and both are inert in this single-select picker.
+ //
+ // Shift-Tab needs three bindings, not one. skim parses `btab` to
+ // `KeyEvent{BackTab, NONE}`, but crossterm delivers Shift-Tab with
+ // the SHIFT modifier set, so that lone bind never matches and skim's
+ // built-in Shift-Tab (cursor up) wins — a back-cycle that silently
+ // moved the selection instead. skim's own default keymap hedges the
+ // same ambiguity across `BackTab+SHIFT`, `Tab+SHIFT`, and
+ // `BackTab+all()`; we bind every representation crossterm might
+ // report (`btab` / `shift-btab` / `shift-tab`) so the override holds
+ // regardless of terminal. (Plain Tab is unambiguous — `Tab+NONE`.)
format!(
"tab:execute-silent(tr 12345 23451 < {0} > {0}.tmp; mv {0}.tmp {0})+refresh-preview",
state_path_str
@@ -733,15 +740,23 @@ pub fn handle_picker(
"btab:execute-silent(tr 12345 51234 < {0} > {0}.tmp; mv {0}.tmp {0})+refresh-preview",
state_path_str
),
- // Create new worktree with query as branch name (alt-c for "create")
- "alt-c:accept(create)".to_string(),
- // Remove selected worktree: write branch name to signal file, then
- // reload triggers PickerCollector which performs the removal and
- // streams updated items back — all without leaving the picker.
format!(
- "alt-r:execute-silent(echo {{}} > {0})+reload(remove)",
- signal_path_escaped
+ "shift-btab:execute-silent(tr 12345 51234 < {0} > {0}.tmp; mv {0}.tmp {0})+refresh-preview",
+ state_path_str
+ ),
+ format!(
+ "shift-tab:execute-silent(tr 12345 51234 < {0} > {0}.tmp; mv {0}.tmp {0})+refresh-preview",
+ state_path_str
),
+ // Create new worktree with query as branch name (alt-c for "create")
+ "alt-c:accept(create)".to_string(),
+ // Remove selected worktree: `reload(remove {})` hands the selected
+ // row's output() token to PickerCollector, which performs the removal
+ // and streams updated items back — all without leaving the picker.
+ // Passing the token through the reload cmd (not an execute-silent +
+ // file write) sidesteps skim 4.x's fire-and-forget execute-silent,
+ // which raced the reader and removed nothing.
+ "alt-r:reload(remove {})".to_string(),
// Preview toggle (alt-p shows/hides preview)
// Note: skim doesn't support change-preview-window like fzf, only toggle
"alt-p:toggle-preview".to_string(),
@@ -761,9 +776,18 @@ pub fn handle_picker(
// `Skim::run_with` returns and stderr is safe again).
let stashed_warnings: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(Vec::new()));
+ // skim 4.x repaints on demand, so the collect handler needs a handle to
+ // skim's event loop to surface in-place row updates. The picker fills this
+ // once `Skim::init_tui` has run (inside `run_skim`); until then the handler
+ // simply skips its render pokes. See `progressive_handler` module docstring.
+ let render_tx: Arc<OnceLock<tokio::sync::mpsc::Sender<Event>>> = Arc::new(OnceLock::new());
+
+ // Concrete type so the dry-run dump can read the handler's rendered rows.
let handler: Arc<progressive_handler::PickerHandler> =
Arc::new(progressive_handler::PickerHandler {
tx: tx.clone(),
+ render_tx: Arc::clone(&render_tx),
+ last_render_poke: Mutex::new(Instant::now()),
shared_items: Arc::clone(&shared_items),
rendered_slots: std::sync::OnceLock::new(),
preview_cache: Arc::clone(&preview_cache),
@@ -776,8 +800,9 @@ pub fn handle_picker(
});
// Spawn collect on a background thread. The handler holds the only
- // remaining `tx` clone; when the bg thread exits, `tx` drops, and skim's
- // heartbeat stops. Contract: background work done → picker idle.
+ // remaining `tx` clone; when the bg thread exits, `tx` drops, skim's reader
+ // sees EOF, and the picker goes idle. Contract: background work done →
+ // picker idle.
let bg_handler: Arc<dyn collect::PickerProgressHandler> = handler.clone();
let bg_repo = repo.clone();
let bg_skip_tasks = skip_tasks.clone();
@@ -804,9 +829,9 @@ pub fn handle_picker(
worktrunk::trace::instant("Picker collect spawned");
// Drop main-thread copies so the bg thread's `tx` clone is the last
- // sender (its drop is what stops skim's heartbeat). The dry run keeps
- // the handler — skim never runs there, so the heartbeat contract
- // doesn't apply, and the dump below reads its rendered rows.
+ // sender (its drop is what signals EOF to skim's reader). The dry run keeps
+ // the handler: skim never runs there, so the EOF contract doesn't apply,
+ // and the dump below reads its rendered rows.
drop(tx);
let dry_run_handler = is_dry_run.then_some(handler);
@@ -845,13 +870,15 @@ pub fn handle_picker(
}
// Run skim (single invocation — alt-r uses reload, not re-launch).
- // Skim receives items as the bg thread's handler sends them.
+ // Skim receives items as the bg thread's handler sends them, and the
+ // handler pushes repaints through `render_tx` (filled inside `run_skim`)
+ // as it mutates rows in place.
//
// Don't join `bg_handle` after skim exits: drain may still be running
// network tasks, and joining would block exit for up to DRAIN_TIMEOUT
// (120s). Process exit terminates the bg thread; its git subprocesses
// are read-only.
- let output = Skim::run_with(&options, Some(rx));
+ let output = run_skim(options, rx, &render_tx, &state.path);
drop(bg_handle);
// Skim has released the terminal — emit any warnings that collect's bg
@@ -860,14 +887,16 @@ pub fn handle_picker(
// the rest fall on the floor with the bg thread.
drain_stashed_warnings(&stashed_warnings);
+ // `run_skim` returns Err only on a genuine TUI init / event-loop failure;
+ // a user cancel is `Ok` with `is_abort` set. Surface a real failure.
+ let out = output?;
+
// Handle selection (signal file cleaned up by PreviewState::Drop)
- if let Some(out) = output
- && !out.is_abort
- {
+ if !out.is_abort {
// Determine action: create (alt-c) or switch (enter)
// Remove is handled inline via reload — it never reaches accept.
let action = match &out.final_event {
- Event::EvActAccept(Some(label)) if label == "create" => PickerAction::Create,
+ Event::Action(Action::Accept(Some(label))) if label == "create" => PickerAction::Create,
_ => PickerAction::Switch,
};
@@ -878,7 +907,7 @@ pub fn handle_picker(
// any worktree-backed row and the branch name for a branch-only row
// (same as `wt switch` from CLI) — never the raw `worktree-path:` token.
let selected = out.selected_items.first();
- let selected_name = selected.map(|item| picker_item_identifier(item.as_ref()));
+ let selected_name = selected.map(|item| picker_item_identifier(item.item.as_ref()));
let query = out.query.trim().to_string();
let identifier = resolve_identifier(&action, query, selected_name)?;
@@ -923,6 +952,110 @@ pub fn handle_picker(
Ok(())
}
+/// Background poller that nudges skim to re-run its preview when the
+/// preview-mode state file changes. See [`run_skim`] for why; it lives only for
+/// one picker session and stops when [`ModeWatcher::stop`] is called.
+struct ModeWatcher {
+ stop: Arc<AtomicBool>,
+ handle: Option<std::thread::JoinHandle<()>>,
+}
+
+impl ModeWatcher {
+ fn spawn(event_tx: tokio::sync::mpsc::Sender<Event>, path: PathBuf) -> Self {
+ let stop = Arc::new(AtomicBool::new(false));
+ let stop_thread = Arc::clone(&stop);
+ let handle = std::thread::Builder::new()
+ .name("picker-mode-watcher".into())
+ .spawn(move || {
+ // Seed with the current contents so the initial mode isn't
+ // treated as a change.
+ let mut last = std::fs::read(&path).ok();
+ while !stop_thread.load(Ordering::Relaxed) {
+ std::thread::sleep(Duration::from_millis(20));
+ let current = std::fs::read(&path).ok();
+ if current != last {
+ last = current;
+ // Channel closed (skim exited) just makes this a no-op;
+ // the loop then ends on the next `stop` check.
+ let _ = event_tx.try_send(Event::RunPreview);
+ }
+ }
+ })
+ .ok();
+ Self { stop, handle }
+ }
+
+ fn stop(mut self) {
+ self.stop.store(true, Ordering::Relaxed);
+ if let Some(handle) = self.handle.take() {
+ let _ = handle.join();
+ }
+ }
+}
+
+/// Run skim to completion, exposing its event sender for progressive repaints.
+///
+/// This inlines what `Skim::run_with` does, with two additions: after the TUI is
+/// initialized we publish `Skim::event_sender()` into `render_tx`, and we start
+/// a [`ModeWatcher`]. skim 4.x renders on demand, so the background collect
+/// thread's in-place row mutations stay invisible until something wakes the
+/// event loop — the handler pushes `Event::Render` through that sender (see
+/// `progressive_handler`).
+///
+/// `preview_mode_path` is the file the alt-1…5 / tab keybinds rewrite to switch
+/// preview tabs; `ModeWatcher` re-runs the preview once the write lands, fixing
+/// the one-step tab lag skim 0.20's heartbeat used to mask.
+///
+/// `wt` runs no outer tokio runtime, so skim's event loop runs on a fresh
+/// multi-thread `Runtime` — the same one `run_with` builds in that case. A user
+/// cancel is `Ok(SkimOutput)` with `is_abort` set; only a genuine init /
+/// event-loop failure is an `Err`.
+///
+/// Injecting `Event::Render` / `Event::RunPreview` from the handler and the
+/// watcher is safe against clobbering the recorded selection: skim's `Accept` /
+/// `Abort` set `should_quit` in the same `tick` that records them as
+/// `final_event`, and `run()` breaks before the next `tick`, so a trailing
+/// injected event is never processed after the terminal action.
+fn run_skim(
+ options: SkimOptions,
+ rx: SkimItemReceiver,
+ render_tx: &Arc<OnceLock<tokio::sync::mpsc::Sender<Event>>>,
+ preview_mode_path: &Path,
+) -> anyhow::Result<SkimOutput> {
+ let mut skim: Skim = Skim::init(options, Some(rx))
+ .map_err(|e| anyhow::anyhow!("failed to initialize picker: {e}"))?;
+ skim.start();
+
+ // `should_enter` is false only for skim's filter / select-1 / exit-0 / sync
+ // modes — none of which the picker enables — so the TUI is always entered.
+ // The guard just keeps the fallback safe (an aborted output) rather than
+ // panicking on `event_sender()` if that ever changes.
+ if skim.should_enter() {
+ skim.init_tui()
+ .map_err(|e| anyhow::anyhow!("failed to initialize picker TUI: {e}"))?;
+ // event_sender() requires init_tui(); publish it before entering the
+ // loop so the handler's in-place updates can request repaints.
+ let event_tx = skim.event_sender();
+ let _ = render_tx.set(event_tx.clone());
+
+ // Build the runtime before spawning the watcher: it's the only fallible
+ // step here, and ordering it first keeps the infallible spawn paired
+ // with the unconditional `watcher.stop()` below (no early return can
+ // leak the watcher thread).
+ let runtime =
+ tokio::runtime::Runtime::new().context("failed to start picker event-loop runtime")?;
+ let watcher = ModeWatcher::spawn(event_tx, preview_mode_path.to_path_buf());
+ let result = runtime.block_on(async {
+ skim.enter().await?;
+ skim.run().await
+ });
+ watcher.stop();
+ result.map_err(|e| anyhow::anyhow!("interactive picker failed: {e}"))?;
+ }
+
+ Ok(skim.output())
+}
+
/// Resolve the branch identifier from picker output.
///
/// Extracted from the picker's accept handler for testability.
@@ -959,7 +1092,7 @@ pub mod tests {
use super::preview::{PreviewLayout, PreviewMode, PreviewStateData};
use super::{
PickerAction, PickerCollector, PickerRemovalTarget, drain_stashed_warnings,
- picker_item_identifier, resolve_identifier,
+ parse_reload_remove_token, picker_item_identifier, resolve_identifier,
};
use crate::commands::list::model::{ItemKind, ListItem, WorktreeData};
use crate::commands::worktree::RemoveResult;
@@ -1060,6 +1193,23 @@ pub mod tests {
assert!(result.unwrap_err().to_string().contains("no branch name"));
}
+ /// `parse_reload_remove_token` reverses skim's `remove {}` expansion: it
+ /// strips the `remove ` verb and the single-quote wrapping skim adds, and
+ /// undoes the `'\''` escaping. An empty selection (`''`) yields "".
+ #[test]
+ fn test_parse_reload_remove_token() {
+ assert_eq!(
+ parse_reload_remove_token("remove 'worktree-path:/tmp/wt foo'"),
+ "worktree-path:/tmp/wt foo"
+ );
+ assert_eq!(parse_reload_remove_token("remove 'feature/x'"), "feature/x");
+ assert_eq!(parse_reload_remove_token("remove ''"), "");
+ // embedded single quote: skim writes ' as '\''
+ assert_eq!(parse_reload_remove_token("remove 'it'\\''s'"), "it's");
+ // missing verb / unquoted fall back to the trimmed remainder
+ assert_eq!(parse_reload_remove_token("remove plain"), "plain");
+ }
+
/// `from_signal` rejects tokens that carry no usable target: a blank or
/// whitespace-only signal, and a bare `worktree-path:` prefix with no path
/// after it. A non-empty branch token and a prefixed path both parse.
@@ -1240,10 +1390,8 @@ pub mod tests {
repo.run_command(&["branch", "branch-only-feature"])
.unwrap();
- let state_dir = tempfile::tempdir().unwrap();
let collector = PickerCollector {
items: Arc::new(Mutex::new(Vec::new())),
- signal_path: state_dir.path().join("remove"),
repo,
approvals: Arc::new(Approvals::default()),
};
@@ -1264,10 +1412,8 @@ pub mod tests {
let test = worktrunk::testing::TestRepo::with_initial_commit();
let repo = worktrunk::git::Repository::at(test.path()).unwrap();
- let state_dir = tempfile::tempdir().unwrap();
let collector = PickerCollector {
items: Arc::new(Mutex::new(Vec::new())),
- signal_path: state_dir.path().join("remove"),
repo,
approvals: Arc::new(Approvals::default()),
};
@@ -1427,22 +1573,19 @@ pub mod tests {
second_reported.to_string_lossy()
);
- let signal_dir = tempfile::tempdir().unwrap();
- let signal_path = signal_dir.path().join("remove-signal");
- fs::write(&signal_path, &second_output).unwrap();
-
let items = Arc::new(Mutex::new(vec![
Arc::clone(&first_item),
Arc::clone(&second_item),
]));
let mut collector = PickerCollector {
items: Arc::clone(&items),
- signal_path,
repo: repo.clone(),
approvals: Arc::new(Approvals::default()),
};
- let (_rx, _interrupt) = collector.invoke("remove", Arc::new(AtomicUsize::new(0)));
+ // skim's `reload(remove {})` hands invoke `remove <single-quoted token>`.
+ let cmd = format!("remove '{second_output}'");
+ let (_rx, _interrupt) = collector.invoke(&cmd, Arc::new(AtomicUsize::new(0)));
let remaining: Vec<_> = items
.lock()
@@ -1463,9 +1606,30 @@ pub mod tests {
);
}
- // Note: skim's `as_any().downcast_ref::<WorktreeSkimItem>()` fails at
- // runtime due to TypeId mismatch between skim's reader thread and the main
- // compilation unit (skim 0.20 bug). The invoke() code path uses output()
- // matching instead. Full TUI tests require interactive skim — verified
- // via tmux-cli during development.
+ /// alt-r with nothing selectable under the cursor expands to `remove ''`;
+ /// `invoke` must treat the empty token as a no-op and leave the list intact.
+ #[test]
+ fn test_invoke_empty_selection_is_noop() {
+ let test = worktrunk::testing::TestRepo::with_initial_commit();
+ let repo = worktrunk::git::Repository::at(test.path()).unwrap();
+ let item = branch_only_picker_item("some-branch");
+ let items = Arc::new(Mutex::new(vec![Arc::clone(&item)]));
+ let mut collector = PickerCollector {
+ items: Arc::clone(&items),
+ repo,
+ approvals: Arc::new(Approvals::default()),
+ };
+ let (_rx, _interrupt) = collector.invoke("remove ''", Arc::new(AtomicUsize::new(0)));
+ assert_eq!(
+ items.lock().unwrap().len(),
+ 1,
+ "empty selection must not remove anything"
+ );
+ }
+
+ // Note: skim's `as_any().downcast_ref::<WorktreeSkimItem>()` can fail at
+ // runtime due to a TypeId mismatch between skim's reader thread and the main
+ // compilation unit. The invoke() code path uses output() matching instead.
+ // Full TUI tests require interactive skim — verified via tmux-cli during
+ // development.
}
diff --git a/src/commands/picker/preview.rs b/src/commands/picker/preview.rs
index 2462abcf4..212854ed1 100644
--- a/src/commands/picker/preview.rs
+++ b/src/commands/picker/preview.rs
@@ -163,10 +163,10 @@ pub(super) struct PreviewStateData;
impl PreviewStateData {
pub(super) fn state_path() -> PathBuf {
// Use per-process temp file to avoid race conditions when running multiple instances.
- // The leaf stays dot-free (the pid is numeric), so the sibling files
- // derived via `with_extension(...)` — `.remove` (alt-r signal) and
- // `.tmp` (tab/btab rotate scratch) — append rather than replace an
- // extension, matching the shell `{0}.tmp` the keybindings write.
+ // The leaf stays dot-free (the pid is numeric), so the sibling `.tmp`
+ // file (tab/btab rotate scratch) derived via `with_extension(...)`
+ // appends rather than replaces an extension, matching the shell
+ // `{0}.tmp` the keybindings write.
std::env::temp_dir().join(format!("wt-picker-state-{}", std::process::id()))
}
@@ -206,8 +206,6 @@ impl PreviewState {
impl Drop for PreviewState {
fn drop(&mut self) {
let _ = fs::remove_file(&self.path);
- // Clean up the removal signal file used by alt-r (see PickerCollector)
- let _ = fs::remove_file(self.path.with_extension("remove"));
// Clean up the rotate scratch file used by tab/shift-tab cycling
// (`tr … > {path}.tmp; mv …` in the keybindings); normally already
// renamed away, but a failed `mv` could leave it behind.
diff --git a/src/commands/picker/progressive_handler.rs b/src/commands/picker/progressive_handler.rs
index 259cae6e2..0037a3346 100644
--- a/src/commands/picker/progressive_handler.rs
+++ b/src/commands/picker/progressive_handler.rs
@@ -1,9 +1,24 @@
//! Progressive-rendering glue between `collect::collect` and the skim picker.
//!
//! Each event funnels into three places: skim's item stream (`tx`, alive
-//! while updates may arrive so the 100ms heartbeat keeps firing), each
-//! item's shared `rendered` mutex (in-place redraws picked up by the
-//! heartbeat), and `shared_items` used by `PickerCollector` for alt-r.
+//! while updates may arrive so the picker stays non-idle), each item's
+//! shared `rendered` mutex (in-place redraws), and `shared_items` used by
+//! `PickerCollector` for alt-r.
+//!
+//! # Why updates poke a render
+//!
+//! skim 4.x's ratatui backend renders **on demand** — it repaints on a key
+//! press, when new items land on the channel, or when its matcher flags
+//! `needs_render`. It does *not* unconditionally repaint on a timer (the
+//! periodic `Heartbeat` only renders when `needs_render` is already set).
+//! The old skim 0.20 tuikit backend *did* repaint every 100ms, which is what
+//! made in-place `rendered`-mutex mutations surface for free.
+//!
+//! So after the one-shot skeleton batch, every later mutation is invisible to
+//! skim unless we wake it. `request_render` pushes an `Event::Render` through
+//! the sender skim hands us at startup (`render_tx`, filled once the TUI is
+//! initialized). Intermediate updates coalesce to [`RENDER_THROTTLE`]; the
+//! terminal `on_collect_complete` forces one final unthrottled frame.
//!
//! Preview pre-compute is staged in two tiers:
//! - `on_skeleton` fires the first item's 4 modes + first-item summary,
@@ -18,10 +33,17 @@
//! workers' local deques during drain.
use std::sync::{Arc, Mutex, OnceLock};
+use std::time::{Duration, Instant};
use skim::prelude::*;
use worktrunk::styling::{StyledLine, strip_osc8_hyperlinks};
+/// Minimum gap between repaint pokes during collection. Holds the redraw rate
+/// at ~60fps so a burst of task results can't flood skim's (effectively
+/// unbounded) event channel ahead of the user's key presses. A directly-sent
+/// `Event::Render` bypasses skim's own frame-rate cap, so we cap it here.
+const RENDER_THROTTLE: Duration = Duration::from_millis(16);
+
use super::items::{HeaderSkimItem, PreviewCache, WorktreeSkimItem};
use super::preview_orchestrator::PreviewOrchestrator;
use crate::commands::list::collect::PickerProgressHandler;
@@ -31,11 +53,20 @@ use crate::commands::list::model::ListItem;
/// `PickerProgressHandler` trait that `collect` drives.
///
/// The `tx` clone lives as long as this handler is referenced — dropping the
-/// handler (when the collect thread exits) drops the last sender, which
-/// stops skim's heartbeat. That's the explicit contract: once background
-/// work is done, the picker can go idle.
+/// handler (when the collect thread exits) drops the last sender, which signals
+/// EOF to skim's reader. That's the explicit contract: once background work is
+/// done, the picker can go idle.
pub(super) struct PickerHandler {
pub(super) tx: SkimItemSender,
+ /// skim's event sender, published by the picker once `Skim::init_tui` has
+ /// run. `None` until then — early skeleton sends drive the first paint via
+ /// the item channel, so a missed poke before the TUI exists is harmless.
+ /// Used to push `Event::Render` when a row mutates in place; see the module
+ /// docstring.
+ pub(super) render_tx: Arc<OnceLock<tokio::sync::mpsc::Sender<Event>>>,
+ /// Last time `request_render` actually poked, for the [`RENDER_THROTTLE`]
+ /// coalescing gate.
+ pub(super) last_render_poke: Mutex<Instant>,
/// Mirror of the skim item vec visible to `PickerCollector`. Populated
/// atomically in `on_skeleton`.
pub(super) shared_items: Arc<Mutex<Vec<Arc<dyn SkimItem>>>>,
@@ -60,6 +91,28 @@ pub(super) struct PickerHandler {
pub(super) deferred_items: OnceLock<Vec<Arc<ListItem>>>,
}
+impl PickerHandler {
+ /// Wake skim to repaint after an in-place row mutation. No-op until the
+ /// picker has published `render_tx` (TUI initialized). `force` skips the
+ /// throttle for the final post-collection frame; otherwise pokes are
+ /// coalesced to [`RENDER_THROTTLE`]. Best-effort: a full or closed channel
+ /// just drops the poke (the next update, or `on_collect_complete`, catches
+ /// the row up).
+ fn request_render(&self, force: bool) {
+ let Some(tx) = self.render_tx.get() else {
+ return;
+ };
+ if !force {
+ let mut last = self.last_render_poke.lock().unwrap();
+ if last.elapsed() < RENDER_THROTTLE {
+ return;
+ }
+ *last = Instant::now();
+ }
+ let _ = tx.try_send(Event::Render);
+ }
+}
+
impl PickerProgressHandler for PickerHandler {
fn on_skeleton(&self, items: Vec<ListItem>, rendered: Vec<String>, header: StyledLine) {
debug_assert_eq!(items.len(), rendered.len());
@@ -112,9 +165,13 @@ impl PickerProgressHandler for PickerHandler {
let _ = self.rendered_slots.set(slots.into_boxed_slice());
*self.shared_items.lock().unwrap() = skim_items.clone();
- for skim_item in &skim_items {
- let _ = self.tx.send(Arc::clone(skim_item));
- }
+ // skim 4.x's item channel carries Vec batches; the skeleton is a single
+ // batch. This append wakes skim's reader (`items_available`) and drives
+ // the first paint. Later field updates happen in place through each
+ // item's shared `rendered` mutex and are *not* resent — they surface via
+ // `request_render` (see module docstring), since skim won't repaint a
+ // silent in-place mutation on its own.
+ let _ = self.tx.send(skim_items);
// Tier 1: warm the user's landing row (all modes) and every
// other row's default tab. Tier 2 (secondary modes + summaries
@@ -144,6 +201,7 @@ impl PickerProgressHandler for PickerHandler {
{
*slot.lock().unwrap() = strip_osc8_hyperlinks(&rendered);
}
+ self.request_render(false);
}
fn on_reveal(&self, rendered: Vec<String>) {
@@ -153,6 +211,7 @@ impl PickerProgressHandler for PickerHandler {
for (slot, line) in slots.iter().zip(rendered) {
*slot.lock().unwrap() = strip_osc8_hyperlinks(&line);
}
+ self.request_render(false);
}
fn stash_warning(&self, line: String) {
@@ -160,6 +219,10 @@ impl PickerProgressHandler for PickerHandler {
}
fn on_collect_complete(&self) {
+ // Collection is done — `on_update` may have throttled away the last
+ // row's repaint, so force one final frame that reflects every slot.
+ self.request_render(true);
+
let Some(items) = self.deferred_items.get() else {
return;
};
@@ -180,18 +243,16 @@ mod tests {
use crate::commands::list::model::ListItem;
use worktrunk::testing::TestRepo;
- fn make_handler() -> (
- PickerHandler,
- TestRepo,
- crossbeam_channel::Receiver<Arc<dyn SkimItem>>,
- ) {
+ fn make_handler() -> (PickerHandler, TestRepo, SkimItemReceiver) {
let test = TestRepo::with_initial_commit();
- let (tx, rx) = crossbeam_channel::unbounded::<Arc<dyn SkimItem>>();
+ let (tx, rx): (SkimItemSender, SkimItemReceiver) = unbounded();
let shared_items = Arc::new(Mutex::new(Vec::new()));
let orchestrator = Arc::new(PreviewOrchestrator::new(test.repo.clone()));
let preview_cache: PreviewCache = Arc::clone(&orchestrator.cache);
let handler = PickerHandler {
tx,
+ render_tx: Arc::new(OnceLock::new()),
+ last_render_poke: Mutex::new(Instant::now()),
shared_items,
rendered_slots: OnceLock::new(),
preview_cache,
@@ -213,8 +274,8 @@ mod tests {
/// Skeleton → update → reveal: verifies that each event writes through
/// to the shared `rendered` string the `WorktreeSkimItem` holds. Skim
- /// reads these strings on its heartbeat; the matcher-stable search
- /// text (branch + path) never changes.
+ /// reads these strings each time it repaints (which `request_render`
+ /// triggers); the matcher-stable search text (branch + path) never changes.
#[test]
fn handler_updates_render_strings_in_place() {
let (handler, _test, rx) = make_handler();
@@ -226,8 +287,8 @@ mod tests {
handler.on_skeleton(items, rendered, header("hdr"));
- // Header + 2 items sent to skim.
- let received: Vec<Arc<dyn SkimItem>> = std::iter::from_fn(|| rx.try_recv().ok()).collect();
+ // Header + 2 items sent to skim as one batch.
+ let received = rx.recv().expect("skeleton batch");
assert_eq!(received.len(), 3, "expected header + 2 items");
let slots = handler.rendered_slots.get().unwrap();
@@ -264,7 +325,7 @@ mod tests {
header("Branch Status"),
);
- let received: Vec<Arc<dyn SkimItem>> = std::iter::from_fn(|| rx.try_recv().ok()).collect();
+ let received = rx.recv().expect("skeleton batch");
assert_eq!(received.len(), 3);
// Header emits empty output (not selectable).
assert_eq!(received[0].output().as_ref(), "");
diff --git a/src/shell_exec.rs b/src/shell_exec.rs
index 53bd1d5ec..6a8cf433f 100644
--- a/src/shell_exec.rs
+++ b/src/shell_exec.rs
@@ -1501,7 +1501,7 @@ impl Cmd {
//
// Skipped when the caller used `.inherit_stdin()`: a child that
// reads the parent's controlling terminal must share the
- // foreground pgroup, otherwise calls like skim/tuikit's
+ // foreground pgroup, otherwise calls like skim's (crossterm)
// `tcsetattr` on `/dev/tty` raise SIGTTOU and stop the child
// mid-render. The kernel already delivers tty-initiated signals
// (Ctrl-C, Ctrl-Z, hangup) to every process in the shared
diff --git a/tests/common/pty.rs b/tests/common/pty.rs
index f1bec7189..b20640cce 100644
--- a/tests/common/pty.rs
+++ b/tests/common/pty.rs
@@ -16,6 +16,8 @@
use portable_pty::{CommandBuilder, MasterPty};
use std::io::{Read, Write};
use std::path::Path;
+use std::sync::mpsc;
+use std::sync::{Arc, Mutex};
/// Read output from PTY and wait for child exit.
///
@@ -166,7 +168,6 @@ pub fn read_pty_output(
/// Find cursor position request (ESC[6n) in a byte slice.
/// Returns the position if found.
-#[cfg(windows)]
fn find_cursor_request(data: &[u8]) -> Option<usize> {
// Look for ESC [ 6 n sequence (0x1b 0x5b 0x36 0x6e)
let pattern = b"\x1b[6n";
@@ -174,6 +175,55 @@ fn find_cursor_request(data: &[u8]) -> Option<usize> {
.position(|window| window == pattern)
}
+/// A PTY master writer shared between the reader thread (which answers terminal
+/// queries) and the caller (which sends keystrokes). Both need to write to the
+/// single master, and `portable_pty` hands out only one writer.
+pub type SharedPtyWriter = Arc<Mutex<Box<dyn Write + Send>>>;
+
+/// Spawn a thread that drains the PTY master `reader` into the returned channel
+/// and answers the cursor-position report query (`ESC[6n`) skim emits while
+/// initializing the picker.
+///
+/// skim 4.x runs the picker in partial-height mode, whose setup calls skim's
+/// `cursor_pos_from_tty()`: it writes `ESC[6n` to `/dev/tty` and blocks in
+/// `select()` for up to 3s waiting for the `ESC[row;colR` reply. A real terminal
+/// answers automatically; `portable_pty` is a bare PTY with no emulation, so
+/// without this reply skim fails init with "Cursor position detection timed out"
+/// and the picker never renders. The reply (`1;1`) is a safe constant — skim only
+/// uses it to place its inline viewport, which the TUI snapshot tests don't assert
+/// on. Sharing `writer` with the caller lets keystrokes and query replies both
+/// reach the master. The query is matched within a single read chunk; skim emits
+/// the 4-byte DSR as one small write, so it never spans chunks.
+pub fn spawn_pty_reader_answering_queries(
+ reader: Box<dyn Read + Send>,
+ writer: SharedPtyWriter,
+) -> mpsc::Receiver<Vec<u8>> {
+ let (tx, rx) = mpsc::channel::<Vec<u8>>();
+ std::thread::spawn(move || {
+ let mut reader = reader;
+ let mut temp_buf = [0u8; 4096];
+ loop {
+ match reader.read(&mut temp_buf) {
+ Ok(0) => break,
+ Ok(n) => {
+ let chunk = &temp_buf[..n];
+ if find_cursor_request(chunk).is_some()
+ && let Ok(mut w) = writer.lock()
+ {
+ let _ = w.write_all(b"\x1b[1;1R");
+ let _ = w.flush();
+ }
+ if tx.send(chunk.to_vec()).is_err() {
+ break;
+ }
+ }
+ Err(_) => break,
+ }
+ }
+ });
+ rx
+}
+
/// Build a CommandBuilder with standard PTY isolation and env vars.
///
/// Compose with `exec_cmd_in_pty` or `exec_cmd_in_pty_prompted`:
diff --git a/tests/helpers/mock-stub/Cargo.toml b/tests/helpers/mock-stub/Cargo.toml
index 122f4e73d..b08e0d067 100644
--- a/tests/helpers/mock-stub/Cargo.toml
+++ b/tests/helpers/mock-stub/Cargo.toml
@@ -21,8 +21,8 @@ edition = "2024"
publish = false
[dependencies]
-serde = { version = "1", features = ["derive"] }
-serde_json = "1"
+serde = { version = "1.0.228", features = ["derive"] }
+serde_json = "1.0.145"
[[bin]]
name = "mock-stub"
diff --git a/tests/helpers/wt-perf/Cargo.toml b/tests/helpers/wt-perf/Cargo.toml
index 6ccf67c39..558aa3c59 100644
--- a/tests/helpers/wt-perf/Cargo.toml
+++ b/tests/helpers/wt-perf/Cargo.toml
@@ -16,10 +16,10 @@ tempfile = "3.27"
dunce = "1"
# For CLI
-clap = { version = "4", features = ["derive"] }
+clap = { version = "4.6", features = ["derive"] }
# For JSON output
-serde_json = "1"
+serde_json = "1.0.145"
# For column-aligned timeline tables (elastic tabstops)
tabwriter = "1"
@@ -32,7 +32,7 @@ tabwriter = "1"
worktrunk = { path = "../../..", default-features = false }
[dev-dependencies]
-insta = "1.47"
+insta = "1.47.2"
[lib]
name = "wt_perf"
diff --git a/tests/integration_tests/switch_picker.rs b/tests/integration_tests/switch_picker.rs
index 457c35d72..c1d734f02 100644
--- a/tests/integration_tests/switch_picker.rs
+++ b/tests/integration_tests/switch_picker.rs
@@ -28,9 +28,10 @@ use crate::common::{TestRepo, repo, wt_bin};
use insta::assert_snapshot;
use portable_pty::CommandBuilder;
use rstest::rstest;
-use std::io::{Read, Write};
+use std::io::Write;
use std::path::{Path, PathBuf};
use std::sync::mpsc;
+use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
/// Terminal dimensions for TUI tests
@@ -58,9 +59,13 @@ const STABLE_DURATION: Duration = Duration::from_millis(500);
/// Fast polling ensures tests complete quickly when ready.
const POLL_INTERVAL: Duration = Duration::from_millis(10);
-/// Column where skim renders the │ border between list and preview panels.
-/// TERM_COLS=120, preview window spec `right:60` → list gets 60 cols, separator at 60.
-const SEPARATOR_COL: u16 = 60;
+/// Columns that split the list and preview panels in the 120-col test terminal.
+/// skim 4.x draws the │ separator at col 59, with the list to its left (cols
+/// 0..59) and the preview interior to its right (cols 60..120). Slicing around
+/// col 59 drops the separator from both panels — the border glyph renders
+/// inconsistently across platforms.
+const LIST_WIDTH: u16 = 59;
+const PREVIEW_START_COL: u16 = 60;
/// Result of executing a command in a PTY, holding the parsed terminal state.
struct PtyResult {
@@ -91,14 +96,14 @@ impl PtyResult {
fn panels(&self) -> (String, String) {
let screen = self.parser.screen();
let list = screen
- .rows(0, SEPARATOR_COL)
+ .rows(0, LIST_WIDTH)
.map(|row| row.trim_end().to_string())
.collect::<Vec<_>>()
.join("\n")
.trim_end()
.to_string();
let preview = screen
- .rows(SEPARATOR_COL + 1, TERM_COLS - SEPARATOR_COL - 1)
+ .rows(PREVIEW_START_COL, TERM_COLS - PREVIEW_START_COL)
.map(|row| row.trim_end().to_string())
.collect::<Vec<_>>()
.join("\n")
@@ -177,25 +182,13 @@ fn exec_in_pty_with_input_expectations(
let mut child = pair.slave.spawn_command(cmd).unwrap();
drop(pair.slave);
- let mut reader = pair.master.try_clone_reader().unwrap();
- let mut writer = pair.master.take_writer().unwrap();
-
- // Spawn a thread to continuously read PTY output and send chunks via channel
- let (tx, rx) = mpsc::channel::<Vec<u8>>();
- std::thread::spawn(move || {
- let mut temp_buf = [0u8; 4096];
- loop {
- match reader.read(&mut temp_buf) {
- Ok(0) => break,
- Ok(n) => {
- if tx.send(temp_buf[..n].to_vec()).is_err() {
- break;
- }
- }
- Err(_) => break,
- }
- }
- });
+ let reader = pair.master.try_clone_reader().unwrap();
+ let writer: crate::common::pty::SharedPtyWriter =
+ Arc::new(Mutex::new(pair.master.take_writer().unwrap()));
+
+ // Drain PTY output into a channel; the reader thread also answers skim's
+ // startup cursor-position query (see `spawn_pty_reader_answering_queries`).
+ let rx = crate::common::pty::spawn_pty_reader_answering_queries(reader, Arc::clone(&writer));
let mut parser = vt100::Parser::new(TERM_ROWS, TERM_COLS, 0);
@@ -232,14 +225,19 @@ fn exec_in_pty_with_input_expectations(
// Send each input and wait for screen to stabilize after each
for (input, expected_content) in inputs {
- writer.write_all(input.as_bytes()).unwrap();
- writer.flush().unwrap();
+ {
+ let mut w = writer.lock().unwrap();
+ w.write_all(input.as_bytes()).unwrap();
+ w.flush().unwrap();
+ }
// Wait for screen to stabilize after this input, optionally requiring specific content
wait_for_stable_with_content(&rx, &mut parser, *expected_content);
}
- // Drop writer to signal EOF on stdin
+ // Release the main thread's writer handle. The reader thread holds the
+ // other Arc clone until the PTY drains, so this no longer drives stdin EOF.
+ // The picker exits on Accept/Escape, or the kill below.
drop(writer);
// Poll for process exit (fast polling, long timeout for CI)
@@ -299,24 +297,11 @@ fn exec_in_pty_capture_before_abort(
let mut child = pair.slave.spawn_command(cmd).unwrap();
drop(pair.slave);
- let mut reader = pair.master.try_clone_reader().unwrap();
- let mut writer = pair.master.take_writer().unwrap();
-
- let (tx, rx) = mpsc::channel::<Vec<u8>>();
- std::thread::spawn(move || {
- let mut temp_buf = [0u8; 4096];
- loop {
- match reader.read(&mut temp_buf) {
- Ok(0) => break,
- Ok(n) => {
- if tx.send(temp_buf[..n].to_vec()).is_err() {
- break;
- }
- }
- Err(_) => break,
- }
- }
- });
+ let reader = pair.master.try_clone_reader().unwrap();
+ let writer: crate::common::pty::SharedPtyWriter =
+ Arc::new(Mutex::new(pair.master.take_writer().unwrap()));
+
+ let rx = crate::common::pty::spawn_pty_reader_answering_queries(reader, Arc::clone(&writer));
let mut parser = vt100::Parser::new(TERM_ROWS, TERM_COLS, 0);
@@ -352,8 +337,11 @@ fn exec_in_pty_capture_before_abort(
// Send pre-abort inputs (filter text, panel switches, etc.)
for (input, expected_content) in pre_abort_inputs {
- writer.write_all(input.as_bytes()).unwrap();
- writer.flush().unwrap();
+ {
+ let mut w = writer.lock().unwrap();
+ w.write_all(input.as_bytes()).unwrap();
+ w.flush().unwrap();
+ }
wait_for_stable_with_content(&rx, &mut parser, *expected_content);
}
@@ -361,8 +349,11 @@ fn exec_in_pty_capture_before_abort(
// The parser retains this state because we stop feeding output to it.
// Send Escape to abort
- writer.write_all(b"\x1b").unwrap();
- writer.flush().unwrap();
+ {
+ let mut w = writer.lock().unwrap();
+ w.write_all(b"\x1b").unwrap();
+ w.flush().unwrap();
+ }
drop(writer);
// Drain remaining output WITHOUT feeding to parser — preserves pre-abort screen
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_abort_escape_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_abort_escape_preview.snap
index 45ffa71c7..469734ed2 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_abort_escape_preview.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_abort_escape_preview.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/switch_picker.rs
expression: preview
---
-1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary [N/M]
+1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary
Enter: switch | Tab/alt-1…5: preview | alt-c: create | Esc:
○ main has no uncommitted changes
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_preview.snap
index 45ffa71c7..469734ed2 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_preview.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_multiple_worktrees_preview.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/switch_picker.rs
expression: preview
---
-1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary [N/M]
+1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary
Enter: switch | Tab/alt-1…5: preview | alt-c: create | Esc:
○ main has no uncommitted changes
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_list.snap
index 34ace8b2e..45e829097 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_list.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_list.snap
@@ -5,4 +5,4 @@ expression: list
>
Branch Status HEAD± main↕ Remote⇅ Commit
@ main ^ [HASH]
-> + feature ↑ ↑5 [HASH]..
+> + feature ↑ ↑5 [HASH]
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_preview.snap
index 2b03677de..95e6f8aaa 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_preview.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_log_preview.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/switch_picker.rs
expression: preview
---
-1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary [N/M]
+1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary
Enter: switch | Tab/alt-1…5: preview | alt-c: create | Esc:
* [HASH] +1 [TIME] (feature) Add file 5 with content
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_list.snap
index cf011c712..b8c1ff5cd 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_list.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_list.snap
@@ -5,4 +5,4 @@ expression: list
>
Branch Status HEAD± main↕ Remote⇅ Commit
@ main ^ [HASH]
-> + feature ↑ ↑2 [HASH]..
+> + feature ↑ ↑2 [HASH]
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_preview.snap
index 9050dc864..2ca4c65d8 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_preview.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_main_diff_preview.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/switch_picker.rs
expression: preview
---
-1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary [N/M]
+1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary
Enter: switch | Tab/alt-1…5: preview | alt-c: create | Esc:
feature_code.rs | 6 ++++++
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_list.snap
index e6f618946..3aee70002 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_list.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_list.snap
@@ -5,4 +5,4 @@ expression: list
>
Branch Status HEAD± main↕ Remote⇅ Commit
@ main ^ [HASH]
-> + feature ↑ ↑1 [HASH]..
+> + feature ↑ ↑1 [HASH]
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_preview.snap
index 78ccf66a5..f8c9cfb3b 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_preview.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_summary_preview.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/switch_picker.rs
expression: preview
---
-1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary [N/M]
+1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary
Enter: switch | Tab/alt-1…5: preview | alt-c: create | Esc:
Configure [commit.generation] command to enable LLM summari
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_list.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_list.snap
index 2ab6e1275..563c0ffdf 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_list.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_list.snap
@@ -5,4 +5,4 @@ expression: list
>
Branch Status HEAD± main↕ Remote⇅ Commit
@ main ^ [HASH]
-> + feature ! ↑ +3 -1 ↑1 [HASH]..
+> + feature ! ↑ +3 -1 ↑1 [HASH]
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_preview.snap
index 11cb922c2..694ab0864 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_preview.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_preview_uncommitted_preview.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/switch_picker.rs
expression: preview
---
-1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary [N/M]
+1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary
Enter: switch | Tab/alt-1…5: preview | alt-c: create | Esc:
tracked.txt | 4 +++-
diff --git a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_preview.snap b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_preview.snap
index 45ffa71c7..469734ed2 100644
--- a/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_preview.snap
+++ b/tests/snapshots/integration__integration_tests__switch_picker__switch_picker_with_branches_preview.snap
@@ -2,7 +2,7 @@
source: tests/integration_tests/switch_picker.rs
expression: preview
---
-1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary [N/M]
+1: HEAD± | 2: log | 3: main…± | 4: remote⇅ | 5: summary
Enter: switch | Tab/alt-1…5: preview | alt-c: create | Esc:
○ main has no uncommitted changes
diff --git a/vendor/NOTES.md b/vendor/NOTES.md
deleted file mode 100644
index a955e56e3..000000000
--- a/vendor/NOTES.md
+++ /dev/null
@@ -1,125 +0,0 @@
-# Vendor Notes
-
-What we currently patch and what we could patch if we vendor more.
-
-## Current patches
-
-`vendor/skim-tuikit/` is the only vendored crate. See `Cargo.toml` `[patch.crates-io]` block for the rationale on each landed change. Run `task vendor-diff` to see the live diff against the pristine upstream tarball.
-
-Landed:
-
-1. **`Output::flush` uses `write_all`** (`src/output.rs`) — fixes dropped bytes on partial writes under PTY pressure. Upstream PR: [skim-rs/skim#1056](https://github.com/skim-rs/skim/pull/1056). Drop this patch once #1056 ships in a tagged release.
-
-2. **`from_keyname` parses `alt-<digit>`** (`src/key.rs`) — adds the missing `alt-0`..`alt-9` arms (it had `alt-a`..`alt-z`), so `alt-1:…` keymaps bind. The input reader already decodes ESC-digit to `Alt(ch)`; this was a pure config-parser gap. The `wt switch` picker uses it for alt-1..alt-5 direct preview-tab jumps while leaving bare digits for the query. Matches fzf's alt-1..alt-9; clean upstream PR candidate to skim-rs/skim.
-
-In flight (dispatched 2026-04-14):
-
-3. **Symmetric smcup/rmcup in partial-height mode** — currently worked around with `SkimOptionsBuilder::no_clear_start(true)` in `src/commands/picker/mod.rs:454-457`. See [skim-rs/skim#880](https://github.com/skim-rs/skim/issues/880). Branch: `tuikit-clear-start-fix`.
-
-## Candidate future patches
-
-These are workarounds in our crate that exist because we couldn't change skim. None are urgent — the picker works. Listed as options in case we revisit the cost/benefit of vendoring `skim` itself (we currently vendor only `skim-tuikit`).
-
-**Important:** vendoring skim doubles maintenance surface (rebases, CI, license tracking). Prefer upstream PRs to skim-rs/skim where possible. The list below is "what becomes possible," not "what we should do."
-
-### High payoff
-
-- **SGR 22 (intensity reset) handling** — `src/commands/picker/items.rs` scatters `anstyle::Reset` after every styled span in preview info lines because skim's `ANSIParser::csi_dispatch` (`skim-0.20.5/src/ansi.rs`) handles SGR codes 0/1/2/4/5/7 but silently drops 22 (the reset that `color_print`'s `</>` emits for `<bold>` and `<dim>`). Without explicit `\x1b[0m`, dim/bold bleeds across the rest of the line. A one-line fix in the parser (`22 => attr.effect &= !(Effect::BOLD | Effect::DIM)`, plus 24/25/27 for parity) removes the workaround and stops future preview messages from needing to remember it. Revisit if more users report preview formatting issues.
-
-- **TypeId-mismatch downcast** — `src/commands/picker/mod.rs:217-220` falls back to string-matching `item.output()` because `as_any().downcast_ref::<WorktreeSkimItem>()` always fails (skim 0.20 builds the `SkimItem` trait in two compilation units with different TypeIds). Fixing in skim lets `PickerCollector::invoke()` work with real types.
-
-- **Action context for `reload` / `refresh-preview`** — we keep two temp files purely as side-channel IPC: one for preview mode in `src/commands/picker/preview.rs`, one for the alt-r selected item in `src/commands/picker/mod.rs:435,508-511`. Both exist because skim's actions don't pass any context to the collector. A small skim API (e.g. `Action::WithContext`) would delete both files and ~150 lines.
-
-- **Off-thread `CommandCollector::invoke`** — `src/commands/picker/mod.rs:62-66,239-250` defers git removal, branch deletion, and post-remove hooks to a background thread, otherwise skim freezes its own UI loop. Also relevant: alt-r resets the cursor to top (skim-rs/skim#1695). If skim ran `invoke()` off-thread and preserved cursor on `reload`, both go away — and we could finally document alt-r in `cli/mod.rs:598`.
-
-### Medium payoff
-
-- **Async preview rendering** — `src/commands/picker/pager.rs:22-24,82-152` runs delta/bat with a 2s timeout and threaded stdin/stdout piping because a stalled pager would freeze skim's UI thread. Async previews in skim remove both the timeout and the thread juggling.
-
-- **Thread-safe preview API** — `src/commands/picker/preview_orchestrator.rs:56-58` uses `DashMap` specifically so the UI-thread `preview()` callback never contends. A skim-side async preview API removes the need for lock-free structures.
-
-- **`invalidate_preview()` / `refresh_preview()` API** — `src/commands/picker/items.rs:160-165,183-186` shows a "Press N again to refresh" placeholder because skim has no way to re-query `preview()` after background compute lands. A trivial skim method removes the awkward UX hint.
-
-### Low payoff
-
-- **Cwd-independent skim** — `src/commands/picker/mod.rs:226-237` chdirs to `$HOME` before removing the current worktree because skim and subsequent git commands both fail on a deleted cwd. A cwd-cached skim would let us delete this dance.
-
-## Workflow for adding a vendor patch
-
-1. Make the change in `vendor/skim-tuikit/`.
-2. Update the `Cargo.toml` `[patch.crates-io]` comment block with the rationale and the upstream PR/issue URL.
-3. Run `task vendor-diff` and confirm the diff is minimal and readable.
-4. Move the entry above from "Candidate future patches" to "Landed" with the upstream tracking link.
-5. Open an upstream PR against skim-rs/skim — the goal is always to stop carrying the patch.
-
-## Skim 4.x upgrade impact (verified 2026-04-14 against v4.6.0)
-
-We currently pin skim 0.20.5. The 4.x line is a substantial rewrite — most of our candidate patches above become unnecessary, but the upgrade itself is a project. Findings from reading `github.com/skim-rs/skim` at tag `v4.6.0` (clone at `~/workspace/skim`):
-
-### Architecture changes relevant to our patches
-
-- **tuikit is gone.** 4.x depends on `ratatui = "0.30"` + `crossterm` directly; there is no `skim-tuikit` crate in its dep graph. `src/tui/` is the internal TUI module. Our `vendor/skim-tuikit/` patch tree becomes orphaned — nothing to rebase onto.
-- **ANSI parser replaced.** The homegrown `ANSIParser` is gone; `ansi-to-tui = "8.0.1"` handles ANSI in `src/tui/{header,input,preview,util}.rs`. SGR handling moves to that crate's responsibility.
-- **Preview model rewritten.** `src/tui/preview.rs` uses `portable_pty` for command-based previews, runs them on a dedicated thread (`thread_handle: Option<JoinHandle<()>>`), and renders via `tui_term::vt100` + `ratatui`. UI thread is no longer blocked on preview compute.
-- **Public event channel.** `Skim::event_sender() -> tokio::sync::mpsc::Sender<Event>` (src/skim.rs:321) hands out a sender any background thread can push into. `Event::RunPreview` is a public variant of the public `Event` enum (src/tui/event.rs:144).
-- **Async action callbacks.** `ActionCallback::new` / `new_sync` accept async or sync closures receiving `&mut App` (src/tui/event.rs:54–108). Custom actions get direct mutable access to app state instead of going through side channels.
-- **`SkimItem::preview()` unchanged** — still `fn preview(&self, _context: PreviewContext) -> ItemPreview`. Sync, same variants (`Text`/`AnsiText`/`Command`/`Global`/…).
-- **`SkimItem::display()` changed.** Returns `ratatui::text::Line<'_>` instead of `AnsiString<'_>`. Our `WorktreeSkimItem::display()` impl needs rewriting against ratatui.
-- **`SkimItem::get_index` / `set_index` removed** (4.0). We don't implement them, so zero impact.
-- **Default matcher algorithm changed** to "Arinae" (typo-resistant off by default). Our ranking snapshots and picker-perf benchmarks will shift.
-- **`AsAny` blanket impl in skim's lib** (src/lib.rs:101–116). The documented downcast example in the new `SkimItem` docstring uses it successfully — the TypeId-mismatch bug we hit is **likely** fixed by the consolidated crate structure. Needs empirical verification on our actual item type.
-
-### Per-patch fate under a 4.x upgrade
-
-| Patch | Status in 4.x | Action on upgrade |
-|---|---|---|
-| **Preview refresh / invalidate** (this memo's topic) | **Solved natively.** Push `Event::RunPreview` via `Skim::event_sender()` when cache lands. | Drop from candidate list; rewrite picker to use `event_sender()`. |
-| **Async preview / thread-safe preview API** | **Solved.** Previews run on dedicated thread + PTY. | Drop. `DashMap` for cache is still fine but no longer motivated by UI-thread contention. |
-| **SGR 22 (intensity reset) handling** | **Offloaded to `ansi-to-tui` 8.0.1.** Our skim-side fix is no longer applicable. Needs empirical check that `color_print`'s `</>` output renders correctly through `ansi-to-tui`. | Re-test the preview-tab header + `compute_*_preview` output. If `ansi-to-tui` handles 22 correctly, delete the `Reset` scatter in `items.rs`. |
-| **Action context for `reload` / `refresh-preview`** | **Solved.** `ActionCallback::new_sync(|app| …)` gives direct `&mut App`. | Drop the two temp-file side channels (`src/commands/picker/preview.rs`, `src/commands/picker/mod.rs:435,508-511`). Wire a real callback. |
-| **TypeId-mismatch downcast** | **Probably solved** by consolidated compilation + blanket `AsAny`. | Test first: if `as_any().downcast_ref::<WorktreeSkimItem>()` returns `Some`, delete the `output()`-string-match fallback in `src/commands/picker/mod.rs:217-220`. |
-| **Off-thread `CommandCollector::invoke`** | **Probably solved.** The trait may have been restructured around `ActionCallback` / async runtime. Needs concrete check of the new collector API. | Re-evaluate against the 4.x `App` + `ActionCallback` surface. |
-| **Cwd-independent skim** | Unverified — no release note mentions it. | Check empirically after upgrade. |
-| **Landed: `Output::flush` write_all (tuikit)** | **Orphaned.** `src/output.rs` in 4.x is a different file (final selection output, not terminal output). Terminal output is `ratatui::Terminal` over `CrosstermBackend<BufWriter<Stderr>>` — our tuikit fix doesn't apply. Upstream PR [#1056](https://github.com/skim-rs/skim/pull/1056) is against the 0.x line. | Drop the vendored `skim-tuikit` tree entirely. |
-| **In-flight: smcup/rmcup symmetry in partial-height mode** | Orphaned same reason — tuikit is gone. | Re-evaluate the symptom against 4.x's ratatui-based alt-screen handling before reinventing. |
-
-### Net cost/benefit
-
-- **If we upgrade to 4.x first:** every open skim-side patch except possibly cwd-independence becomes unnecessary. `vendor/skim-tuikit/` can be deleted. Carrying zero vendor patches against skim is achievable.
-- **If we patch 0.20.5 now:** the preview-refresh fix is ~15 vendored LOC in `previewer.rs` + `model/mod.rs`. Cheap to carry until we migrate.
-- **4.x migration cost on our side** (not the vendor tree): rewrite `WorktreeSkimItem::display()` for `ratatui::text::Line`, re-snapshot picker ranking tests (matcher default changed), re-test ANSI rendering through `ansi-to-tui`, re-wire actions to `ActionCallback` (potentially big simplification, potentially churn). Non-trivial but bounded.
-
-### Stability assessment — don't vendor yet (2026-04-14)
-
-Considered vendoring skim 4.x ourselves with loosened dep pins. Decided **not yet**. Reasons:
-
-- **Upstream is already fixing the pinning problem.** [skim-rs/skim#1050](https://github.com/skim-rs/skim/issues/1050) was filed 2026-04-13 and closed 2026-04-14 with maintainer LoricAndre committing to loosen pins on widely-used deps and ship a release "today or tomorrow." Our primary rationale for vendoring (unpinning `=X.Y.Z` constraints on ~17 deps) evaporates if that release delivers. Re-check after next release — if pins are livable, migrate against crates.io skim with zero vendor cost.
-- **4.x is a young rewrite, stabilizing but not stable.** Bug intake by month (`bug`-labeled issues, 4.x era): 25 (Jan), 12 (Feb), 5 (Mar), 2 (Apr half-month). Declining sharply. But the cohort touches exactly our surface area: PTY preview hangs ([#951](https://github.com/skim-rs/skim/issues/951)), PTY changes cwd ([#950](https://github.com/skim-rs/skim/issues/950)), runaway thread loop ([#949](https://github.com/skim-rs/skim/issues/949)), matcher flake ([#947](https://github.com/skim-rs/skim/issues/947)), preview runs once per invocation ([#944](https://github.com/skim-rs/skim/issues/944)), some ANSI codes wrong in preview ([#964](https://github.com/skim-rs/skim/issues/964)). All closed, all within the last 8 weeks.
-- **Open concern**: [#988](https://github.com/skim-rs/skim/issues/988) `MatchedItem should be Weak<dyn SkimItem>` — lifecycle/cycle bug, still open, affects how picker items live and die. Track before migrating.
-- **Release cadence is ~2/week.** Eight 4.x releases in April alone. Vendoring a crate that ships this often means rebasing our fork every few days — materially more expensive than the current `vendor/skim-tuikit/` tree (which hasn't shipped since Aug 2025, hence zero rebase cost). Vendoring an abandoned crate is cheap; vendoring an actively-developed one is not.
-- **Bus factor of 1.** LoricAndre is doing nearly all substantive PRs. Responsive today, but if responsiveness vanishes, we'd inherit a live project.
-
-### Recommended sequence
-
-1. **This week**: watch for the next skim release (v4.7.0-ish) carrying the #1050 pin-loosening. Check whether our dep graph resolves against unpinned crates.io 4.x.
-2. **Next 4–8 weeks**: let the 4.x bug tail drain further and watch bug-intake rate. If it stays at ≤2/month, 4.x is stabilized enough to build on.
-3. **When ready, migrate without vendoring**: do the picker-side rewrite (display → `Line`, actions → `ActionCallback`, re-snapshot rankings, retest ANSI). Depend on crates.io skim. This is the best outcome — zero vendor patches against skim.
-4. **Fallback if upstream re-pins or MSRV conflicts**: the ~17-line unpin patch is trivially small and always available. We lose nothing by deferring.
-
-**For the current preview-refresh bug** that motivated this memo: ship the internal cache-refresh design (Option B+D2+C2+placeholder from the design doc, ~90 LOC, no vendor change). Accept the keypress-to-redraw limitation. By the time we'd have a skim vendor patch merged and rebased, 4.x will likely be mature enough to migrate to natively — and migration gives us `event_sender()` + `Event::RunPreview` for free.
-
-### Verification method
-
-All architectural claims in this section were verified by reading source at tag `v4.6.0` in `~/workspace/skim`. To re-verify after future skim releases:
-
-```bash
-cd ~/workspace/skim && git fetch upstream --tags && git worktree add /tmp/skim-<ver> v<ver>
-# then grep for: pub event_sender, Event::RunPreview, SkimItem trait, ansi_to_tui usage
-```
-
-Bug-intake check for stability re-assessment:
-
-```bash
-gh issue list --repo skim-rs/skim --limit 200 --state all --json number,createdAt,state,labels \
- --jq '[.[] | select(.labels | map(.name) | index("bug"))] | group_by(.createdAt[:7]) | map({month: .[0].createdAt[:7], count: length})'
-```
diff --git a/vendor/skim-tuikit/.cargo-ok b/vendor/skim-tuikit/.cargo-ok
deleted file mode 100644
index 5f8b79583..000000000
--- a/vendor/skim-tuikit/.cargo-ok
+++ /dev/null
@@ -1 +0,0 @@
-{"v":1}
\ No newline at end of file
diff --git a/vendor/skim-tuikit/.cargo_vcs_info.json b/vendor/skim-tuikit/.cargo_vcs_info.json
deleted file mode 100644
index 179f66cd6..000000000
--- a/vendor/skim-tuikit/.cargo_vcs_info.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "git": {
- "sha1": "06c3a13ba7b8b8a3f5101031215807b0b9672107"
- },
- "path_in_vcs": "skim-tuikit"
-}
\ No newline at end of file
diff --git a/vendor/skim-tuikit/.gitignore b/vendor/skim-tuikit/.gitignore
deleted file mode 100644
index 2bb8d2531..000000000
--- a/vendor/skim-tuikit/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-/target
-**/*.rs.bk
-.idea
diff --git a/vendor/skim-tuikit/Cargo.lock b/vendor/skim-tuikit/Cargo.lock
deleted file mode 100644
index 956dd1163..000000000
--- a/vendor/skim-tuikit/Cargo.lock
+++ /dev/null
@@ -1,516 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 4
-
-[[package]]
-name = "aho-corasick"
-version = "1.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "anstream"
-version = "0.6.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"
-dependencies = [
- "anstyle",
- "anstyle-parse",
- "anstyle-query",
- "anstyle-wincon",
- "colorchoice",
- "is_terminal_polyfill",
- "utf8parse",
-]
-
-[[package]]
-name = "anstyle"
-version = "1.0.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
-
-[[package]]
-name = "anstyle-parse"
-version = "0.2.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
-dependencies = [
- "utf8parse",
-]
-
-[[package]]
-name = "anstyle-query"
-version = "1.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
-dependencies = [
- "windows-sys",
-]
-
-[[package]]
-name = "anstyle-wincon"
-version = "3.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
-dependencies = [
- "anstyle",
- "once_cell_polyfill",
- "windows-sys",
-]
-
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
-[[package]]
-name = "bitflags"
-version = "2.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
-
-[[package]]
-name = "cfg-if"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
-
-[[package]]
-name = "cfg_aliases"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
-
-[[package]]
-name = "colorchoice"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
-
-[[package]]
-name = "dirs-next"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
-dependencies = [
- "cfg-if",
- "dirs-sys-next",
-]
-
-[[package]]
-name = "dirs-sys-next"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
-dependencies = [
- "libc",
- "redox_users",
- "winapi",
-]
-
-[[package]]
-name = "env_filter"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0"
-dependencies = [
- "log",
- "regex",
-]
-
-[[package]]
-name = "env_logger"
-version = "0.11.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
-dependencies = [
- "anstream",
- "anstyle",
- "env_filter",
- "jiff",
- "log",
-]
-
-[[package]]
-name = "getrandom"
-version = "0.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
-dependencies = [
- "cfg-if",
- "libc",
- "wasi",
-]
-
-[[package]]
-name = "is_terminal_polyfill"
-version = "1.70.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
-
-[[package]]
-name = "jiff"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49"
-dependencies = [
- "jiff-static",
- "log",
- "portable-atomic",
- "portable-atomic-util",
- "serde",
-]
-
-[[package]]
-name = "jiff-static"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "lazy_static"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
-
-[[package]]
-name = "libc"
-version = "0.2.174"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
-
-[[package]]
-name = "libredox"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3"
-dependencies = [
- "bitflags 2.9.1",
- "libc",
-]
-
-[[package]]
-name = "log"
-version = "0.4.27"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
-
-[[package]]
-name = "memchr"
-version = "2.7.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
-
-[[package]]
-name = "nix"
-version = "0.29.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
-dependencies = [
- "bitflags 2.9.1",
- "cfg-if",
- "cfg_aliases",
- "libc",
-]
-
-[[package]]
-name = "once_cell_polyfill"
-version = "1.70.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
-
-[[package]]
-name = "portable-atomic"
-version = "1.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
-
-[[package]]
-name = "portable-atomic-util"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
-dependencies = [
- "portable-atomic",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.95"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
-dependencies = [
- "unicode-ident",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.40"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "redox_users"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
-dependencies = [
- "getrandom",
- "libredox",
- "thiserror",
-]
-
-[[package]]
-name = "regex"
-version = "1.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
-dependencies = [
- "aho-corasick",
- "memchr",
- "regex-automata",
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-automata"
-version = "0.4.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
-dependencies = [
- "aho-corasick",
- "memchr",
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-syntax"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
-
-[[package]]
-name = "rustversion"
-version = "1.0.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
-
-[[package]]
-name = "serde"
-version = "1.0.219"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
-dependencies = [
- "serde_derive",
-]
-
-[[package]]
-name = "serde_derive"
-version = "1.0.219"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "skim-common"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8312ae7ca1a5883e68042b9c6bce05bfc12f06b814ecfda06c34abfb6c88175"
-
-[[package]]
-name = "skim-tuikit"
-version = "0.6.6"
-dependencies = [
- "bitflags 1.3.2",
- "env_logger",
- "lazy_static",
- "log",
- "nix",
- "skim-common",
- "term",
- "unicode-width",
-]
-
-[[package]]
-name = "syn"
-version = "2.0.104"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "term"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
-dependencies = [
- "dirs-next",
- "rustversion",
- "winapi",
-]
-
-[[package]]
-name = "thiserror"
-version = "1.0.69"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
-dependencies = [
- "thiserror-impl",
-]
-
-[[package]]
-name = "thiserror-impl"
-version = "1.0.69"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "unicode-ident"
-version = "1.0.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
-
-[[package]]
-name = "unicode-width"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c"
-
-[[package]]
-name = "utf8parse"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
-
-[[package]]
-name = "wasi"
-version = "0.11.1+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
-[[package]]
-name = "windows-link"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
-
-[[package]]
-name = "windows-sys"
-version = "0.60.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
-dependencies = [
- "windows-targets",
-]
-
-[[package]]
-name = "windows-targets"
-version = "0.53.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"
-dependencies = [
- "windows-link",
- "windows_aarch64_gnullvm",
- "windows_aarch64_msvc",
- "windows_i686_gnu",
- "windows_i686_gnullvm",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_gnullvm",
- "windows_x86_64_msvc",
-]
-
-[[package]]
-name = "windows_aarch64_gnullvm"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
-
-[[package]]
-name = "windows_i686_gnullvm"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
-
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
-
-[[package]]
-name = "windows_x86_64_gnullvm"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.53.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
diff --git a/vendor/skim-tuikit/Cargo.toml b/vendor/skim-tuikit/Cargo.toml
deleted file mode 100644
index 490db32aa..000000000
--- a/vendor/skim-tuikit/Cargo.toml
+++ /dev/null
@@ -1,115 +0,0 @@
-# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
-#
-# When uploading crates to the registry Cargo will automatically
-# "normalize" Cargo.toml files for maximal compatibility
-# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies.
-#
-# If you are reading this file be aware that the original Cargo.toml
-# will likely look very different (and much more reasonable).
-# See Cargo.toml.orig for the original contents.
-
-[package]
-edition = "2024"
-name = "skim-tuikit"
-version = "0.6.6"
-authors = ["Jinzhou Zhang <[email protected]>"]
-build = false
-autolib = false
-autobins = false
-autoexamples = false
-autotests = false
-autobenches = false
-description = "Toolkit for writing TUI applications"
-homepage = "https://github.com/skim-rs/skim"
-documentation = "https://docs.rs/skim-tuikit"
-readme = "README.md"
-keywords = [
- "tui",
- "terminal",
- "tty",
- "color",
-]
-license = "MIT"
-repository = "https://github.com/skim-rs/skim"
-resolver = "2"
-
-[lib]
-name = "skim_tuikit"
-path = "src/lib.rs"
-
-[[example]]
-name = "256color"
-path = "examples/256color.rs"
-
-[[example]]
-name = "256color_on_screen"
-path = "examples/256color_on_screen.rs"
-
-[[example]]
-name = "custom-event"
-path = "examples/custom-event.rs"
-
-[[example]]
-name = "get_keys"
-path = "examples/get_keys.rs"
-
-[[example]]
-name = "hello-world"
-path = "examples/hello-world.rs"
-
-[[example]]
-name = "split"
-path = "examples/split.rs"
-
-[[example]]
-name = "stack"
-path = "examples/stack.rs"
-
-[[example]]
-name = "term_size"
-path = "examples/term_size.rs"
-
-[[example]]
-name = "termbox"
-path = "examples/termbox.rs"
-
-[[example]]
-name = "true_color"
-path = "examples/true_color.rs"
-
-[[example]]
-name = "win"
-path = "examples/win.rs"
-
-[dependencies.bitflags]
-version = "1.3.2"
-
-[dependencies.lazy_static]
-version = "1.2.0"
-
-[dependencies.log]
-version = "0.4.27"
-
-[dependencies.nix]
-version = "0.29.0"
-features = [
- "fs",
- "fs",
- "poll",
- "signal",
- "term",
-]
-default-features = false
-
-[dependencies.skim-common]
-version = "0.2.0"
-
-[dependencies.term]
-version = "0.7"
-
-[dependencies.unicode-width]
-version = "0.2.1"
-
-[dev-dependencies.env_logger]
-version = "0.11.6"
diff --git a/vendor/skim-tuikit/Cargo.toml.orig b/vendor/skim-tuikit/Cargo.toml.orig
deleted file mode 100644
index afcf3bfe6..000000000
--- a/vendor/skim-tuikit/Cargo.toml.orig
+++ /dev/null
@@ -1,24 +0,0 @@
-[package]
-name = "skim-tuikit"
-version = "0.6.6"
-authors = ["Jinzhou Zhang <[email protected]>"]
-description = "Toolkit for writing TUI applications"
-documentation = "https://docs.rs/skim-tuikit"
-homepage = "https://github.com/skim-rs/skim"
-repository = "https://github.com/skim-rs/skim"
-readme = "README.md"
-keywords = ["tui", "terminal", "tty", "color"]
-license = "MIT"
-edition = "2024"
-
-[dependencies]
-bitflags = { workspace = true }
-skim-common = { path = "../skim-common/", version = "0.2.0" }
-lazy_static = { workspace = true }
-log = { workspace = true }
-nix = { workspace = true, default-features = false, features = ["fs", "poll", "signal", "term"] }
-term = { workspace = true }
-unicode-width = { workspace = true }
-
-[dev-dependencies]
-env_logger = { workspace = true }
diff --git a/vendor/skim-tuikit/LICENSE b/vendor/skim-tuikit/LICENSE
deleted file mode 100644
index 456b81bc5..000000000
--- a/vendor/skim-tuikit/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Jinzhou Zhang
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/skim-tuikit/README.md b/vendor/skim-tuikit/README.md
deleted file mode 100644
index a3f824d0d..000000000
--- a/vendor/skim-tuikit/README.md
+++ /dev/null
@@ -1,142 +0,0 @@
-[![Crates.io](https://img.shields.io/crates/v/skim-tuikit.svg)](https://crates.io/crates/skim-tuikit)
-
-## Tuikit
-
-Tuikit is a TUI library for writing terminal UI applications. Highlights:
-
-- Thread safe.
-- Support non-fullscreen mode as well as fullscreen mode.
-- Support `Alt` keys, mouse events, etc.
-- Buffering for efficient rendering.
-
-Tuikit is modeld after [termbox](https://github.com/nsf/termbox) which views the
-terminal as a table of fixed-size cells and input being a stream of structured
-messages.
-
-**WARNING**: The library is not stable yet, the API might change.
-
-## Usage
-
-In your `Cargo.toml` add the following:
-
-```toml
-[dependencies]
-skim-tuikit = "*"
-```
-
-
-Here is an example (could also be run by `cargo run --example hello-world`):
-
-```rust
-use skim_tuikit::prelude::*;
-use std::cmp::{min, max};
-
-fn main() {
- let term: Term<()> = Term::with_height(TermHeight::Percent(30)).unwrap();
- let mut row = 1;
- let mut col = 0;
-
- let _ = term.print(0, 0, "press arrow key to move the text, (q) to quit");
- let _ = term.present();
-
- while let Ok(ev) = term.poll_event() {
- let _ = term.clear();
- let _ = term.print(0, 0, "press arrow key to move the text, (q) to quit");
-
- let (width, height) = term.term_size().unwrap();
- match ev {
- Event::Key(Key::ESC) | Event::Key(Key::Char('q')) => break,
- Event::Key(Key::Up) => row = max(row-1, 1),
- Event::Key(Key::Down) => row = min(row+1, height-1),
- Event::Key(Key::Left) => col = max(col, 1)-1,
- Event::Key(Key::Right) => col = min(col+1, width-1),
- _ => {}
- }
-
- let attr = Attr{ fg: Color::RED, ..Attr::default() };
- let _ = term.print_with_attr(row, col, "Hello World! 你好!今日は。", attr);
- let _ = term.set_cursor(row, col);
- let _ = term.present();
- }
-}
-```
-
-## Layout
-
-`tuikit` provides `HSplit`, `VSplit` and `Win` for managing layouts:
-
-1. `HSplit` allow you to split area horizontally into pieces.
-2. `VSplit` works just like `HSplit` but splits vertically.
-3. `Win` do not split, it could have margin, padding and border.
-
-For example:
-
-```rust
-use skim_tuikit::prelude::*;
-
-struct Model(String);
-
-impl Draw for Model {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let message_width = self.0.len();
- let left = (width - message_width) / 2;
- let top = height / 2;
- let _ = canvas.print(top, left, &self.0);
- Ok(())
- }
-}
-
-impl Widget for Model{}
-
-fn main() {
- let term: Term<()> = Term::with_height(TermHeight::Percent(50)).unwrap();
- let model = Model("middle!".to_string());
-
- while let Ok(ev) = term.poll_event() {
- if let Event::Key(Key::Char('q')) = ev {
- break;
- }
- let _ = term.print(0, 0, "press 'q' to exit");
-
- let hsplit = HSplit::default()
- .split(
- VSplit::default()
- .basis(Size::Percent(30))
- .split(Win::new(&model).border(true).basis(Size::Percent(30)))
- .split(Win::new(&model).border(true).basis(Size::Percent(30)))
- )
- .split(Win::new(&model).border(true));
-
- let _ = term.draw(&hsplit);
- let _ = term.present();
- }
-}
-```
-
-The split algorithm is simple:
-
-1. Both `HSplit` and `VSplit` will take several `Split` where a `Split` would
- contains:
- 1. basis, the original size
- 2. grow, the factor to grow if there is still enough room
- 3. shrink, the factor to shrink if there is not enough room
-2. `HSplit/VSplit` will count the total width/height(basis) of the split items
-3. Judge if the current width/height is enough or not for the split items
-4. shrink/grow the split items according to their grow/shrink: `factor / sum(factors)`
-5. If still not enough room, the last one(s) would be set width/height 0
-
-## References
-
-`Tuikit` borrows ideas from lots of other projects:
-
-- [rustyline](https://github.com/kkawakam/rustyline) Readline Implementation in Rust.
- - How to enter the raw mode.
- - Part of the keycode parsing logic.
-- [termion](https://gitlab.redox-os.org/redox-os/termion) A bindless library for controlling terminals/TTY.
- - How to parse mouse events.
- - How to enter raw mode.
-- [rustbox](https://github.com/gchp/rustbox) and [termbox](https://github.com/nsf/termbox)
- - The idea of viewing terminal as table of fixed cells.
-- [termfest](https://github.com/agatan/termfest) Easy TUI library written in Rust
- - The buffering idea.
diff --git a/vendor/skim-tuikit/examples/256color.rs b/vendor/skim-tuikit/examples/256color.rs
deleted file mode 100644
index dae0ebbde..000000000
--- a/vendor/skim-tuikit/examples/256color.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-use skim_tuikit::attr::Color;
-use skim_tuikit::output::Output;
-use std::io;
-
-fn main() {
- let mut output = Output::new(Box::new(io::stdout())).unwrap();
-
- for fg in 0..=255 {
- output.set_fg(Color::AnsiValue(fg));
- output.write(format!("{:5}", fg).as_str());
- if fg % 16 == 15 {
- output.reset_attributes();
- output.write("\n");
- output.flush()
- }
- }
-
- output.reset_attributes();
-
- for bg in 0..=255 {
- output.set_bg(Color::AnsiValue(bg));
- output.write(format!("{:5}", bg).as_str());
- if bg % 16 == 15 {
- output.reset_attributes();
- output.write("\n");
- output.flush()
- }
- }
-
- output.flush()
-}
diff --git a/vendor/skim-tuikit/examples/256color_on_screen.rs b/vendor/skim-tuikit/examples/256color_on_screen.rs
deleted file mode 100644
index 493b0a499..000000000
--- a/vendor/skim-tuikit/examples/256color_on_screen.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-use skim_tuikit::attr::{Attr, Color};
-use skim_tuikit::canvas::Canvas;
-use skim_tuikit::output::Output;
-use skim_tuikit::screen::Screen;
-use std::io;
-
-fn main() {
- let mut output = Output::new(Box::new(io::stdout())).unwrap();
- let (width, height) = output.terminal_size().unwrap();
- let mut screen = Screen::new(width, height);
-
- for fg in 0..=255 {
- let _ = screen.print_with_attr(
- fg / 16,
- (fg % 16) * 5,
- format!("{:5}", fg).as_str(),
- Color::AnsiValue(fg as u8).into(),
- );
- }
-
- let _ = screen.set_cursor(15, 80);
- let commands = screen.present();
-
- commands.into_iter().for_each(|cmd| output.execute(cmd));
- output.flush();
-
- let _ = screen.print_with_attr(0, 78, "HELLO WORLD", Attr::default());
- let commands = screen.present();
-
- commands.into_iter().for_each(|cmd| output.execute(cmd));
- output.flush();
-
- for bg in 0..=255 {
- let _ = screen.print_with_attr(
- bg / 16,
- (bg % 16) * 5,
- format!("{:5}", bg).as_str(),
- Attr {
- bg: Color::AnsiValue(bg as u8),
- ..Attr::default()
- },
- );
- }
- let commands = screen.present();
- commands.into_iter().for_each(|cmd| output.execute(cmd));
- output.reset_attributes();
- output.flush()
-}
diff --git a/vendor/skim-tuikit/examples/custom-event.rs b/vendor/skim-tuikit/examples/custom-event.rs
deleted file mode 100644
index 9873e9ca4..000000000
--- a/vendor/skim-tuikit/examples/custom-event.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use bitflags::_core::result::Result::Ok;
-
-use skim_tuikit::prelude::*;
-
-fn main() {
- let term: Term<String> = Term::with_height(TermHeight::Percent(30)).expect("term creation error");
- let _ = term.print(0, 0, "Press 'q' or 'Ctrl-c' to quit!");
- while let Ok(ev) = term.poll_event() {
- match ev {
- Event::Key(Key::Char('q')) | Event::Key(Key::Ctrl('c')) => break,
- Event::Key(key) => {
- let _ = term.print(1, 0, format!("get key: {:?}", key).as_str());
- let _ = term.send_event(Event::User(format!("key: {:?}", key)));
- }
- Event::User(ev_str) => {
- let _ = term.print(2, 0, format!("user event: {}", &ev_str).as_str());
- }
- _ => {
- let _ = term.print(3, 0, format!("event: {:?}", ev).as_str());
- }
- }
- let _ = term.present();
- }
-}
diff --git a/vendor/skim-tuikit/examples/get_keys.rs b/vendor/skim-tuikit/examples/get_keys.rs
deleted file mode 100644
index 6d518d29b..000000000
--- a/vendor/skim-tuikit/examples/get_keys.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-use skim_tuikit::input::KeyBoard;
-use skim_tuikit::key::Key;
-use skim_tuikit::output::Output;
-use skim_tuikit::raw::IntoRawMode;
-use std::time::Duration;
-
-fn main() {
- let _stdout = std::io::stdout().into_raw_mode().unwrap();
- let mut output = Output::new(Box::new(_stdout)).unwrap();
- output.enable_mouse_support();
- output.flush();
-
- println!("program will exit on pressing `q` or wait 5 seconds");
-
- // let mut keyboard = KeyBoard::new(Box::new(std::io::stdin()));
- let mut keyboard = KeyBoard::new_with_tty();
- while let Ok(key) = keyboard.next_key_timeout(Duration::from_secs(5)) {
- if key == Key::Char('q') {
- break;
- }
- println!("print: {:?}", key);
- }
- output.disable_mouse_support();
- output.flush();
-}
diff --git a/vendor/skim-tuikit/examples/hello-world.rs b/vendor/skim-tuikit/examples/hello-world.rs
deleted file mode 100644
index c1148b13e..000000000
--- a/vendor/skim-tuikit/examples/hello-world.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use skim_tuikit::prelude::*;
-use std::cmp::{max, min};
-
-fn main() {
- let term: Term<()> = Term::with_height(TermHeight::Percent(30)).unwrap();
- let mut row = 1;
- let mut col = 0;
-
- let _ = term.print(0, 0, "press arrow key to move the text, (q) to quit");
- let _ = term.present();
-
- while let Ok(ev) = term.poll_event() {
- let _ = term.clear();
- let _ = term.print(0, 0, "press arrow key to move the text, (q) to quit");
-
- let (width, height) = term.term_size().unwrap();
- match ev {
- Event::Key(Key::ESC) | Event::Key(Key::Char('q')) | Event::Key(Key::Ctrl('c')) => break,
- Event::Key(Key::Up) => row = max(row - 1, 1),
- Event::Key(Key::Down) => row = min(row + 1, height - 1),
- Event::Key(Key::Left) => col = max(col, 1) - 1,
- Event::Key(Key::Right) => col = min(col + 1, width - 1),
- _ => {}
- }
-
- let _ = term.print_with_attr(row, col, "Hello World! 你好!今日は。", Color::RED);
- let _ = term.set_cursor(row, col);
- let _ = term.present();
- }
-}
diff --git a/vendor/skim-tuikit/examples/split.rs b/vendor/skim-tuikit/examples/split.rs
deleted file mode 100644
index c3783884d..000000000
--- a/vendor/skim-tuikit/examples/split.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-use skim_tuikit::prelude::*;
-
-struct Fit(String);
-
-impl Draw for Fit {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (_width, height) = canvas.size()?;
- let top = height / 2;
- let _ = canvas.print(top, 0, &self.0);
- Ok(())
- }
-}
-impl Widget for Fit {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- (Some(self.0.len()), None)
- }
-}
-
-struct Model(String);
-
-impl Draw for Model {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let message_width = self.0.len();
- let left = (width - message_width) / 2;
- let top = height / 2;
- let _ = canvas.print_with_attr(0, left, "press 'q' to exit", Effect::UNDERLINE.into());
- let _ = canvas.print(top, left, &self.0);
- Ok(())
- }
-}
-
-impl Widget for Model {}
-
-fn main() {
- let term: Term<()> = Term::with_height(TermHeight::Percent(50)).unwrap();
- let model = Model("Hey, I'm in middle!".to_string());
- let fit = Fit("Short Text That Fits".to_string());
-
- while let Ok(ev) = term.poll_event() {
- match ev {
- Event::Key(Key::Char('q')) | Event::Key(Key::Ctrl('c')) => break,
- _ => (),
- }
-
- let hsplit = HSplit::default()
- .split(
- VSplit::default()
- .shrink(0)
- .grow(0)
- .split(Win::new(&fit).border(true))
- .split(Win::new(&fit).border(true)),
- )
- .split(Win::new(&model).border(true));
-
- let _ = term.draw(&hsplit);
- let _ = term.present();
- }
-}
diff --git a/vendor/skim-tuikit/examples/stack.rs b/vendor/skim-tuikit/examples/stack.rs
deleted file mode 100644
index d2c1e2540..000000000
--- a/vendor/skim-tuikit/examples/stack.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-use skim_tuikit::prelude::*;
-
-struct Model {
- win: String,
-}
-
-impl Draw for Model {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let _ = canvas.clear();
- let message_width = self.win.len();
- let left = (width - message_width) / 2;
- let top = height / 2;
- let _ = canvas.print(top, left, &self.win);
- Ok(())
- }
-}
-
-impl Widget<String> for Model {
- fn on_event(&self, event: Event, _rect: Rectangle) -> Vec<String> {
- if let Event::Key(Key::SingleClick(_, _, _)) = event {
- vec![format!("{} clicked", self.win)]
- } else {
- vec![]
- }
- }
-}
-
-fn main() {
- let term = Term::with_options(TermOptions::default().mouse_enabled(true)).unwrap();
- let (mut width, mut height) = term.term_size().unwrap();
-
- while let Ok(ev) = term.poll_event() {
- match ev {
- Event::Key(Key::Char('q')) | Event::Key(Key::Ctrl('c')) => break,
- Event::Key(Key::MouseRelease(_, _)) => continue,
- Event::Resize { width: w, height: h } => {
- width = w;
- height = h;
- }
- _ => (),
- }
- let stack = Stack::<String>::new()
- .top(
- Win::new(Model {
- win: "win floating on top".to_string(),
- })
- .border(true)
- .margin(Size::Percent(30)),
- )
- .bottom(
- HSplit::default()
- .split(
- Win::new(Model {
- win: String::from("left"),
- })
- .border(true),
- )
- .split(
- Win::new(Model {
- win: String::from("right"),
- })
- .border(true),
- ),
- );
-
- let message = stack.on_event(
- ev,
- Rectangle {
- width,
- height,
- top: 0,
- left: 0,
- },
- );
- let click_message = if message.is_empty() { "" } else { &message[0] };
- let _ = term.draw(&stack);
- let _ = term.print(1, 1, "press 'q' to exit, try clicking on windows");
- let _ = term.print(2, 1, &(String::from(click_message) + " "));
- let _ = term.present();
- }
- let _ = term.show_cursor(false);
-}
diff --git a/vendor/skim-tuikit/examples/term_size.rs b/vendor/skim-tuikit/examples/term_size.rs
deleted file mode 100644
index 634837a1c..000000000
--- a/vendor/skim-tuikit/examples/term_size.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-use skim_tuikit::output::Output;
-use std::io;
-
-fn main() {
- let output = Output::new(Box::new(io::stdout())).unwrap();
- let (width, height) = output.terminal_size().unwrap();
- println!("width: {}, height: {}", width, height);
-}
diff --git a/vendor/skim-tuikit/examples/termbox.rs b/vendor/skim-tuikit/examples/termbox.rs
deleted file mode 100644
index 99de58026..000000000
--- a/vendor/skim-tuikit/examples/termbox.rs
+++ /dev/null
@@ -1,73 +0,0 @@
-use skim_tuikit::prelude::*;
-use std::sync::Arc;
-use std::thread;
-use std::time::{Duration, Instant};
-
-extern crate env_logger;
-
-/// This example is testing tuikit with multi-threads.
-
-const COL: usize = 4;
-
-fn main() {
- env_logger::init();
- let term = Arc::new(Term::with_height(TermHeight::Fixed(10)).unwrap());
- let _ = term.enable_mouse_support();
- let now = Instant::now();
-
- print_banner(&term);
-
- let th = thread::spawn(move || {
- while let Ok(ev) = term.poll_event() {
- match ev {
- Event::Key(Key::Char('q')) | Event::Key(Key::Ctrl('c')) => break,
- Event::Key(Key::Char('r')) => {
- let term = term.clone();
- thread::spawn(move || {
- let _ = term.pause();
- println!("restart in 2 seconds");
- thread::sleep(Duration::from_secs(2));
- let _ = term.restart();
- let _ = term.clear();
- });
- }
- _ => (),
- }
-
- print_banner(&term);
- print_event(&term, ev, &now);
- }
- });
- let _ = th.join();
-}
-
-fn print_banner(term: &Term) {
- let (_, height) = term.term_size().unwrap_or((5, 5));
- for row in 0..height {
- let _ = term.print(row, 0, format!("{} ", row).as_str());
- }
- let attr = Attr {
- fg: Color::GREEN,
- effect: Effect::UNDERLINE,
- ..Attr::default()
- };
- let _ = term.print_with_attr(0, COL, "How to use: (q)uit, (r)estart", attr);
- let _ = term.present();
-}
-
-fn print_event(term: &Term, ev: Event, now: &Instant) {
- let elapsed = now.elapsed();
- let (_, height) = term.term_size().unwrap_or((5, 5));
- let _ = term.print(1, COL, format!("{:?}", ev).as_str());
- let _ = term.print(
- height - 1,
- COL,
- format!(
- "time elapsed since program start: {}s + {}ms",
- elapsed.as_secs(),
- elapsed.subsec_millis()
- )
- .as_str(),
- );
- let _ = term.present();
-}
diff --git a/vendor/skim-tuikit/examples/true_color.rs b/vendor/skim-tuikit/examples/true_color.rs
deleted file mode 100644
index c4de1ce16..000000000
--- a/vendor/skim-tuikit/examples/true_color.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-use skim_tuikit::attr::Color;
-use skim_tuikit::output::Output;
-use std::io;
-
-// ported from: https://github.com/gnachman/iTerm2/blob/master/tests/24-bit-color.sh
-// should be run in terminals that supports true color
-
-// given a color idx/22 along HSV, return (r, g, b)
-fn rainbow_color(idx: u8) -> (u8, u8, u8) {
- let h = idx / 43;
- let f = idx - 43 * h;
- let t = ((f as i32 * 255) / 43) as u8;
- let q = 255 - t;
-
- match h {
- 0 => (255, t, 0),
- 1 => (q, 255, 0),
- 2 => (0, 255, t),
- 3 => (0, q, 255),
- 4 => (t, 0, 255),
- 5 => (255, 0, q),
- _ => unreachable!(),
- }
-}
-
-fn try_background(output: &mut Output, r: u8, g: u8, b: u8) {
- output.set_bg(Color::Rgb(r, g, b));
- output.write(" ")
-}
-
-fn reset_output(output: &mut Output) {
- output.reset_attributes();
- output.write("\n");
- output.flush();
-}
-
-fn main() {
- let mut output = Output::new(Box::new(io::stdout())).unwrap();
- for i in 0..=127 {
- try_background(&mut output, i, 0, 0);
- }
- reset_output(&mut output);
-
- for i in (128..=255).rev() {
- try_background(&mut output, i, 0, 0);
- }
- reset_output(&mut output);
-
- for i in 0..=127 {
- try_background(&mut output, 0, i, 0);
- }
- reset_output(&mut output);
-
- for i in (128..=255).rev() {
- try_background(&mut output, 0, i, 0);
- }
- reset_output(&mut output);
-
- for i in 0..=127 {
- try_background(&mut output, 0, 0, i);
- }
- reset_output(&mut output);
-
- for i in (128..=255).rev() {
- try_background(&mut output, 0, 0, i);
- }
- reset_output(&mut output);
-
- for i in 0..=127 {
- let (r, g, b) = rainbow_color(i);
- try_background(&mut output, r, g, b);
- }
- reset_output(&mut output);
-
- for i in (128..=255).rev() {
- let (r, g, b) = rainbow_color(i);
- try_background(&mut output, r, g, b);
- }
- reset_output(&mut output);
-}
diff --git a/vendor/skim-tuikit/examples/win.rs b/vendor/skim-tuikit/examples/win.rs
deleted file mode 100644
index 75ec8ce57..000000000
--- a/vendor/skim-tuikit/examples/win.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-use skim_tuikit::prelude::*;
-
-struct Model(String);
-
-impl Draw for Model {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let message_width = self.0.len();
- let left = (width - message_width) / 2;
- let top = height / 2;
- let _ = canvas.print(top, left, &self.0);
- Ok(())
- }
-}
-
-impl Widget for Model {}
-
-fn main() {
- let term: Term<()> = Term::with_options(
- TermOptions::default()
- .height(TermHeight::Percent(50))
- .disable_alternate_screen(true)
- .clear_on_start(false),
- )
- .unwrap();
- let model = Model("Hey, I'm in middle!".to_string());
-
- while let Ok(ev) = term.poll_event() {
- match ev {
- Event::Key(Key::Char('q')) | Event::Key(Key::Ctrl('c')) => break,
- _ => (),
- }
- let _ = term.print(0, 0, "press 'q' to exit");
-
- let inner_win = Win::new(&model)
- .fn_draw_header(Box::new(|canvas| {
- let _ = canvas.print(0, 0, "header printed with function");
- Ok(())
- }))
- .border(true);
-
- let win_bottom_title = Win::new(&inner_win)
- .title_align(HorizontalAlign::Center)
- .title("Title (at bottom) center aligned")
- .right_prompt("Right Prompt stays")
- .title_on_top(false)
- .border_bottom(true);
-
- let win = Win::new(&win_bottom_title)
- .margin(Size::Percent(10))
- .padding(1)
- .title("Window Title")
- .right_prompt("Right Prompt")
- .border(true)
- .border_top_attr(Color::BLUE)
- .border_right_attr(Color::YELLOW)
- .border_bottom_attr(Color::RED)
- .border_left_attr(Color::GREEN);
-
- let _ = term.draw(&win);
- let _ = term.present();
- }
-}
diff --git a/vendor/skim-tuikit/src/attr.rs b/vendor/skim-tuikit/src/attr.rs
deleted file mode 100644
index 232fdeea5..000000000
--- a/vendor/skim-tuikit/src/attr.rs
+++ /dev/null
@@ -1,103 +0,0 @@
-//! attr modules defines the attributes(colors, effects) of a terminal cell
-
-use bitflags::bitflags;
-
-pub use crate::color::Color;
-
-/// `Attr` is a rendering attribute that contains fg color, bg color and text effect.
-///
-/// ```
-/// use skim_tuikit::attr::{Attr, Effect, Color};
-///
-/// let attr = Attr { fg: Color::RED, effect: Effect::BOLD, ..Attr::default() };
-/// ```
-#[derive(Debug, Clone, Copy, PartialEq)]
-pub struct Attr {
- pub fg: Color,
- pub bg: Color,
- pub effect: Effect,
-}
-
-impl Default for Attr {
- fn default() -> Self {
- Attr {
- fg: Color::default(),
- bg: Color::default(),
- effect: Effect::empty(),
- }
- }
-}
-
-impl Attr {
- /// extend the properties with the new attr's if the properties in new attr is not default.
- /// ```
- /// use skim_tuikit::attr::{Attr, Color, Effect};
- ///
- /// let default = Attr{fg: Color::BLUE, bg: Color::YELLOW, effect: Effect::BOLD};
- /// let new = Attr{fg: Color::Default, bg: Color::WHITE, effect: Effect::REVERSE};
- /// let extended = default.extend(new);
- ///
- /// assert_eq!(Color::BLUE, extended.fg);
- /// assert_eq!(Color::WHITE, extended.bg);
- /// assert_eq!(Effect::BOLD | Effect::REVERSE, extended.effect);
- /// ```
- pub fn extend(&self, new_attr: Self) -> Attr {
- Attr {
- fg: if new_attr.fg != Color::default() {
- new_attr.fg
- } else {
- self.fg
- },
- bg: if new_attr.bg != Color::default() {
- new_attr.bg
- } else {
- self.bg
- },
- effect: self.effect | new_attr.effect,
- }
- }
-
- pub fn fg(mut self, fg: Color) -> Self {
- self.fg = fg;
- self
- }
-
- pub fn bg(mut self, bg: Color) -> Self {
- self.bg = bg;
- self
- }
-
- pub fn effect(mut self, effect: Effect) -> Self {
- self.effect = effect;
- self
- }
-}
-
-bitflags! {
- /// `Effect` is the effect of a text
- pub struct Effect: u8 {
- const BOLD = 0b00000001;
- const DIM = 0b00000010;
- const UNDERLINE = 0b00000100;
- const BLINK = 0b00001000;
- const REVERSE = 0b00010000;
- }
-}
-
-impl From<Color> for Attr {
- fn from(fg: Color) -> Self {
- Attr {
- fg,
- ..Default::default()
- }
- }
-}
-
-impl From<Effect> for Attr {
- fn from(effect: Effect) -> Self {
- Attr {
- effect,
- ..Default::default()
- }
- }
-}
diff --git a/vendor/skim-tuikit/src/canvas.rs b/vendor/skim-tuikit/src/canvas.rs
deleted file mode 100644
index bf007bf71..000000000
--- a/vendor/skim-tuikit/src/canvas.rs
+++ /dev/null
@@ -1,116 +0,0 @@
-use crate::Result;
-/// A canvas is a trait defining the draw actions
-use crate::attr::Attr;
-use crate::cell::Cell;
-use unicode_width::UnicodeWidthChar;
-
-pub trait Canvas {
- /// Get the canvas size (width, height)
- fn size(&self) -> Result<(usize, usize)>;
-
- /// clear the canvas
- fn clear(&mut self) -> Result<()>;
-
- /// change a cell of position `(row, col)` to `cell`
- /// if `(row, col)` is out of boundary, `Ok` is returned, but no operation is taken
- /// return the width of the character/cell
- fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize>;
-
- /// just like put_cell, except it accept (char & attr)
- /// return the width of the character/cell
- fn put_char_with_attr(&mut self, row: usize, col: usize, ch: char, attr: Attr) -> Result<usize> {
- self.put_cell(row, col, Cell { ch, attr })
- }
-
- /// print `content` starting with position `(row, col)` with `attr`
- ///
- /// - canvas should NOT wrap to y+1 if the content is too long
- /// - canvas should handle wide characters
- ///
- /// returns the printed width of the content
- fn print_with_attr(&mut self, row: usize, col: usize, content: &str, attr: Attr) -> Result<usize> {
- let mut cell = Cell {
- attr,
- ..Cell::default()
- };
-
- let mut width = 0;
- for ch in content.chars() {
- cell.ch = ch;
- width += self.put_cell(row, col + width, cell)?;
- }
- Ok(width)
- }
-
- /// print `content` starting with position `(row, col)` with default attribute
- fn print(&mut self, row: usize, col: usize, content: &str) -> Result<usize> {
- self.print_with_attr(row, col, content, Attr::default())
- }
-
- /// move cursor position (row, col) and show cursor
- fn set_cursor(&mut self, row: usize, col: usize) -> Result<()>;
-
- /// show/hide cursor, set `show` to `false` to hide the cursor
- fn show_cursor(&mut self, show: bool) -> Result<()>;
-}
-
-/// A sub-area of a canvas.
-/// It will handle the adjustments of cursor movement, so that you could write
-/// to for example (0, 0) and BoundedCanvas will adjust it to real position.
-pub struct BoundedCanvas<'a> {
- canvas: &'a mut dyn Canvas,
- top: usize,
- left: usize,
- width: usize,
- height: usize,
-}
-
-impl<'a> BoundedCanvas<'a> {
- pub fn new(top: usize, left: usize, width: usize, height: usize, canvas: &'a mut dyn Canvas) -> Self {
- Self {
- canvas,
- top,
- left,
- width,
- height,
- }
- }
-}
-
-impl Canvas for BoundedCanvas<'_> {
- fn size(&self) -> Result<(usize, usize)> {
- Ok((self.width, self.height))
- }
-
- fn clear(&mut self) -> Result<()> {
- for row in self.top..(self.top + self.height) {
- for col in self.left..(self.left + self.width) {
- let _ = self.canvas.put_cell(row, col, Cell::empty());
- }
- }
-
- Ok(())
- }
-
- fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize> {
- if row >= self.height || col >= self.width {
- // do nothing
- Ok(cell.ch.width().unwrap_or(2))
- } else {
- self.canvas.put_cell(row + self.top, col + self.left, cell)
- }
- }
-
- fn set_cursor(&mut self, row: usize, col: usize) -> Result<()> {
- if row >= self.height || col >= self.width {
- // do nothing
- Ok(())
- } else {
- self.canvas.set_cursor(row + self.top, col + self.left)
- }
- }
-
- fn show_cursor(&mut self, show: bool) -> Result<()> {
- self.canvas.show_cursor(show)
- }
-}
diff --git a/vendor/skim-tuikit/src/cell.rs b/vendor/skim-tuikit/src/cell.rs
deleted file mode 100644
index d5e4fce9f..000000000
--- a/vendor/skim-tuikit/src/cell.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-/// `Cell` is a cell of the terminal.
-/// It has a display character and an attribute (fg and bg color, effects).
-use crate::attr::{Attr, Color, Effect};
-
-const EMPTY_CHAR: char = '\0';
-
-#[derive(Debug, Clone, Copy, PartialEq)]
-pub struct Cell {
- pub ch: char,
- pub attr: Attr,
-}
-
-impl Default for Cell {
- fn default() -> Self {
- Self {
- ch: ' ',
- attr: Attr::default(),
- }
- }
-}
-
-impl Cell {
- pub fn empty() -> Self {
- Self::default().ch(EMPTY_CHAR)
- }
-
- pub fn ch(mut self, ch: char) -> Self {
- self.ch = ch;
- self
- }
-
- pub fn fg(mut self, fg: Color) -> Self {
- self.attr.fg = fg;
- self
- }
-
- pub fn bg(mut self, bg: Color) -> Self {
- self.attr.bg = bg;
- self
- }
-
- pub fn effect(mut self, effect: Effect) -> Self {
- self.attr.effect = effect;
- self
- }
-
- pub fn attribute(mut self, attr: Attr) -> Self {
- self.attr = attr;
- self
- }
-
- /// check if a cell is empty
- pub fn is_empty(self) -> bool {
- self.ch == EMPTY_CHAR && self.attr == Attr::default()
- }
-}
-
-impl From<char> for Cell {
- fn from(ch: char) -> Self {
- Cell {
- ch,
- attr: Attr::default(),
- }
- }
-}
diff --git a/vendor/skim-tuikit/src/color.rs b/vendor/skim-tuikit/src/color.rs
deleted file mode 100644
index 5e8ba9389..000000000
--- a/vendor/skim-tuikit/src/color.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-/// Color of a character, could be 8 bit(256 color) or RGB color
-///
-/// ```
-/// use skim_tuikit::attr::Color;
-/// Color::RED; // predefined values
-/// Color::Rgb(255, 0, 0); // RED
-/// ```
-#[derive(Debug, Clone, Copy, PartialEq, Default)]
-#[non_exhaustive]
-pub enum Color {
- #[default]
- Default,
- AnsiValue(u8),
- Rgb(u8, u8, u8),
-}
-
-impl Color {
- pub const BLACK: Color = Color::AnsiValue(0);
- pub const RED: Color = Color::AnsiValue(1);
- pub const GREEN: Color = Color::AnsiValue(2);
- pub const YELLOW: Color = Color::AnsiValue(3);
- pub const BLUE: Color = Color::AnsiValue(4);
- pub const MAGENTA: Color = Color::AnsiValue(5);
- pub const CYAN: Color = Color::AnsiValue(6);
- pub const WHITE: Color = Color::AnsiValue(7);
- pub const LIGHT_BLACK: Color = Color::AnsiValue(8);
- pub const LIGHT_RED: Color = Color::AnsiValue(9);
- pub const LIGHT_GREEN: Color = Color::AnsiValue(10);
- pub const LIGHT_YELLOW: Color = Color::AnsiValue(11);
- pub const LIGHT_BLUE: Color = Color::AnsiValue(12);
- pub const LIGHT_MAGENTA: Color = Color::AnsiValue(13);
- pub const LIGHT_CYAN: Color = Color::AnsiValue(14);
- pub const LIGHT_WHITE: Color = Color::AnsiValue(15);
-}
diff --git a/vendor/skim-tuikit/src/draw.rs b/vendor/skim-tuikit/src/draw.rs
deleted file mode 100644
index bef104dab..000000000
--- a/vendor/skim-tuikit/src/draw.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-/// A trait defines something that could be drawn
-use crate::canvas::Canvas;
-
-pub type DrawResult<T> = std::result::Result<T, Box<dyn std::error::Error + Send + Sync>>;
-
-/// Something that knows how to draw itself onto the canvas
-#[allow(unused_variables)]
-pub trait Draw {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- Ok(())
- }
- fn draw_mut(&mut self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- self.draw(canvas)
- }
-}
-
-impl<T: Draw> Draw for &T {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- (*self).draw(canvas)
- }
- fn draw_mut(&mut self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- (*self).draw(canvas)
- }
-}
-
-impl<T: Draw> Draw for &mut T {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- (**self).draw(canvas)
- }
- fn draw_mut(&mut self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- (**self).draw_mut(canvas)
- }
-}
-
-impl<T: Draw + ?Sized> Draw for Box<T> {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- self.as_ref().draw(canvas)
- }
-
- fn draw_mut(&mut self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- self.as_mut().draw_mut(canvas)
- }
-}
diff --git a/vendor/skim-tuikit/src/error.rs b/vendor/skim-tuikit/src/error.rs
deleted file mode 100644
index 627e1a1c1..000000000
--- a/vendor/skim-tuikit/src/error.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-use std::error::Error;
-use std::fmt::{Display, Formatter};
-use std::string::FromUtf8Error;
-use std::time::Duration;
-
-#[derive(Debug)]
-pub enum TuikitError {
- UnknownSequence(String),
- NoCursorReportResponse,
- IndexOutOfBound(usize, usize),
- Timeout(Duration),
- Interrupted,
- TerminalNotStarted,
- DrawError(Box<dyn std::error::Error + Send + Sync>),
- SendEventError(String),
- FromUtf8Error(std::string::FromUtf8Error),
- ParseIntError(std::num::ParseIntError),
- IOError(std::io::Error),
- NixError(nix::Error),
- ChannelReceiveError(std::sync::mpsc::RecvError),
-}
-
-impl Display for TuikitError {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- match self {
- TuikitError::UnknownSequence(sequence) => {
- write!(f, "unsupported esc sequence: {sequence}")
- }
- TuikitError::NoCursorReportResponse => {
- write!(f, "buffer did not contain cursor position response")
- }
- TuikitError::IndexOutOfBound(row, col) => {
- write!(f, "({row}, {col}) is out of bound")
- }
- TuikitError::Timeout(duration) => write!(f, "timeout with duration: {duration:?}"),
- TuikitError::Interrupted => write!(f, "interrupted"),
- TuikitError::TerminalNotStarted => {
- write!(f, "terminal not started, call `restart` to start it")
- }
- TuikitError::DrawError(error) => write!(f, "draw error: {error}"),
- TuikitError::SendEventError(error) => write!(f, "send event error: {error}"),
- TuikitError::FromUtf8Error(error) => write!(f, "{error}"),
- TuikitError::ParseIntError(error) => write!(f, "{error}"),
- TuikitError::IOError(error) => write!(f, "{error}"),
- TuikitError::NixError(error) => write!(f, "{error}"),
- TuikitError::ChannelReceiveError(error) => write!(f, "{error}"),
- }
- }
-}
-
-impl Error for TuikitError {}
-
-impl From<std::string::FromUtf8Error> for TuikitError {
- fn from(error: FromUtf8Error) -> Self {
- TuikitError::FromUtf8Error(error)
- }
-}
-
-impl From<std::num::ParseIntError> for TuikitError {
- fn from(error: std::num::ParseIntError) -> Self {
- TuikitError::ParseIntError(error)
- }
-}
-
-impl From<nix::Error> for TuikitError {
- fn from(error: nix::Error) -> Self {
- TuikitError::NixError(error)
- }
-}
-
-impl From<std::io::Error> for TuikitError {
- fn from(error: std::io::Error) -> Self {
- TuikitError::IOError(error)
- }
-}
-
-impl From<std::sync::mpsc::RecvError> for TuikitError {
- fn from(error: std::sync::mpsc::RecvError) -> Self {
- TuikitError::ChannelReceiveError(error)
- }
-}
diff --git a/vendor/skim-tuikit/src/event.rs b/vendor/skim-tuikit/src/event.rs
deleted file mode 100644
index 72a69a1ea..000000000
--- a/vendor/skim-tuikit/src/event.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-//! events a `Term` could return
-
-pub use crate::key::Key;
-
-#[derive(Eq, PartialEq, Hash, Debug, Copy, Clone)]
-pub enum Event<UserEvent: Send + 'static = ()> {
- Key(Key),
- Resize {
- width: usize,
- height: usize,
- },
- Restarted,
- /// user defined signal 1
- User(UserEvent),
-
- #[doc(hidden)]
- __Nonexhaustive,
-}
diff --git a/vendor/skim-tuikit/src/input.rs b/vendor/skim-tuikit/src/input.rs
deleted file mode 100644
index 66532a6f3..000000000
--- a/vendor/skim-tuikit/src/input.rs
+++ /dev/null
@@ -1,600 +0,0 @@
-//! module to handle keystrokes
-//!
-//! ```no_run
-//! use skim_tuikit::input::KeyBoard;
-//! use skim_tuikit::key::Key;
-//! use std::time::Duration;
-//! let mut keyboard = KeyBoard::new_with_tty();
-//! let key = keyboard.next_key();
-//! ```
-
-use std::fs::File;
-use std::io::prelude::*;
-use std::os::fd::AsFd as _;
-use std::os::unix::io::AsRawFd;
-use std::sync::Arc;
-use std::time::{Duration, Instant};
-
-use nix::fcntl::{FcntlArg, OFlag, fcntl};
-
-use crate::Result;
-use crate::error::TuikitError;
-use crate::key::Key::*;
-use crate::key::{Key, MouseButton};
-use crate::raw::get_tty;
-use crate::spinlock::SpinLock;
-use crate::sys::file::wait_until_ready;
-
-pub trait ReadAndAsRawFd: Read + AsRawFd + Send {}
-
-const KEY_WAIT: Duration = Duration::from_millis(10);
-const DOUBLE_CLICK_DURATION: u128 = 300;
-
-impl<T> ReadAndAsRawFd for T where T: Read + AsRawFd + Send {}
-
-pub struct KeyBoard {
- file: File,
- sig_tx: Arc<SpinLock<File>>,
- sig_rx: File,
- // bytes will be poped from front, normally the buffer size will be small(< 10 bytes)
- byte_buf: Vec<u8>,
-
- raw_mouse: bool,
- next_key: Option<Result<Key>>,
- last_click: Key,
- last_click_time: SpinLock<Instant>,
-}
-
-// https://www.xfree86.org/4.8.0/ctlseqs.html
-// http://man7.org/linux/man-pages/man4/console_codes.4.html
-impl KeyBoard {
- pub fn new(file: File) -> Self {
- // the self-pipe trick for interrupt `select`
- let (rx, tx) = nix::unistd::pipe().expect("failed to set pipe");
-
- // set the signal pipe to non-blocking mode
- let flag = fcntl(rx.as_raw_fd(), FcntlArg::F_GETFL).expect("Get fcntl failed");
- let mut flag = OFlag::from_bits_truncate(flag);
- flag.insert(OFlag::O_NONBLOCK);
- let _ = fcntl(rx.as_raw_fd(), FcntlArg::F_SETFL(flag));
-
- // set file to non-blocking mode
- let flag = fcntl(file.as_raw_fd(), FcntlArg::F_GETFL).expect("Get fcntl failed");
- let mut flag = OFlag::from_bits_truncate(flag);
- flag.insert(OFlag::O_NONBLOCK);
- let _ = fcntl(file.as_raw_fd(), FcntlArg::F_SETFL(flag));
-
- KeyBoard {
- file,
- sig_tx: Arc::new(SpinLock::new(File::from(tx))),
- sig_rx: File::from(rx),
- byte_buf: Vec::new(),
- raw_mouse: false,
- next_key: None,
- last_click: Key::Null,
- last_click_time: SpinLock::new(Instant::now()),
- }
- }
-
- pub fn new_with_tty() -> Self {
- Self::new(get_tty().expect("KeyBoard::new_with_tty: failed to get tty"))
- }
-
- pub fn raw_mouse(mut self, raw_mouse: bool) -> Self {
- self.raw_mouse = raw_mouse;
- self
- }
-
- pub fn get_interrupt_handler(&self) -> KeyboardHandler {
- KeyboardHandler {
- handler: self.sig_tx.clone(),
- }
- }
-
- fn fetch_bytes(&mut self, timeout: Duration) -> Result<()> {
- let mut reader_buf = [0; 1];
-
- // clear interrupt signal
- while self.sig_rx.read(&mut reader_buf).is_ok() {}
-
- wait_until_ready(self.file.as_fd(), Some(self.sig_rx.as_fd()), timeout)?; // wait timeout
-
- self.read_unread_bytes();
- Ok(())
- }
-
- fn read_unread_bytes(&mut self) {
- let mut reader_buf = [0; 1];
- while self.file.read(&mut reader_buf).is_ok() {
- self.byte_buf.push(reader_buf[0]);
- }
- }
-
- #[allow(dead_code)]
- fn next_byte(&mut self) -> Result<u8> {
- self.next_byte_timeout(Duration::new(0, 0))
- }
-
- fn next_byte_timeout(&mut self, timeout: Duration) -> Result<u8> {
- trace!("next_byte_timeout: timeout: {timeout:?}");
- if self.byte_buf.is_empty() {
- self.fetch_bytes(timeout)?;
- }
-
- trace!("next_byte_timeout: after fetch, buf = {:?}", self.byte_buf);
- Ok(self.byte_buf.remove(0))
- }
-
- #[allow(dead_code)]
- fn next_char(&mut self) -> Result<char> {
- self.next_char_timeout(Duration::new(0, 0))
- }
-
- fn next_char_timeout(&mut self, timeout: Duration) -> Result<char> {
- trace!("next_char_timeout: timeout: {timeout:?}");
- if self.byte_buf.is_empty() {
- self.fetch_bytes(timeout)?;
- }
-
- trace!("get_chars: buf: {:?}", self.byte_buf);
- let bytes = std::mem::take(&mut self.byte_buf);
- match String::from_utf8(bytes) {
- Ok(string) => {
- let ret = string.chars().next().expect("failed to get next char from input");
- self.byte_buf.extend_from_slice(&string.as_bytes()[ret.len_utf8()..]);
- Ok(ret)
- }
- Err(error) => {
- let valid_up_to = error.utf8_error().valid_up_to();
- let bytes = error.into_bytes();
- let string = String::from_utf8_lossy(&bytes[..valid_up_to]);
- let ret = string.chars().next().expect("failed to get next char from input");
- self.byte_buf.extend_from_slice(&bytes[ret.len_utf8()..]);
- Ok(ret)
- }
- }
- }
-
- fn merge_wheel(&mut self, current_key: Result<Key>) -> (Result<Key>, Option<Result<Key>>) {
- match current_key {
- Ok(Key::MousePress(key @ MouseButton::WheelUp, row, col))
- | Ok(Key::MousePress(key @ MouseButton::WheelDown, row, col)) => {
- let mut count = 1;
- let mut o_next_key;
- loop {
- o_next_key = self.try_next_raw_key();
- match o_next_key {
- Some(Ok(Key::MousePress(k, r, c))) if key == k && row == r && col == c => count += 1,
- _ => break,
- }
- }
-
- match key {
- MouseButton::WheelUp => (Ok(Key::WheelUp(row, col, count)), o_next_key),
- MouseButton::WheelDown => (Ok(Key::WheelDown(row, col, count)), o_next_key),
- _ => unreachable!(),
- }
- }
- _ => (current_key, None),
- }
- }
-
- pub fn next_key(&mut self) -> Result<Key> {
- self.next_key_timeout(Duration::new(0, 0))
- }
-
- pub fn next_key_timeout(&mut self, timeout: Duration) -> Result<Key> {
- if self.raw_mouse {
- return self.next_raw_key_timeout(timeout);
- }
-
- let next_key = if self.next_key.is_some() {
- self.next_key.take().unwrap()
- } else {
- // fetch next key
- let next_key = self.next_raw_key_timeout(timeout);
- let (next_key, next_next_key) = self.merge_wheel(next_key);
- self.next_key = next_next_key;
- next_key
- };
-
- // parse double click
- match next_key {
- Ok(key @ MousePress(..)) => {
- if let MousePress(button, row, col) = key {
- let ret = if key == self.last_click
- && self.last_click_time.lock().elapsed().as_millis() < DOUBLE_CLICK_DURATION
- {
- DoubleClick(button, row, col)
- } else {
- self.last_click = key;
- SingleClick(button, row, col)
- };
-
- *self.last_click_time.lock() = Instant::now();
- Ok(ret)
- } else {
- unreachable!();
- }
- }
- _ => next_key,
- }
- }
-
- #[allow(dead_code)]
- fn next_raw_key(&mut self) -> Result<Key> {
- self.next_raw_key_timeout(Duration::new(0, 0))
- }
-
- fn try_next_raw_key(&mut self) -> Option<Result<Key>> {
- match self.next_raw_key_timeout(KEY_WAIT) {
- Ok(key) => Some(Ok(key)),
- Err(TuikitError::Timeout(_)) => None,
- Err(error) => Some(Err(error)),
- }
- }
-
- /// Wait `timeout` until next key stroke
- fn next_raw_key_timeout(&mut self, timeout: Duration) -> Result<Key> {
- trace!("next_raw_key_timeout: {timeout:?}");
- let ch = self.next_char_timeout(timeout)?;
- match ch {
- '\u{00}' => Ok(Ctrl(' ')),
- '\u{01}' => Ok(Ctrl('a')),
- '\u{02}' => Ok(Ctrl('b')),
- '\u{03}' => Ok(Ctrl('c')),
- '\u{04}' => Ok(Ctrl('d')),
- '\u{05}' => Ok(Ctrl('e')),
- '\u{06}' => Ok(Ctrl('f')),
- '\u{07}' => Ok(Ctrl('g')),
- '\u{08}' => Ok(Ctrl('h')),
- '\u{09}' => Ok(Tab),
- '\u{0A}' => Ok(Ctrl('j')),
- '\u{0B}' => Ok(Ctrl('k')),
- '\u{0C}' => Ok(Ctrl('l')),
- '\u{0D}' => Ok(Enter),
- '\u{0E}' => Ok(Ctrl('n')),
- '\u{0F}' => Ok(Ctrl('o')),
- '\u{10}' => Ok(Ctrl('p')),
- '\u{11}' => Ok(Ctrl('q')),
- '\u{12}' => Ok(Ctrl('r')),
- '\u{13}' => Ok(Ctrl('s')),
- '\u{14}' => Ok(Ctrl('t')),
- '\u{15}' => Ok(Ctrl('u')),
- '\u{16}' => Ok(Ctrl('v')),
- '\u{17}' => Ok(Ctrl('w')),
- '\u{18}' => Ok(Ctrl('x')),
- '\u{19}' => Ok(Ctrl('y')),
- '\u{1A}' => Ok(Ctrl('z')),
- '\u{1B}' => self.escape_sequence(),
- '\u{7F}' => Ok(Backspace),
- ch => Ok(Char(ch)),
- }
- }
-
- fn escape_sequence(&mut self) -> Result<Key> {
- let seq1 = self.next_char_timeout(KEY_WAIT).unwrap_or('\u{1B}');
- match seq1 {
- '[' => self.escape_csi(),
- 'O' => self.escape_o(),
- _ => self.parse_alt(seq1),
- }
- }
-
- fn parse_alt(&mut self, ch: char) -> Result<Key> {
- match ch {
- '\u{1B}' => {
- match self.next_byte_timeout(KEY_WAIT) {
- Ok(b'[') => {}
- Ok(c) => {
- return Err(TuikitError::UnknownSequence(format!("ESC ESC {c}")));
- }
- Err(_) => return Ok(ESC),
- }
-
- match self.escape_csi() {
- Ok(Up) => Ok(AltUp),
- Ok(Down) => Ok(AltDown),
- Ok(Left) => Ok(AltLeft),
- Ok(Right) => Ok(AltRight),
- Ok(PageUp) => Ok(AltPageUp),
- Ok(PageDown) => Ok(AltPageDown),
- _ => Err(TuikitError::UnknownSequence("ESC ESC [ ...".to_string())),
- }
- }
- '\u{00}' => Ok(CtrlAlt(' ')),
- '\u{01}' => Ok(CtrlAlt('a')),
- '\u{02}' => Ok(CtrlAlt('b')),
- '\u{03}' => Ok(CtrlAlt('c')),
- '\u{04}' => Ok(CtrlAlt('d')),
- '\u{05}' => Ok(CtrlAlt('e')),
- '\u{06}' => Ok(CtrlAlt('f')),
- '\u{07}' => Ok(CtrlAlt('g')),
- '\u{08}' => Ok(CtrlAlt('h')),
- '\u{09}' => Ok(AltTab),
- '\u{0A}' => Ok(CtrlAlt('j')),
- '\u{0B}' => Ok(CtrlAlt('k')),
- '\u{0C}' => Ok(CtrlAlt('l')),
- '\u{0D}' => Ok(AltEnter),
- '\u{0E}' => Ok(CtrlAlt('n')),
- '\u{0F}' => Ok(CtrlAlt('o')),
- '\u{10}' => Ok(CtrlAlt('p')),
- '\u{11}' => Ok(CtrlAlt('q')),
- '\u{12}' => Ok(CtrlAlt('r')),
- '\u{13}' => Ok(CtrlAlt('s')),
- '\u{14}' => Ok(CtrlAlt('t')),
- '\u{15}' => Ok(CtrlAlt('u')),
- '\u{16}' => Ok(CtrlAlt('v')),
- '\u{17}' => Ok(CtrlAlt('w')),
- '\u{18}' => Ok(CtrlAlt('x')),
- '\u{19}' => Ok(AltBackTab),
- '\u{1A}' => Ok(CtrlAlt('z')),
- '\u{7F}' => Ok(AltBackspace),
- ch => Ok(Alt(ch)),
- }
- }
-
- fn escape_csi(&mut self) -> Result<Key> {
- let cursor_pos = self.parse_cursor_report();
- if cursor_pos.is_ok() {
- return cursor_pos;
- }
-
- let seq2 = self.next_byte_timeout(KEY_WAIT)?;
- match seq2 {
- b'0' | b'9' => Err(TuikitError::UnknownSequence(format!("ESC [ {seq2:x?}"))),
- b'1'..=b'8' => self.extended_escape(seq2),
- b'[' => {
- // Linux Console ESC [ [ _
- let seq3 = self.next_byte_timeout(KEY_WAIT)?;
- match seq3 {
- b'A' => Ok(F(1)),
- b'B' => Ok(F(2)),
- b'C' => Ok(F(3)),
- b'D' => Ok(F(4)),
- b'E' => Ok(F(5)),
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ [ {seq3:x?}"))),
- }
- }
- b'A' => Ok(Up), // kcuu1
- b'B' => Ok(Down), // kcud1
- b'C' => Ok(Right), // kcuf1
- b'D' => Ok(Left), // kcub1
- b'H' => Ok(Home), // khome
- b'F' => Ok(End),
- b'Z' => Ok(BackTab),
- b'M' => {
- // X10 emulation mouse encoding: ESC [ M Bxy (6 characters only)
- let cb = self.next_byte_timeout(KEY_WAIT)?;
- // (1, 1) are the coords for upper left.
- let cx = self.next_byte_timeout(KEY_WAIT)?.saturating_sub(32) as u16 - 1; // 0 based
- let cy = self.next_byte_timeout(KEY_WAIT)?.saturating_sub(32) as u16 - 1; // 0 based
- match cb & 0b11 {
- 0 => {
- if cb & 0x40 != 0 {
- Ok(MousePress(MouseButton::WheelUp, cy, cx))
- } else {
- Ok(MousePress(MouseButton::Left, cy, cx))
- }
- }
- 1 => {
- if cb & 0x40 != 0 {
- Ok(MousePress(MouseButton::WheelDown, cy, cx))
- } else {
- Ok(MousePress(MouseButton::Middle, cy, cx))
- }
- }
- 2 => Ok(MousePress(MouseButton::Right, cy, cx)),
- 3 => Ok(MouseRelease(cy, cx)),
- _ => Err(TuikitError::UnknownSequence(format!("ESC M {cb:?}{cx:?}{cy:?}"))),
- }
- }
- b'<' => {
- // xterm mouse encoding:
- // ESC [ < Cb ; Cx ; Cy ; (M or m)
- self.read_unread_bytes();
- if !self.byte_buf.contains(&b'm') && !self.byte_buf.contains(&b'M') {
- return Err(TuikitError::UnknownSequence(
- "ESC [ < (not ending with m/M)".to_string(),
- ));
- }
-
- let mut str_buf = String::new();
- let mut c = self.next_char_timeout(KEY_WAIT)?;
- while c != 'm' && c != 'M' {
- str_buf.push(c);
- c = self.next_char_timeout(KEY_WAIT)?;
- }
- let nums = &mut str_buf.split(';');
-
- let cb = nums.next().unwrap().parse::<u16>().unwrap();
- let cx = nums.next().unwrap().parse::<u16>().unwrap() - 1; // 0 based
- let cy = nums.next().unwrap().parse::<u16>().unwrap() - 1; // 0 based
-
- match cb {
- 0..=2 | 64..=65 => {
- let button = match cb {
- 0 => MouseButton::Left,
- 1 => MouseButton::Middle,
- 2 => MouseButton::Right,
- 64 => MouseButton::WheelUp,
- 65 => MouseButton::WheelDown,
- _ => {
- return Err(TuikitError::UnknownSequence(format!("ESC [ < {str_buf} {c}")));
- }
- };
-
- match c {
- 'M' => Ok(MousePress(button, cy, cx)),
- 'm' => Ok(MouseRelease(cy, cx)),
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ < {str_buf} {c}"))),
- }
- }
- 32 => Ok(MouseHold(cy, cx)),
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ < {str_buf} {c}"))),
- }
- }
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ {seq2:?}"))),
- }
- }
-
- // Cursor position report (CPR): Answer is ESC [ y ; x R, where x,y is the cursor location.
- fn parse_cursor_report(&mut self) -> Result<Key> {
- self.read_unread_bytes();
- let pos_semi = self.byte_buf.iter().position(|&b| b == b';');
- let pos_r = self.byte_buf.iter().position(|&b| b == b'R');
-
- if let Some(pos_semi) = pos_semi
- && let Some(pos_r) = pos_r
- {
- if pos_r > pos_semi {
- let remain = self.byte_buf.split_off(pos_r + 1);
- let mut col_str = self.byte_buf.split_off(pos_semi + 1);
- let mut row_str = std::mem::replace(&mut self.byte_buf, remain);
-
- row_str.pop(); // remove the ';' character
- col_str.pop(); // remove the 'R' character
- let row = String::from_utf8(row_str)?;
- let col = String::from_utf8(col_str)?;
-
- let row_num = row.parse::<u16>()?;
- let col_num = col.parse::<u16>()?;
-
- return Ok(CursorPos(row_num - 1, col_num - 1));
- }
- }
-
- Err(TuikitError::NoCursorReportResponse)
- }
-
- fn extended_escape(&mut self, seq2: u8) -> Result<Key> {
- let seq3 = self.next_byte_timeout(KEY_WAIT)?;
- if seq3 == b'~' {
- match seq2 {
- b'1' | b'7' => Ok(Home), // tmux, xrvt
- b'2' => Ok(Insert),
- b'3' => Ok(Delete), // kdch1
- b'4' | b'8' => Ok(End), // tmux, xrvt
- b'5' => Ok(PageUp), // kpp
- b'6' => Ok(PageDown), // knp
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ {seq2} ~"))),
- }
- } else if seq3.is_ascii_digit() {
- let mut str_buf = String::new();
- str_buf.push(seq2 as char);
- str_buf.push(seq3 as char);
-
- let mut seq_last = self.next_byte_timeout(KEY_WAIT)?;
- while seq_last != b'M' && seq_last != b'~' {
- str_buf.push(seq_last as char);
- seq_last = self.next_byte_timeout(KEY_WAIT)?;
- }
-
- match seq_last {
- b'M' => {
- // rxvt mouse encoding:
- // ESC [ Cb ; Cx ; Cy ; M
- let mut nums = str_buf.split(';');
-
- let cb = nums.next().unwrap().parse::<u16>().unwrap();
- let cx = nums.next().unwrap().parse::<u16>().unwrap() - 1; // 0 based
- let cy = nums.next().unwrap().parse::<u16>().unwrap() - 1; // 0 based
-
- match cb {
- 32 => Ok(MousePress(MouseButton::Left, cy, cx)),
- 33 => Ok(MousePress(MouseButton::Middle, cy, cx)),
- 34 => Ok(MousePress(MouseButton::Right, cy, cx)),
- 35 => Ok(MouseRelease(cy, cx)),
- 64 => Ok(MouseHold(cy, cx)),
- 96 | 97 => Ok(MousePress(MouseButton::WheelUp, cy, cx)),
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ {str_buf} M"))),
- }
- }
- b'~' => {
- let num: u8 = str_buf.parse().unwrap();
- match num {
- v @ 11..=15 => Ok(F(v - 10)),
- v @ 17..=21 => Ok(F(v - 11)),
- v @ 23..=24 => Ok(F(v - 12)),
- 200 => Ok(BracketedPasteStart),
- 201 => Ok(BracketedPasteEnd),
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ {str_buf} ~"))),
- }
- }
- _ => unreachable!(),
- }
- } else if seq3 == b';' {
- let seq4 = self.next_byte_timeout(KEY_WAIT)?;
- if seq4.is_ascii_digit() {
- let seq5 = self.next_byte_timeout(KEY_WAIT)?;
- if seq2 == b'1' {
- match (seq4, seq5) {
- (b'5', b'A') => Ok(CtrlUp),
- (b'5', b'B') => Ok(CtrlDown),
- (b'5', b'C') => Ok(CtrlRight),
- (b'5', b'D') => Ok(CtrlLeft),
- (b'4', b'A') => Ok(AltShiftUp),
- (b'4', b'B') => Ok(AltShiftDown),
- (b'4', b'C') => Ok(AltShiftRight),
- (b'4', b'D') => Ok(AltShiftLeft),
- (b'3', b'H') => Ok(AltHome),
- (b'3', b'F') => Ok(AltEnd),
- (b'2', b'A') => Ok(ShiftUp),
- (b'2', b'B') => Ok(ShiftDown),
- (b'2', b'C') => Ok(ShiftRight),
- (b'2', b'D') => Ok(ShiftLeft),
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ 1 ; {seq4:x?} {seq5:x?}"))),
- }
- } else {
- Err(TuikitError::UnknownSequence(format!(
- "ESC [ {seq2:x?} ; {seq4:x?} {seq5:x?}"
- )))
- }
- } else {
- Err(TuikitError::UnknownSequence(format!("ESC [ {seq2:x?} ; {seq4:x?}")))
- }
- } else {
- match (seq2, seq3) {
- (b'5', b'A') => Ok(CtrlUp),
- (b'5', b'B') => Ok(CtrlDown),
- (b'5', b'C') => Ok(CtrlRight),
- (b'5', b'D') => Ok(CtrlLeft),
- _ => Err(TuikitError::UnknownSequence(format!("ESC [ {seq2:x?} {seq3:x?}"))),
- }
- }
- }
-
- // SSS3
- fn escape_o(&mut self) -> Result<Key> {
- let seq2 = self.next_byte_timeout(KEY_WAIT)?;
- match seq2 {
- b'A' => Ok(Up), // kcuu1
- b'B' => Ok(Down), // kcud1
- b'C' => Ok(Right), // kcuf1
- b'D' => Ok(Left), // kcub1
- b'F' => Ok(End), // kend
- b'H' => Ok(Home), // khome
- b'P' => Ok(F(1)), // kf1
- b'Q' => Ok(F(2)), // kf2
- b'R' => Ok(F(3)), // kf3
- b'S' => Ok(F(4)), // kf4
- b'a' => Ok(CtrlUp),
- b'b' => Ok(CtrlDown),
- b'c' => Ok(CtrlRight), // rxvt
- b'd' => Ok(CtrlLeft), // rxvt
- _ => Err(TuikitError::UnknownSequence(format!("ESC O {seq2:x?}"))),
- }
- }
-}
-
-pub struct KeyboardHandler {
- handler: Arc<SpinLock<File>>,
-}
-
-impl KeyboardHandler {
- pub fn interrupt(&self) {
- let mut handler = self.handler.lock();
- let _ = handler.write_all(b"x");
- let _ = handler.flush();
- }
-}
diff --git a/vendor/skim-tuikit/src/key.rs b/vendor/skim-tuikit/src/key.rs
deleted file mode 100644
index 87d617b01..000000000
--- a/vendor/skim-tuikit/src/key.rs
+++ /dev/null
@@ -1,307 +0,0 @@
-//! Defines all the keys `tuikit` recognizes.
-
-// http://ascii-table.com/ansi-escape-sequences.php
-/// Single key
-#[non_exhaustive]
-#[rustfmt::skip]
-#[derive(Eq, PartialEq, Hash, Debug, Copy, Clone)]
-pub enum Key {
- Null,
- ESC,
-
- Ctrl(char),
- Tab, // Ctrl-I
- Enter, // Ctrl-M
-
- BackTab, Backspace, AltBackTab,
-
- Up, Down, Left, Right, Home, End, Insert, Delete, PageUp, PageDown,
- CtrlUp, CtrlDown, CtrlLeft, CtrlRight,
- ShiftUp, ShiftDown, ShiftLeft, ShiftRight,
- AltUp, AltDown, AltLeft, AltRight, AltHome, AltEnd, AltPageUp, AltPageDown,
- AltShiftUp, AltShiftDown, AltShiftLeft, AltShiftRight,
-
- F(u8),
-
- CtrlAlt(char), // chars are lower case
- AltEnter,
- AltBackspace,
- AltTab,
- Alt(char), // chars could be lower or upper case
- Char(char), // chars could be lower or upper case
- CursorPos(u16, u16), // row, col
-
- // raw mouse events, will only generated if raw mouse mode is enabled
- MousePress(MouseButton, u16, u16), // row, col
- MouseRelease(u16, u16), // row, col
- MouseHold(u16, u16), // row, col
-
- // parsed mouse events, will be generated if raw mouse mode is disabled
- SingleClick(MouseButton, u16, u16), // row, col
- DoubleClick(MouseButton, u16, u16), // row, col, will only record left button double click
- WheelUp(u16, u16, u16), // row, col, number of scroll
- WheelDown(u16, u16, u16), // row, col, number of scroll
-
- BracketedPasteStart,
- BracketedPasteEnd,
-}
-
-/// A mouse button.
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum MouseButton {
- /// The left mouse button.
- Left,
- /// The right mouse button.
- Right,
- /// The middle mouse button.
- Middle,
- /// Mouse wheel is going up.
- ///
- /// This event is typically only used with MousePress.
- WheelUp,
- /// Mouse wheel is going down.
- ///
- /// This event is typically only used with MousePress.
- WheelDown,
-}
-
-#[rustfmt::skip]
-pub fn from_keyname(keyname: &str) -> Option<Key> {
- use self::Key::*;
- match keyname.to_lowercase().as_ref() {
- "ctrl-space" | "ctrl-`" | "ctrl-@" => Some(Ctrl(' ')),
- "ctrl-a" => Some(Ctrl('a')),
- "ctrl-b" => Some(Ctrl('b')),
- "ctrl-c" => Some(Ctrl('c')),
- "ctrl-d" => Some(Ctrl('d')),
- "ctrl-e" => Some(Ctrl('e')),
- "ctrl-f" => Some(Ctrl('f')),
- "ctrl-g" => Some(Ctrl('g')),
- "ctrl-h" => Some(Ctrl('h')),
- "tab" | "ctrl-i" => Some(Tab),
- "ctrl-j" => Some(Ctrl('j')),
- "ctrl-k" => Some(Ctrl('k')),
- "ctrl-l" => Some(Ctrl('l')),
- "enter" | "return" | "ctrl-m" => Some(Enter),
- "ctrl-n" => Some(Ctrl('n')),
- "ctrl-o" => Some(Ctrl('o')),
- "ctrl-p" => Some(Ctrl('p')),
- "ctrl-q" => Some(Ctrl('q')),
- "ctrl-r" => Some(Ctrl('r')),
- "ctrl-s" => Some(Ctrl('s')),
- "ctrl-t" => Some(Ctrl('t')),
- "ctrl-u" => Some(Ctrl('u')),
- "ctrl-v" => Some(Ctrl('v')),
- "ctrl-w" => Some(Ctrl('w')),
- "ctrl-x" => Some(Ctrl('x')),
- "ctrl-y" => Some(Ctrl('y')),
- "ctrl-z" => Some(Ctrl('z')),
- "ctrl-up" => Some(CtrlUp),
- "ctrl-down" => Some(CtrlDown),
- "ctrl-left" => Some(CtrlLeft),
- "ctrl-right" => Some(CtrlRight),
-
- "ctrl-alt-space" => Some(Ctrl(' ')),
- "ctrl-alt-a" => Some(CtrlAlt('a')),
- "ctrl-alt-b" => Some(CtrlAlt('b')),
- "ctrl-alt-c" => Some(CtrlAlt('c')),
- "ctrl-alt-d" => Some(CtrlAlt('d')),
- "ctrl-alt-e" => Some(CtrlAlt('e')),
- "ctrl-alt-f" => Some(CtrlAlt('f')),
- "ctrl-alt-g" => Some(CtrlAlt('g')),
- "ctrl-alt-h" => Some(CtrlAlt('h')),
- "ctrl-alt-j" => Some(CtrlAlt('j')),
- "ctrl-alt-k" => Some(CtrlAlt('k')),
- "ctrl-alt-l" => Some(CtrlAlt('l')),
- "ctrl-alt-n" => Some(CtrlAlt('n')),
- "ctrl-alt-o" => Some(CtrlAlt('o')),
- "ctrl-alt-p" => Some(CtrlAlt('p')),
- "ctrl-alt-q" => Some(CtrlAlt('q')),
- "ctrl-alt-r" => Some(CtrlAlt('r')),
- "ctrl-alt-s" => Some(CtrlAlt('s')),
- "ctrl-alt-t" => Some(CtrlAlt('t')),
- "ctrl-alt-u" => Some(CtrlAlt('u')),
- "ctrl-alt-v" => Some(CtrlAlt('v')),
- "ctrl-alt-w" => Some(CtrlAlt('w')),
- "ctrl-alt-x" => Some(CtrlAlt('x')),
- "ctrl-alt-y" => Some(CtrlAlt('y')),
- "ctrl-alt-z" => Some(CtrlAlt('z')),
-
- "esc" => Some(ESC),
- "btab" | "shift-tab" => Some(BackTab),
- "bspace" | "bs" => Some(Backspace),
- "ins" | "insert" => Some(Insert),
- "del" => Some(Delete),
- "pgup" | "page-up" => Some(PageUp),
- "pgdn" | "page-down" => Some(PageDown),
- "up" => Some(Up),
- "down" => Some(Down),
- "left" => Some(Left),
- "right" => Some(Right),
- "home" => Some(Home),
- "end" => Some(End),
- "shift-up" => Some(ShiftUp),
- "shift-down" => Some(ShiftDown),
- "shift-left" => Some(ShiftLeft),
- "shift-right" => Some(ShiftRight),
-
- "f1" => Some(F(1)),
- "f2" => Some(F(2)),
- "f3" => Some(F(3)),
- "f4" => Some(F(4)),
- "f5" => Some(F(5)),
- "f6" => Some(F(6)),
- "f7" => Some(F(7)),
- "f8" => Some(F(8)),
- "f9" => Some(F(9)),
- "f10" => Some(F(10)),
- "f11" => Some(F(11)),
- "f12" => Some(F(12)),
-
- "alt-a" => Some(Alt('a')),
- "alt-b" => Some(Alt('b')),
- "alt-c" => Some(Alt('c')),
- "alt-d" => Some(Alt('d')),
- "alt-e" => Some(Alt('e')),
- "alt-f" => Some(Alt('f')),
- "alt-g" => Some(Alt('g')),
- "alt-h" => Some(Alt('h')),
- "alt-i" => Some(Alt('i')),
- "alt-j" => Some(Alt('j')),
- "alt-k" => Some(Alt('k')),
- "alt-l" => Some(Alt('l')),
- "alt-m" => Some(Alt('m')),
- "alt-n" => Some(Alt('n')),
- "alt-o" => Some(Alt('o')),
- "alt-p" => Some(Alt('p')),
- "alt-q" => Some(Alt('q')),
- "alt-r" => Some(Alt('r')),
- "alt-s" => Some(Alt('s')),
- "alt-t" => Some(Alt('t')),
- "alt-u" => Some(Alt('u')),
- "alt-v" => Some(Alt('v')),
- "alt-w" => Some(Alt('w')),
- "alt-x" => Some(Alt('x')),
- "alt-y" => Some(Alt('y')),
- "alt-z" => Some(Alt('z')),
- "alt-/" => Some(Alt('/')),
-
- // Alt-digit. The input reader already decodes ESC-<digit> to Alt(ch)
- // via the generic `ch => Alt(ch)` arm in `parse_alt` (input.rs); these
- // arms make the keymap-config parser accept the same tokens, matching
- // fzf's alt-1..alt-9 bindings. (worktrunk vendor patch.)
- "alt-0" => Some(Alt('0')),
- "alt-1" => Some(Alt('1')),
- "alt-2" => Some(Alt('2')),
- "alt-3" => Some(Alt('3')),
- "alt-4" => Some(Alt('4')),
- "alt-5" => Some(Alt('5')),
- "alt-6" => Some(Alt('6')),
- "alt-7" => Some(Alt('7')),
- "alt-8" => Some(Alt('8')),
- "alt-9" => Some(Alt('9')),
-
- "shift-a" => Some(Char('A')),
- "shift-b" => Some(Char('B')),
- "shift-c" => Some(Char('C')),
- "shift-d" => Some(Char('D')),
- "shift-e" => Some(Char('E')),
- "shift-f" => Some(Char('F')),
- "shift-g" => Some(Char('G')),
- "shift-h" => Some(Char('H')),
- "shift-i" => Some(Char('I')),
- "shift-j" => Some(Char('J')),
- "shift-k" => Some(Char('K')),
- "shift-l" => Some(Char('L')),
- "shift-m" => Some(Char('M')),
- "shift-n" => Some(Char('N')),
- "shift-o" => Some(Char('O')),
- "shift-p" => Some(Char('P')),
- "shift-q" => Some(Char('Q')),
- "shift-r" => Some(Char('R')),
- "shift-s" => Some(Char('S')),
- "shift-t" => Some(Char('T')),
- "shift-u" => Some(Char('U')),
- "shift-v" => Some(Char('V')),
- "shift-w" => Some(Char('W')),
- "shift-x" => Some(Char('X')),
- "shift-y" => Some(Char('Y')),
- "shift-z" => Some(Char('Z')),
-
- "alt-shift-a" => Some(Alt('A')),
- "alt-shift-b" => Some(Alt('B')),
- "alt-shift-c" => Some(Alt('C')),
- "alt-shift-d" => Some(Alt('D')),
- "alt-shift-e" => Some(Alt('E')),
- "alt-shift-f" => Some(Alt('F')),
- "alt-shift-g" => Some(Alt('G')),
- "alt-shift-h" => Some(Alt('H')),
- "alt-shift-i" => Some(Alt('I')),
- "alt-shift-j" => Some(Alt('J')),
- "alt-shift-k" => Some(Alt('K')),
- "alt-shift-l" => Some(Alt('L')),
- "alt-shift-m" => Some(Alt('M')),
- "alt-shift-n" => Some(Alt('N')),
- "alt-shift-o" => Some(Alt('O')),
- "alt-shift-p" => Some(Alt('P')),
- "alt-shift-q" => Some(Alt('Q')),
- "alt-shift-r" => Some(Alt('R')),
- "alt-shift-s" => Some(Alt('S')),
- "alt-shift-t" => Some(Alt('T')),
- "alt-shift-u" => Some(Alt('U')),
- "alt-shift-v" => Some(Alt('V')),
- "alt-shift-w" => Some(Alt('W')),
- "alt-shift-x" => Some(Alt('X')),
- "alt-shift-y" => Some(Alt('Y')),
- "alt-shift-z" => Some(Alt('Z')),
-
- "alt-btab" | "alt-shift-tab" => Some(AltBackTab),
- "alt-bspace" | "alt-bs" => Some(AltBackspace),
- "alt-pgup" | "alt-page-up" => Some(AltPageUp),
- "alt-pgdn" | "alt-page-down" => Some(AltPageDown),
- "alt-up" => Some(AltUp),
- "alt-down" => Some(AltDown),
- "alt-left" => Some(AltLeft),
- "alt-right" => Some(AltRight),
- "alt-home" => Some(AltHome),
- "alt-end" => Some(AltEnd),
- "alt-shift-up" => Some(AltShiftUp),
- "alt-shift-down" => Some(AltShiftDown),
- "alt-shift-left" => Some(AltShiftLeft),
- "alt-shift-right" => Some(AltShiftRight),
- "alt-enter" | "alt-ctrl-m" => Some(AltEnter),
- "alt-tab" | "alt-ctrl-i" => Some(AltTab),
-
- "space" => Some(Char(' ')),
- "alt-space" => Some(Alt(' ')),
-
- ch if ch.chars().count() == 1 => {
- Some(Char(ch.chars().next().expect("input:parse_key: no key is specified")))
- },
- _ => None,
- }
-}
-
-#[cfg(test)]
-mod test {
- use super::Key::*;
- use super::*;
-
- #[test]
- fn bind_shift_key() {
- // Without the "shift-" prefix, "from_keyname" ignores the case.
- assert_eq!(from_keyname("A").unwrap(), Char('a'));
-
- // A correct way to refer to an uppercase char.
- assert_eq!(from_keyname("shift-a").unwrap(), Char('A'));
- }
-
- #[test]
- fn bind_alt_digit() {
- // Alt-digit tokens resolve to the same Alt(ch) the input reader emits
- // for ESC-<digit>, so `alt-1:...` keymaps bind (worktrunk vendor patch).
- assert_eq!(from_keyname("alt-0").unwrap(), Alt('0'));
- assert_eq!(from_keyname("alt-5").unwrap(), Alt('5'));
- assert_eq!(from_keyname("alt-9").unwrap(), Alt('9'));
- }
-}
diff --git a/vendor/skim-tuikit/src/lib.rs b/vendor/skim-tuikit/src/lib.rs
deleted file mode 100644
index f0bdfa9d4..000000000
--- a/vendor/skim-tuikit/src/lib.rs
+++ /dev/null
@@ -1,82 +0,0 @@
-//!
-//! ## Tuikit
-//! Tuikit is a TUI library for writing terminal UI applications. Highlights:
-//!
-//! - Thread safe.
-//! - Support non-fullscreen mode as well as fullscreen mode.
-//! - Support `Alt` keys, mouse events, etc.
-//! - Buffering for efficient rendering.
-//!
-//! Tuikit is modeld after [termbox](https://github.com/nsf/termbox) which views the
-//! terminal as a table of fixed-size cells and input being a stream of structured
-//! messages.
-//!
-//! ## Usage
-//!
-//! In your `Cargo.toml` add the following:
-//!
-//! ```toml
-//! [dependencies]
-//! tuikit = "*"
-//! ```
-//!
-//! Here is an example:
-//!
-//! ```no_run
-//! use skim_tuikit::attr::*;
-//! use skim_tuikit::term::{Term, TermHeight};
-//! use skim_tuikit::event::{Event, Key};
-//! use std::cmp::{min, max};
-//!
-//! let term: Term<()> = Term::with_height(TermHeight::Percent(30)).unwrap();
-//! let mut row = 1;
-//! let mut col = 0;
-//!
-//! let _ = term.print(0, 0, "press arrow key to move the text, (q) to quit");
-//! let _ = term.present();
-//!
-//! while let Ok(ev) = term.poll_event() {
-//! let _ = term.clear();
-//! let _ = term.print(0, 0, "press arrow key to move the text, (q) to quit");
-//!
-//! let (width, height) = term.term_size().unwrap();
-//! match ev {
-//! Event::Key(Key::ESC) | Event::Key(Key::Char('q')) => break,
-//! Event::Key(Key::Up) => row = max(row-1, 1),
-//! Event::Key(Key::Down) => row = min(row+1, height-1),
-//! Event::Key(Key::Left) => col = max(col, 1)-1,
-//! Event::Key(Key::Right) => col = min(col+1, width-1),
-//! _ => {}
-//! }
-//!
-//! let attr = Attr{ fg: Color::RED, ..Attr::default() };
-//! let _ = term.print_with_attr(row, col, "Hello World! 你好!今日は。", attr);
-//! let _ = term.set_cursor(row, col);
-//! let _ = term.present();
-//! }
-//! ```
-pub mod attr;
-pub mod canvas;
-pub mod cell;
-mod color;
-pub mod draw;
-pub mod error;
-pub mod event;
-pub mod input;
-pub mod key;
-mod macros;
-pub mod output;
-pub mod prelude;
-pub mod raw;
-pub mod screen;
-use skim_common::spinlock;
-mod sys;
-pub mod term;
-pub mod widget;
-
-#[macro_use]
-extern crate log;
-
-use crate::error::TuikitError;
-
-pub type Result<T> = std::result::Result<T, TuikitError>;
diff --git a/vendor/skim-tuikit/src/macros.rs b/vendor/skim-tuikit/src/macros.rs
deleted file mode 100644
index 33b7479c9..000000000
--- a/vendor/skim-tuikit/src/macros.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#[macro_export]
-macro_rules! ok_or_return {
- ($expr:expr, $default_val:expr) => {
- match $expr {
- Ok(val) => val,
- Err(_) => {
- return $default_val;
- }
- }
- };
-}
-
-#[macro_export]
-macro_rules! some_or_return {
- ($expr:expr, $default_val:expr) => {
- match $expr {
- Some(val) => val,
- None => {
- return $default_val;
- }
- }
- };
-}
diff --git a/vendor/skim-tuikit/src/output.rs b/vendor/skim-tuikit/src/output.rs
deleted file mode 100644
index 7e9e18e5a..000000000
--- a/vendor/skim-tuikit/src/output.rs
+++ /dev/null
@@ -1,410 +0,0 @@
-//! `Output` is the output stream that deals with ANSI Escape codes.
-//! normally you should not use it directly.
-//!
-//! ```
-//! use std::io;
-//! use skim_tuikit::attr::Color;
-//! use skim_tuikit::output::Output;
-//!
-//! let Ok(mut output) = Output::new(Box::new(io::stdout())) else { return; };
-//! output.set_fg(Color::YELLOW);
-//! output.write("YELLOW\n");
-//! output.flush();
-//!
-//! ```
-
-use std::io;
-use std::io::Write;
-use std::os::unix::io::AsRawFd;
-
-use crate::attr::{Attr, Color, Effect};
-use crate::sys::size::terminal_size;
-
-use term::terminfo::TermInfo;
-use term::terminfo::parm::{Param, Variables, expand};
-
-// modeled after python-prompt-toolkit
-// term info: https://ftp.netbsd.org/pub/NetBSD/NetBSD-release-7/src/share/terminfo/terminfo
-
-const DEFAULT_BUFFER_SIZE: usize = 1024;
-
-/// Output is an abstraction over the ANSI codes.
-pub struct Output {
- /// A callable which returns the `Size` of the output terminal.
- buffer: Vec<u8>,
- stdout: Box<dyn WriteAndAsRawFdAndSend>,
- /// The terminal environment variable. (xterm, xterm-256color, linux, ...)
- terminfo: TermInfo,
-}
-
-pub trait WriteAndAsRawFdAndSend: Write + AsRawFd + Send {}
-
-impl<T> WriteAndAsRawFdAndSend for T where T: Write + AsRawFd + Send {}
-
-impl Output {
- pub fn new(stdout: Box<dyn WriteAndAsRawFdAndSend>) -> io::Result<Self> {
- Result::Ok(Self {
- buffer: Vec::with_capacity(DEFAULT_BUFFER_SIZE),
- stdout,
- terminfo: TermInfo::from_env()?,
- })
- }
-
- fn write_cap(&mut self, cmd: &str) {
- self.write_cap_with_params(cmd, &[])
- }
-
- fn write_cap_with_params(&mut self, cap: &str, params: &[Param]) {
- if let Some(cmd) = self.terminfo.strings.get(cap)
- && let Ok(s) = expand(cmd, params, &mut Variables::new())
- {
- self.buffer.extend(&s);
- }
- }
-
- /// Write text (Terminal escape sequences will be removed/escaped.)
- pub fn write(&mut self, data: &str) {
- self.buffer.extend(data.replace("\x1b", "?").as_bytes());
- }
-
- /// Write raw texts to the terminal.
- pub fn write_raw(&mut self, data: &[u8]) {
- self.buffer.extend_from_slice(data);
- }
-
- /// Return the encoding for this output, e.g. 'utf-8'.
- /// (This is used mainly to know which characters are supported by the
- /// output the data, so that the UI can provide alternatives, when
- /// required.)
- pub fn encoding(&self) -> &str {
- unimplemented!()
- }
-
- /// Set terminal title.
- pub fn set_title(&mut self, title: &str) {
- if self.terminfo.names.contains(&"linux".to_string())
- || self.terminfo.names.contains(&"eterm-color".to_string())
- {
- return;
- }
-
- let title = title.replace("\x1b", "").replace("\x07", "");
- self.write_raw(format!("\x1b]2;{title}\x07").as_bytes());
- }
-
- /// Clear title again. (or restore previous title.)
- pub fn clear_title(&mut self) {
- self.set_title("");
- }
-
- /// Write to output stream and flush.
- pub fn flush(&mut self) {
- let _ = self.stdout.write_all(&self.buffer);
- self.buffer.clear();
- let _ = self.stdout.flush();
- }
-
- /// Erases the screen with the background colour and moves the cursor to home.
- pub fn erase_screen(&mut self) {
- self.write_cap("clear");
- }
-
- /// Go to the alternate screen buffer. (For full screen applications).
- pub fn enter_alternate_screen(&mut self) {
- self.write_cap("smcup");
- }
-
- /// Leave the alternate screen buffer.
- pub fn quit_alternate_screen(&mut self) {
- self.write_cap("rmcup");
- }
-
- /// Enable mouse.
- pub fn enable_mouse_support(&mut self) {
- self.write_raw("\x1b[?1000h".as_bytes());
-
- // Enable urxvt Mouse mode. (For terminals that understand this.)
- self.write_raw("\x1b[?1015h".as_bytes());
-
- // Also enable Xterm SGR mouse mode. (For terminals that understand this.)
- self.write_raw("\x1b[?1006h".as_bytes());
-
- // Note: E.g. lxterminal understands 1000h, but not the urxvt or sgr extensions.
- }
-
- /// Disable mouse.
- pub fn disable_mouse_support(&mut self) {
- self.write_raw("\x1b[?1000l".as_bytes());
- self.write_raw("\x1b[?1015l".as_bytes());
- self.write_raw("\x1b[?1006l".as_bytes());
- }
-
- /// Erases from the current cursor position to the end of the current line.
- pub fn erase_end_of_line(&mut self) {
- self.write_cap("el");
- }
-
- /// Erases the screen from the current line down to the bottom of the screen.
- pub fn erase_down(&mut self) {
- self.write_cap("ed");
- }
-
- /// Reset color and styling attributes.
- pub fn reset_attributes(&mut self) {
- self.write_cap("sgr0");
- }
-
- /// Set current foreground color
- pub fn set_fg(&mut self, color: Color) {
- match color {
- Color::Default => {
- self.write_raw("\x1b[39m".as_bytes());
- }
- Color::AnsiValue(x) => {
- self.write_cap_with_params("setaf", &[Param::Number(x as i32)]);
- }
- Color::Rgb(r, g, b) => {
- self.write_raw(format!("\x1b[38;2;{r};{g};{b}m").as_bytes());
- }
- }
- }
-
- /// Set current background color
- pub fn set_bg(&mut self, color: Color) {
- match color {
- Color::Default => {
- self.write_raw("\x1b[49m".as_bytes());
- }
- Color::AnsiValue(x) => {
- self.write_cap_with_params("setab", &[Param::Number(x as i32)]);
- }
- Color::Rgb(r, g, b) => {
- self.write_raw(format!("\x1b[48;2;{r};{g};{b}m").as_bytes());
- }
- }
- }
-
- /// Set current effect (underline, bold, etc)
- pub fn set_effect(&mut self, effect: Effect) {
- if effect.contains(Effect::BOLD) {
- self.write_cap("bold");
- }
- if effect.contains(Effect::DIM) {
- self.write_cap("dim");
- }
- if effect.contains(Effect::UNDERLINE) {
- self.write_cap("smul");
- }
- if effect.contains(Effect::BLINK) {
- self.write_cap("blink");
- }
- if effect.contains(Effect::REVERSE) {
- self.write_cap("rev");
- }
- }
-
- /// Set new color and styling attributes.
- pub fn set_attribute(&mut self, attr: Attr) {
- self.set_fg(attr.fg);
- self.set_bg(attr.bg);
- self.set_effect(attr.effect);
- }
-
- /// Disable auto line wrapping.
- pub fn disable_autowrap(&mut self) {
- self.write_cap("rmam");
- }
-
- /// Enable auto line wrapping.
- pub fn enable_autowrap(&mut self) {
- self.write_cap("smam");
- }
-
- /// Move cursor position.
- pub fn cursor_goto(&mut self, row: usize, column: usize) {
- self.write_cap_with_params("cup", &[Param::Number(row as i32), Param::Number(column as i32)]);
- }
-
- /// Move cursor `amount` place up.
- pub fn cursor_up(&mut self, amount: usize) {
- match amount {
- 0 => {}
- 1 => self.write_cap("cuu1"),
- _ => self.write_cap_with_params("cuu", &[Param::Number(amount as i32)]),
- }
- }
-
- /// Move cursor `amount` place down.
- pub fn cursor_down(&mut self, amount: usize) {
- match amount {
- 0 => {}
- 1 => self.write_cap("cud1"),
- _ => self.write_cap_with_params("cud", &[Param::Number(amount as i32)]),
- }
- }
-
- /// Move cursor `amount` place forward.
- pub fn cursor_forward(&mut self, amount: usize) {
- match amount {
- 0 => {}
- 1 => self.write_cap("cuf1"),
- _ => self.write_cap_with_params("cuf", &[Param::Number(amount as i32)]),
- }
- }
-
- /// Move cursor `amount` place backward.
- pub fn cursor_backward(&mut self, amount: usize) {
- match amount {
- 0 => {}
- 1 => self.write_cap("cub1"),
- _ => self.write_cap_with_params("cub", &[Param::Number(amount as i32)]),
- }
- }
-
- /// Hide cursor.
- pub fn hide_cursor(&mut self) {
- self.write_cap("civis");
- }
-
- /// Show cursor.
- pub fn show_cursor(&mut self) {
- self.write_cap("cnorm");
- }
-
- /// Asks for a cursor position report (CPR). (VT100 only.)
- pub fn ask_for_cpr(&mut self) {
- self.write_raw("\x1b[6n".as_bytes());
- self.flush()
- }
-
- /// Sound bell.
- pub fn bell(&mut self) {
- self.write_cap("bel");
- self.flush()
- }
-
- /// get terminal size (width, height)
- pub fn terminal_size(&self) -> io::Result<(usize, usize)> {
- terminal_size(self.stdout.as_raw_fd())
- }
-
- /// For vt100/xterm etc.
- pub fn enable_bracketed_paste(&mut self) {
- self.write_raw("\x1b[?2004h".as_bytes());
- }
-
- /// For vt100/xterm etc.
- pub fn disable_bracketed_paste(&mut self) {
- self.write_raw("\x1b[?2004l".as_bytes());
- }
-
- /// Execute the command
- pub fn execute(&mut self, cmd: Command) {
- match cmd {
- Command::PutChar(c) => self.write(c.to_string().as_str()),
- Command::Write(content) => self.write(&content),
- Command::SetTitle(title) => self.set_title(&title),
- Command::ClearTitle => self.clear_title(),
- Command::Flush => self.flush(),
- Command::EraseScreen => self.erase_screen(),
- Command::AlternateScreen(enable) => {
- if enable {
- self.enter_alternate_screen()
- } else {
- self.quit_alternate_screen()
- }
- }
- Command::MouseSupport(enable) => {
- if enable {
- self.enable_mouse_support();
- } else {
- self.disable_mouse_support();
- }
- }
- Command::EraseEndOfLine => self.erase_end_of_line(),
- Command::EraseDown => self.erase_down(),
- Command::ResetAttributes => self.reset_attributes(),
- Command::Fg(fg) => self.set_fg(fg),
- Command::Bg(bg) => self.set_bg(bg),
- Command::Effect(effect) => self.set_effect(effect),
- Command::SetAttribute(attr) => self.set_attribute(attr),
- Command::AutoWrap(enable) => {
- if enable {
- self.enable_autowrap();
- } else {
- self.disable_autowrap();
- }
- }
- Command::CursorGoto { row, col } => self.cursor_goto(row, col),
- Command::CursorUp(amount) => self.cursor_up(amount),
- Command::CursorDown(amount) => self.cursor_down(amount),
- Command::CursorLeft(amount) => self.cursor_backward(amount),
- Command::CursorRight(amount) => self.cursor_forward(amount),
- Command::CursorShow(show) => {
- if show {
- self.show_cursor()
- } else {
- self.hide_cursor()
- }
- }
- Command::BracketedPaste(enable) => {
- if enable {
- self.enable_bracketed_paste()
- } else {
- self.disable_bracketed_paste()
- }
- }
- }
- }
-}
-
-/// Instead of calling functions of `Output`, we could send commands.
-#[derive(Debug, Clone)]
-pub enum Command {
- /// Put a char to screen
- PutChar(char),
- /// Write content to screen (escape codes will be escaped)
- Write(String),
- /// Set the title of the terminal
- SetTitle(String),
- /// Clear the title of the terminal
- ClearTitle,
- /// Flush all the buffered contents
- Flush,
- /// Erase the entire screen
- EraseScreen,
- /// Enter(true)/Quit(false) the alternate screen mode
- AlternateScreen(bool),
- /// Enable(true)/Disable(false) mouse support
- MouseSupport(bool),
- /// Erase contents to the end of current line
- EraseEndOfLine,
- /// Erase contents till the bottom of the screen
- EraseDown,
- /// Reset attributes
- ResetAttributes,
- /// Set the foreground color
- Fg(Color),
- /// Set the background color
- Bg(Color),
- /// Set the effect(e.g. underline, dim, bold, ...)
- Effect(Effect),
- /// Set the fg, bg & effect.
- SetAttribute(Attr),
- /// Enable(true)/Disable(false) autowrap
- AutoWrap(bool),
- /// move the cursor to `(row, col)`
- CursorGoto { row: usize, col: usize },
- /// move cursor up `x` lines
- CursorUp(usize),
- /// move cursor down `x` lines
- CursorDown(usize),
- /// move cursor left `x` characters
- CursorLeft(usize),
- /// move cursor right `x` characters
- CursorRight(usize),
- /// Show(true)/Hide(false) cursor
- CursorShow(bool),
- /// Enable(true)/Disable(false) the bracketed paste mode
- BracketedPaste(bool),
-}
diff --git a/vendor/skim-tuikit/src/prelude.rs b/vendor/skim-tuikit/src/prelude.rs
deleted file mode 100644
index dd0518699..000000000
--- a/vendor/skim-tuikit/src/prelude.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-pub use crate::Result;
-pub use crate::attr::{Attr, Color, Effect};
-pub use crate::canvas::Canvas;
-pub use crate::cell::Cell;
-pub use crate::draw::{Draw, DrawResult};
-pub use crate::event::Event;
-pub use crate::key::*;
-pub use crate::term::{Term, TermHeight, TermOptions};
-pub use crate::widget::{
- AlignSelf, HSplit, HorizontalAlign, Rectangle, Size, Split, Stack, VSplit, VerticalAlign, Widget, Win,
-};
diff --git a/vendor/skim-tuikit/src/raw.rs b/vendor/skim-tuikit/src/raw.rs
deleted file mode 100644
index 0eb51e825..000000000
--- a/vendor/skim-tuikit/src/raw.rs
+++ /dev/null
@@ -1,131 +0,0 @@
-//! Managing raw mode.
-//!
-//! Raw mode is a particular state a TTY can have. It signifies that:
-//!
-//! 1. No line buffering (the input is given byte-by-byte).
-//! 2. The input is not written out, instead it has to be done manually by the programmer.
-//! 3. The output is not canonicalized (for example, `\n` means "go one line down", not "line
-//! break").
-//!
-//! # Example
-//!
-//! ```rust,no_run
-//! use skim_tuikit::raw::IntoRawMode;
-//! use std::io::{Write, stdout};
-//!
-//! let mut stdout = stdout().into_raw_mode().unwrap();
-//!
-//! write!(stdout, "Hey there.").unwrap();
-//! ```
-
-use std::io::{self, Write};
-use std::ops;
-use std::os::fd::{AsFd, AsRawFd, BorrowedFd};
-
-use nix::sys::termios::{SetArg, Termios, cfmakeraw, tcgetattr, tcsetattr};
-use nix::unistd::isatty;
-use std::fs;
-use std::os::unix::io::RawFd;
-
-// taken from termion
-/// Get the TTY device.
-///
-/// This allows for getting stdio representing _only_ the TTY, and not other streams.
-pub fn get_tty() -> io::Result<fs::File> {
- fs::OpenOptions::new().read(true).write(true).open("/dev/tty")
-}
-
-/// A terminal restorer, which keeps the previous state of the terminal, and restores it, when
-/// dropped.
-///
-/// Restoring will entirely bring back the old TTY state.
-pub struct RawTerminal<W: Write + AsFd + AsRawFd> {
- prev_ios: Termios,
- output: W,
-}
-
-impl<W: Write + AsFd + AsRawFd> Drop for RawTerminal<W> {
- fn drop(&mut self) {
- let _ = tcsetattr(self.output.as_fd(), SetArg::TCSANOW, &self.prev_ios);
- }
-}
-
-impl<W: Write + AsFd + AsRawFd> ops::Deref for RawTerminal<W> {
- type Target = W;
-
- fn deref(&self) -> &W {
- &self.output
- }
-}
-
-impl<W: Write + AsFd + AsRawFd> ops::DerefMut for RawTerminal<W> {
- fn deref_mut(&mut self) -> &mut W {
- &mut self.output
- }
-}
-
-impl<W: Write + AsFd + AsRawFd> Write for RawTerminal<W> {
- fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
- self.output.write(buf)
- }
-
- fn flush(&mut self) -> io::Result<()> {
- self.output.flush()
- }
-}
-
-impl<W: Write + AsFd + AsRawFd> AsFd for RawTerminal<W> {
- fn as_fd(&self) -> BorrowedFd<'_> {
- self.output.as_fd()
- }
-}
-
-impl<W: Write + AsFd + AsRawFd> AsRawFd for RawTerminal<W> {
- fn as_raw_fd(&self) -> RawFd {
- self.output.as_raw_fd()
- }
-}
-
-/// Types which can be converted into "raw mode".
-///
-/// # Why is this type defined on writers and not readers?
-///
-/// TTYs has their state controlled by the writer, not the reader. You use the writer to clear the
-/// screen, move the cursor and so on, so naturally you use the writer to change the mode as well.
-pub trait IntoRawMode: Write + AsFd + AsRawFd + Sized {
- /// Switch to raw mode.
- ///
- /// Raw mode means that stdin won't be printed (it will instead have to be written manually by
- /// the program). Furthermore, the input isn't canonicalised or buffered (that is, you can
- /// read from stdin one byte of a time). The output is neither modified in any way.
- fn into_raw_mode(self) -> io::Result<RawTerminal<Self>>;
-}
-
-impl<W: Write + AsFd + AsRawFd> IntoRawMode for W {
- // modified after https://github.com/kkawakam/rustyline/blob/master/src/tty/unix.rs#L668
- // refer: https://linux.die.net/man/3/termios
- fn into_raw_mode(self) -> io::Result<RawTerminal<W>> {
- use nix::errno::Errno::ENOTTY;
- use nix::sys::termios::OutputFlags;
-
- let istty = isatty(self.as_raw_fd()).map_err(nix_err_to_io_err)?;
- if !istty {
- Err(nix_err_to_io_err(ENOTTY))?
- }
-
- let prev_ios = tcgetattr(self.as_fd()).map_err(nix_err_to_io_err)?;
- let mut ios = prev_ios.clone();
- // set raw mode
- cfmakeraw(&mut ios);
- // enable output processing (so that '\n' will issue carriage return)
- ios.output_flags |= OutputFlags::OPOST;
-
- tcsetattr(&self, SetArg::TCSANOW, &ios).map_err(nix_err_to_io_err)?;
-
- Ok(RawTerminal { prev_ios, output: self })
- }
-}
-
-fn nix_err_to_io_err(err: nix::Error) -> io::Error {
- io::Error::from(err)
-}
diff --git a/vendor/skim-tuikit/src/screen.rs b/vendor/skim-tuikit/src/screen.rs
deleted file mode 100644
index 14ddaeb67..000000000
--- a/vendor/skim-tuikit/src/screen.rs
+++ /dev/null
@@ -1,387 +0,0 @@
-//! Buffering screen cells and try to optimize rendering contents
-use crate::Result;
-use crate::attr::Attr;
-use crate::canvas::Canvas;
-use crate::cell::Cell;
-use crate::error::TuikitError;
-use crate::output::Command;
-use std::cmp::{max, min};
-use unicode_width::UnicodeWidthChar;
-
-// much of the code comes from https://github.com/agatan/termfest/blob/master/src/screen.rs
-
-/// A Screen is a table of cells to draw on.
-/// It's a buffer holding the contents
-#[derive(Debug)]
-pub struct Screen {
- width: usize,
- height: usize,
- cursor: Cursor,
- cells: Vec<Cell>,
- painted_cells: Vec<Cell>,
- painted_cursor: Cursor,
- clear_on_start: bool,
-}
-
-impl Screen {
- /// create an empty screen with size: (width, height)
- pub fn new(width: usize, height: usize) -> Self {
- Self {
- width,
- height,
- cells: vec![Cell::default(); width * height],
- cursor: Cursor::default(),
- painted_cells: vec![Cell::default(); width * height],
- painted_cursor: Cursor::default(),
- clear_on_start: false,
- }
- }
-
- pub fn clear_on_start(&mut self, clear_on_start: bool) {
- self.clear_on_start = clear_on_start;
- }
-
- /// get the width of the screen
- #[inline]
- pub fn width(&self) -> usize {
- self.width
- }
-
- /// get the height of the screen
- #[inline]
- pub fn height(&self) -> usize {
- self.height
- }
-
- #[inline]
- fn index(&self, row: usize, col: usize) -> Result<usize> {
- if row >= self.height || col >= self.width {
- Err(TuikitError::IndexOutOfBound(row, col))
- } else {
- Ok(row * self.width + col)
- }
- }
-
- fn empty_canvas(&self, width: usize, height: usize) -> Vec<Cell> {
- vec![Cell::empty(); width * height]
- }
-
- fn copy_cells(&self, original: &[Cell], width: usize, height: usize) -> Vec<Cell> {
- let mut new_cells = self.empty_canvas(width, height);
- use std::cmp;
- let min_height = cmp::min(height, self.height);
- let min_width = cmp::min(width, self.width);
- for row in 0..min_height {
- let orig_start = row * self.width;
- let orig_end = min_width + orig_start;
- let start = row * width;
- let end = min_width + start;
- new_cells[start..end].copy_from_slice(&original[orig_start..orig_end]);
- }
- new_cells
- }
-
- /// to resize the screen to `(width, height)`
- pub fn resize(&mut self, width: usize, height: usize) {
- self.cells = self.copy_cells(&self.cells, width, height);
- self.painted_cells = self.empty_canvas(width, height);
- self.width = width;
- self.height = height;
-
- self.cursor.row = min(self.cursor.row, height);
- self.cursor.col = min(self.cursor.col, width);
- }
-
- /// sync internal buffer with the terminal
- pub fn present(&mut self) -> Vec<Command> {
- let mut commands = Vec::with_capacity(2048);
- let default_attr = Attr::default();
- let mut last_attr = default_attr;
-
- // hide cursor && reset Attributes
- commands.push(Command::CursorShow(false));
- commands.push(Command::CursorGoto { row: 0, col: 0 });
- commands.push(Command::ResetAttributes);
-
- let mut last_cursor = Cursor::default();
-
- for row in 0..self.height {
- // calculate the last col that has contents
- let mut empty_col_index = 0;
- for col in (0..self.width).rev() {
- let index = self.index(row, col).unwrap();
- let cell = &self.cells[index];
- if cell.is_empty() {
- self.painted_cells[index] = *cell;
- } else {
- empty_col_index = col + 1;
- break;
- }
- }
-
- // compare cells and print necessary escape codes
- let mut last_ch_is_wide = false;
- for col in 0..empty_col_index {
- let index = self.index(row, col).unwrap();
-
- // advance if the last character is wide
- if last_ch_is_wide {
- last_ch_is_wide = false;
- self.painted_cells[index] = self.cells[index];
- continue;
- }
-
- let cell_to_paint = self.cells[index];
- let cell_painted = self.painted_cells[index];
-
- // no need to paint if the content did not change
- if cell_to_paint == cell_painted {
- continue;
- }
-
- // move cursor if necessary
- if last_cursor.row != row || last_cursor.col != col {
- commands.push(Command::CursorGoto { row, col });
- }
-
- if cell_to_paint.attr != last_attr {
- commands.push(Command::ResetAttributes);
- commands.push(Command::SetAttribute(cell_to_paint.attr));
- last_attr = cell_to_paint.attr;
- }
-
- // correctly draw the characters
- match cell_to_paint.ch {
- '\n' | '\r' | '\t' | '\0' => {
- commands.push(Command::PutChar(' '));
- }
- _ => {
- commands.push(Command::PutChar(cell_to_paint.ch));
- }
- }
-
- let display_width = cell_to_paint.ch.width().unwrap_or(2);
-
- // wide character
- if display_width == 2 {
- last_ch_is_wide = true;
- }
-
- last_cursor.row = row;
- last_cursor.col = col + display_width;
- self.painted_cells[index] = cell_to_paint;
- }
-
- if empty_col_index != self.width {
- commands.push(Command::CursorGoto {
- row,
- col: empty_col_index,
- });
- commands.push(Command::ResetAttributes);
- if self.clear_on_start {
- commands.push(Command::EraseEndOfLine);
- }
- last_attr = Attr::default();
- }
- }
-
- // restore cursor
- commands.push(Command::CursorGoto {
- row: self.cursor.row,
- col: self.cursor.col,
- });
- if self.cursor.visible {
- commands.push(Command::CursorShow(true));
- }
-
- self.painted_cursor = self.cursor;
-
- commands
- }
-
- /// ```
- /// use skim_tuikit::cell::Cell;
- /// use skim_tuikit::canvas::Canvas;
- /// use skim_tuikit::screen::Screen;
- ///
- ///
- /// let mut screen = Screen::new(1, 1);
- /// screen.put_cell(0, 0, Cell{ ch: 'a', ..Cell::default()});
- /// let mut iter = screen.iter_cell();
- /// assert_eq!(Some((0, 0, &Cell{ ch: 'a', ..Cell::default()})), iter.next());
- /// assert_eq!(None, iter.next());
- /// ```
- pub fn iter_cell(&self) -> CellIterator<'_> {
- CellIterator {
- width: self.width,
- index: 0,
- vec: &self.cells,
- }
- }
-}
-
-impl Canvas for Screen {
- /// Get the canvas size (width, height)
- fn size(&self) -> Result<(usize, usize)> {
- Ok((self.width(), self.height()))
- }
-
- /// clear the screen buffer
- fn clear(&mut self) -> Result<()> {
- for cell in self.cells.iter_mut() {
- *cell = Cell::empty();
- }
- Ok(())
- }
-
- /// change a cell of position `(row, col)` to `cell`
- fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize> {
- let ch_width = cell.ch.width().unwrap_or(2);
- if ch_width > 1 {
- let _ = self.index(row, col + 1).map(|index| {
- self.cells[index - 1] = cell;
- self.cells[index].ch = ' ';
- });
- } else {
- let _ = self.index(row, col).map(|index| {
- self.cells[index] = cell;
- });
- }
- Ok(ch_width)
- }
-
- /// move cursor position (row, col) and show cursor
- fn set_cursor(&mut self, row: usize, col: usize) -> Result<()> {
- self.cursor.row = min(row, max(self.height, 1) - 1);
- self.cursor.col = min(col, max(self.width, 1) - 1);
- self.cursor.visible = true;
- Ok(())
- }
-
- /// show/hide cursor, set `show` to `false` to hide the cursor
- fn show_cursor(&mut self, show: bool) -> Result<()> {
- self.cursor.visible = show;
- Ok(())
- }
-}
-
-pub struct CellIterator<'a> {
- width: usize,
- index: usize,
- vec: &'a Vec<Cell>,
-}
-
-impl<'a> Iterator for CellIterator<'a> {
- type Item = (usize, usize, &'a Cell);
-
- fn next(&mut self) -> Option<Self::Item> {
- if self.index >= self.vec.len() {
- return None;
- }
-
- let (row, col) = (self.index / self.width, self.index % self.width);
- let ret = self.vec.get(self.index).map(|cell| (row, col, cell));
- self.index += 1;
- ret
- }
-}
-
-#[derive(Debug, Clone, Copy, Default)]
-struct Cursor {
- pub row: usize,
- pub col: usize,
- visible: bool,
-}
-
-#[cfg(test)]
-mod test {
- use super::*;
-
- #[test]
- fn test_cell_iterator() {
- let mut screen = Screen::new(2, 2);
- let _ = screen.put_cell(
- 0,
- 0,
- Cell {
- ch: 'a',
- attr: Attr::default(),
- },
- );
- let _ = screen.put_cell(
- 0,
- 1,
- Cell {
- ch: 'b',
- attr: Attr::default(),
- },
- );
- let _ = screen.put_cell(
- 1,
- 0,
- Cell {
- ch: 'c',
- attr: Attr::default(),
- },
- );
- let _ = screen.put_cell(
- 1,
- 1,
- Cell {
- ch: 'd',
- attr: Attr::default(),
- },
- );
-
- let mut iter = screen.iter_cell();
- assert_eq!(
- Some((
- 0,
- 0,
- &Cell {
- ch: 'a',
- attr: Attr::default()
- }
- )),
- iter.next()
- );
- assert_eq!(
- Some((
- 0,
- 1,
- &Cell {
- ch: 'b',
- attr: Attr::default()
- }
- )),
- iter.next()
- );
- assert_eq!(
- Some((
- 1,
- 0,
- &Cell {
- ch: 'c',
- attr: Attr::default()
- }
- )),
- iter.next()
- );
- assert_eq!(
- Some((
- 1,
- 1,
- &Cell {
- ch: 'd',
- attr: Attr::default()
- }
- )),
- iter.next()
- );
- assert_eq!(None, iter.next());
-
- let empty_screen = Screen::new(0, 0);
- let mut empty_iter = empty_screen.iter_cell();
- assert_eq!(None, empty_iter.next());
- }
-}
diff --git a/vendor/skim-tuikit/src/sys/file.rs b/vendor/skim-tuikit/src/sys/file.rs
deleted file mode 100644
index 0d9031375..000000000
--- a/vendor/skim-tuikit/src/sys/file.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-use crate::Result;
-use std::os::fd::BorrowedFd;
-use std::time::Duration;
-
-use crate::error::TuikitError;
-use nix::sys::select;
-use nix::sys::time::{TimeVal, TimeValLike};
-
-fn duration_to_timeval(duration: Duration) -> TimeVal {
- let sec = duration.as_secs() * 1000 + (duration.subsec_millis() as u64);
- TimeVal::milliseconds(sec as i64)
-}
-
-pub fn wait_until_ready(fd: BorrowedFd, signal_fd: Option<BorrowedFd>, timeout: Duration) -> Result<()> {
- let mut timeout_spec = if timeout == Duration::new(0, 0) {
- None
- } else {
- Some(duration_to_timeval(timeout))
- };
-
- let mut fdset = select::FdSet::new();
- fdset.insert(fd);
-
- if let Some(f) = signal_fd {
- fdset.insert(f);
- }
- let n = select::select(None, &mut fdset, None, None, &mut timeout_spec)?;
-
- if n < 1 {
- Err(TuikitError::Timeout(timeout)) // this error message will be used in input.rs
- } else if fdset.contains(fd) {
- Ok(())
- } else {
- Err(TuikitError::Interrupted)
- }
-}
diff --git a/vendor/skim-tuikit/src/sys/mod.rs b/vendor/skim-tuikit/src/sys/mod.rs
deleted file mode 100644
index acc7f30b1..000000000
--- a/vendor/skim-tuikit/src/sys/mod.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// copy from https://docs.rs/crate/termion/1.5.1/source/src/sys/unix/mod.rs
-use std::io;
-pub mod file;
-pub mod signal;
-pub mod size;
-
-trait IsMinusOne {
- fn is_minus_one(&self) -> bool;
-}
-
-macro_rules! impl_is_minus_one {
- ($($t:ident)*) => ($(impl IsMinusOne for $t {
- fn is_minus_one(&self) -> bool {
- *self == -1
- }
- })*)
- }
-
-impl_is_minus_one! { i8 i16 i32 i64 isize }
-
-fn cvt<T: IsMinusOne>(t: T) -> io::Result<T> {
- if t.is_minus_one() {
- Err(io::Error::last_os_error())
- } else {
- Ok(t)
- }
-}
diff --git a/vendor/skim-tuikit/src/sys/signal.rs b/vendor/skim-tuikit/src/sys/signal.rs
deleted file mode 100644
index d78307c48..000000000
--- a/vendor/skim-tuikit/src/sys/signal.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-use lazy_static::lazy_static;
-use nix::sys::signal::{SaFlags, SigAction, SigHandler, SigSet, SigmaskHow, Signal};
-use nix::sys::signal::{pthread_sigmask, sigaction};
-use std::collections::HashMap;
-use std::sync::Mutex;
-use std::sync::Once;
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::sync::mpsc::{Receiver, Sender, channel};
-use std::thread;
-
-lazy_static! {
- static ref NOTIFIER_COUNTER: AtomicUsize = AtomicUsize::new(1);
- static ref NOTIFIER: Mutex<HashMap<usize, Sender<()>>> = Mutex::new(HashMap::new());
-}
-
-static ONCE: Once = Once::new();
-
-pub fn initialize_signals() {
- ONCE.call_once(listen_sigwinch);
-}
-
-pub fn notify_on_sigwinch() -> (usize, Receiver<()>) {
- let (tx, rx) = channel();
- let new_id = NOTIFIER_COUNTER.fetch_add(1, Ordering::Relaxed);
- let mut notifiers = NOTIFIER.lock().unwrap();
- notifiers.entry(new_id).or_insert(tx);
- (new_id, rx)
-}
-
-pub fn unregister_sigwinch(id: usize) -> Option<Sender<()>> {
- let mut notifiers = NOTIFIER.lock().unwrap();
- notifiers.remove(&id)
-}
-
-extern "C" fn handle_sigwiwnch(_: i32) {}
-
-fn listen_sigwinch() {
- let (tx_sig, rx_sig) = channel();
-
- // register terminal resize event, `pthread_sigmask` should be run before any thread.
- let mut sigset = SigSet::empty();
- sigset.add(Signal::SIGWINCH);
- let _ = pthread_sigmask(SigmaskHow::SIG_BLOCK, Some(&sigset), None);
-
- // SIGWINCH is ignored by mac by default, thus we need to register an empty handler
- let action = SigAction::new(SigHandler::Handler(handle_sigwiwnch), SaFlags::empty(), SigSet::empty());
-
- unsafe {
- let _ = sigaction(Signal::SIGWINCH, &action);
- }
-
- thread::spawn(move || {
- // listen to the resize event;
- loop {
- let _errno = sigset.wait();
- let _ = tx_sig.send(());
- }
- });
-
- thread::spawn(move || {
- while rx_sig.recv().is_ok() {
- let notifiers = NOTIFIER.lock().unwrap();
- for (_, sender) in notifiers.iter() {
- let _ = sender.send(());
- }
- }
- });
-}
diff --git a/vendor/skim-tuikit/src/sys/size.rs b/vendor/skim-tuikit/src/sys/size.rs
deleted file mode 100644
index c661e8f41..000000000
--- a/vendor/skim-tuikit/src/sys/size.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-use std::{io, mem};
-
-use super::cvt;
-use nix::libc::{TIOCGWINSZ, c_int, c_ushort, ioctl};
-
-#[repr(C)]
-struct TermSize {
- row: c_ushort,
- col: c_ushort,
- _x: c_ushort,
- _y: c_ushort,
-}
-
-/// Get the size of the terminal.
-pub fn terminal_size(fd: c_int) -> io::Result<(usize, usize)> {
- unsafe {
- let mut size: TermSize = mem::zeroed();
- cvt(ioctl(fd, TIOCGWINSZ, &mut size as *mut _))?;
- Ok((size.col as usize, size.row as usize))
- }
-}
diff --git a/vendor/skim-tuikit/src/term.rs b/vendor/skim-tuikit/src/term.rs
deleted file mode 100644
index e34a428d1..000000000
--- a/vendor/skim-tuikit/src/term.rs
+++ /dev/null
@@ -1,852 +0,0 @@
-//! Term is a thread-safe "terminal".
-//!
-//! It allows you to:
-//! - Listen to key stroke events
-//! - Output contents to the terminal
-//!
-//! ```no_run
-//! use skim_tuikit::prelude::*;
-//!
-//! let term = Term::<()>::new().unwrap();
-//!
-//! while let Ok(ev) = term.poll_event() {
-//! if let Event::Key(Key::Char('q')) = ev {
-//! break;
-//! }
-//!
-//! term.print(0, 0, format!("got event: {:?}", ev).as_str());
-//! term.present();
-//! }
-//! ```
-//!
-//! Term is modeled after [termbox](https://github.com/nsf/termbox). The main idea is viewing
-//! terminals as a table of fixed-size cells and input being a stream of structured messages
-
-use std::cmp::{max, min};
-use std::sync::Arc;
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::sync::mpsc::{Receiver, Sender, channel};
-use std::thread;
-use std::time::Duration;
-
-use crate::Result;
-use crate::attr::Attr;
-use crate::canvas::Canvas;
-use crate::cell::Cell;
-use crate::draw::Draw;
-use crate::error::TuikitError;
-use crate::event::Event;
-use crate::input::{KeyBoard, KeyboardHandler};
-use crate::key::Key;
-use crate::output::Command;
-use crate::output::Output;
-use crate::raw::{IntoRawMode, get_tty};
-use crate::screen::Screen;
-use crate::spinlock::SpinLock;
-use crate::sys::signal::{initialize_signals, notify_on_sigwinch, unregister_sigwinch};
-
-const MIN_HEIGHT: usize = 1;
-const WAIT_TIMEOUT: Duration = Duration::from_millis(300);
-const POLLING_TIMEOUT: Duration = Duration::from_millis(10);
-
-#[derive(Debug, Copy, Clone)]
-pub enum TermHeight {
- Fixed(usize),
- Percent(usize),
-}
-
-pub struct Term<UserEvent: Send + 'static = ()> {
- components_to_stop: Arc<AtomicUsize>,
- keyboard_handler: SpinLock<Option<KeyboardHandler>>,
- resize_signal_id: Arc<AtomicUsize>,
- term_lock: SpinLock<TermLock>,
- event_rx: SpinLock<Receiver<Event<UserEvent>>>,
- event_tx: Arc<SpinLock<Sender<Event<UserEvent>>>>,
- raw_mouse: bool, // to produce raw mouse event or the parsed event(e.g. DoubleClick)
-}
-
-pub struct TermOptions {
- max_height: TermHeight,
- min_height: TermHeight,
- height: TermHeight,
- clear_on_exit: bool,
- clear_on_start: bool,
- mouse_enabled: bool,
- raw_mouse: bool,
- hold: bool, // to start term or not on creation
- disable_alternate_screen: bool,
-}
-
-impl Default for TermOptions {
- fn default() -> Self {
- Self {
- max_height: TermHeight::Percent(100),
- min_height: TermHeight::Fixed(3),
- height: TermHeight::Percent(100),
- clear_on_exit: true,
- clear_on_start: true,
- mouse_enabled: false,
- raw_mouse: false,
- hold: false,
- disable_alternate_screen: false,
- }
- }
-}
-
-// Builder
-impl TermOptions {
- pub fn max_height(mut self, max_height: TermHeight) -> Self {
- self.max_height = max_height;
- self
- }
-
- pub fn min_height(mut self, min_height: TermHeight) -> Self {
- self.min_height = min_height;
- self
- }
- pub fn height(mut self, height: TermHeight) -> Self {
- self.height = height;
- self
- }
- pub fn clear_on_exit(mut self, clear: bool) -> Self {
- self.clear_on_exit = clear;
- self
- }
- pub fn clear_on_start(mut self, clear: bool) -> Self {
- self.clear_on_start = clear;
- self
- }
- pub fn mouse_enabled(mut self, enabled: bool) -> Self {
- self.mouse_enabled = enabled;
- self
- }
- pub fn raw_mouse(mut self, enabled: bool) -> Self {
- self.raw_mouse = enabled;
- self
- }
- pub fn hold(mut self, hold: bool) -> Self {
- self.hold = hold;
- self
- }
- pub fn disable_alternate_screen(mut self, disable_alternate_screen: bool) -> Self {
- self.disable_alternate_screen = disable_alternate_screen;
- self
- }
-}
-
-impl<UserEvent: Send + 'static> Term<UserEvent> {
- /// Create a Term with height specified.
- ///
- /// Internally if the calculated height would fill the whole screen, `Alternate Screen` will
- /// be enabled, otherwise only part of the screen will be used.
- ///
- /// If the preferred height is larger than the current screen, whole screen is used.
- ///
- /// ```no_run
- /// use skim_tuikit::term::{Term, TermHeight};
- ///
- /// let term: Term<()> = Term::with_height(TermHeight::Percent(30)).unwrap(); // 30% of the terminal height
- /// let term: Term<()> = Term::with_height(TermHeight::Fixed(20)).unwrap(); // fixed 20 lines
- /// ```
- pub fn with_height(height: TermHeight) -> Result<Term<UserEvent>> {
- Term::with_options(TermOptions::default().height(height))
- }
-
- /// Create a Term (with 100% height)
- ///
- /// ```no_run
- /// use skim_tuikit::term::{Term, TermHeight};
- ///
- /// let term: Term<()> = Term::new().unwrap();
- /// let term: Term<()> = Term::with_height(TermHeight::Percent(100)).unwrap();
- /// ```
- pub fn new() -> Result<Term<UserEvent>> {
- Term::with_options(TermOptions::default())
- }
-
- /// Create a Term with custom options
- ///
- /// ```no_run
- /// use skim_tuikit::term::{Term, TermHeight, TermOptions};
- ///
- /// let term: Term<()> = Term::with_options(TermOptions::default().height(TermHeight::Percent(100))).unwrap();
- /// ```
- pub fn with_options(options: TermOptions) -> Result<Term<UserEvent>> {
- initialize_signals();
-
- let (event_tx, event_rx) = channel();
- let raw_mouse = options.raw_mouse;
- let ret = Term {
- components_to_stop: Arc::new(AtomicUsize::new(0)),
- keyboard_handler: SpinLock::new(None),
- resize_signal_id: Arc::new(AtomicUsize::new(0)),
- term_lock: SpinLock::new(TermLock::with_options(&options)),
- event_tx: Arc::new(SpinLock::new(event_tx)),
- event_rx: SpinLock::new(event_rx),
- raw_mouse,
- };
- if options.hold {
- Ok(ret)
- } else {
- ret.restart().map(|_| ret)
- }
- }
-
- fn ensure_not_stopped(&self) -> Result<()> {
- if self.components_to_stop.load(Ordering::SeqCst) == 2 {
- Ok(())
- } else {
- Err(TuikitError::TerminalNotStarted)
- }
- }
-
- fn get_cursor_pos(&self, keyboard: &mut KeyBoard, output: &mut Output) -> Result<(usize, usize)> {
- output.ask_for_cpr();
-
- if let Ok(Key::CursorPos(row, col)) = keyboard.next_key_timeout(WAIT_TIMEOUT) {
- return Ok((row as usize, col as usize));
- }
-
- Ok((0, 0))
- }
-
- /// restart the terminal if it had been stopped
- pub fn restart(&self) -> Result<()> {
- let mut termlock = self.term_lock.lock();
- if self.components_to_stop.load(Ordering::SeqCst) == 2 {
- return Ok(());
- }
-
- let ttyout = get_tty()?.into_raw_mode()?;
- let mut output = Output::new(Box::new(ttyout))?;
- let mut keyboard = KeyBoard::new_with_tty().raw_mouse(self.raw_mouse);
- self.keyboard_handler.lock().replace(keyboard.get_interrupt_handler());
- let cursor_pos = self.get_cursor_pos(&mut keyboard, &mut output)?;
- termlock.restart(output, cursor_pos)?;
-
- // start two listener
- self.start_key_listener(keyboard);
- self.start_size_change_listener();
-
- // wait for components to start
- while self.components_to_stop.load(Ordering::SeqCst) < 2 {
- debug!(
- "restart: components: {}",
- self.components_to_stop.load(Ordering::SeqCst)
- );
- thread::sleep(POLLING_TIMEOUT);
- }
-
- let event_tx = self.event_tx.lock();
- let _ = event_tx.send(Event::Restarted);
-
- Ok(())
- }
-
- /// Pause the Term
- ///
- /// This function will cause the Term to give away the control to the terminal(such as listening
- /// to the key strokes). After the Term was "paused", `poll_event` will block indefinitely and
- /// recover after the Term was `restart`ed.
- pub fn pause(&self) -> Result<()> {
- self.pause_internal(false)
- }
-
- fn pause_internal(&self, exiting: bool) -> Result<()> {
- debug!("pause");
- let mut termlock = self.term_lock.lock();
-
- if self.components_to_stop.load(Ordering::SeqCst) == 0 {
- return Ok(());
- }
-
- // wait for the components to stop
- // i.e. key_listener & size_change_listener
- if let Some(h) = self.keyboard_handler.lock().take() {
- h.interrupt()
- }
- unregister_sigwinch(self.resize_signal_id.load(Ordering::Relaxed)).map(|tx| tx.send(()));
-
- termlock.pause(exiting)?;
-
- // wait for the components to stop
- while self.components_to_stop.load(Ordering::SeqCst) > 0 {
- debug!("pause: components: {}", self.components_to_stop.load(Ordering::SeqCst));
- thread::sleep(POLLING_TIMEOUT);
- }
-
- Ok(())
- }
-
- fn start_key_listener(&self, mut keyboard: KeyBoard) {
- let event_tx_clone = self.event_tx.clone();
- let components_to_stop = self.components_to_stop.clone();
- thread::spawn(move || {
- components_to_stop.fetch_add(1, Ordering::SeqCst);
- debug!("key listener start");
- loop {
- let next_key = keyboard.next_key();
- trace!("next key: {next_key:?}");
- match next_key {
- Ok(key) => {
- let event_tx = event_tx_clone.lock();
- let _ = event_tx.send(Event::Key(key));
- }
- Err(TuikitError::Interrupted) => break,
- _ => {} // ignored
- }
- }
- components_to_stop.fetch_sub(1, Ordering::SeqCst);
- debug!("key listener stop");
- });
- }
-
- fn start_size_change_listener(&self) {
- let event_tx_clone = self.event_tx.clone();
- let resize_signal_id = self.resize_signal_id.clone();
- let components_to_stop = self.components_to_stop.clone();
-
- thread::spawn(move || {
- let (id, sigwinch_rx) = notify_on_sigwinch();
- resize_signal_id.store(id, Ordering::Relaxed);
-
- components_to_stop.fetch_add(1, Ordering::SeqCst);
- debug!("size change listener started");
- loop {
- if sigwinch_rx.recv().is_ok() {
- let event_tx = event_tx_clone.lock();
- let _ = event_tx.send(Event::Resize { width: 0, height: 0 });
- } else {
- break;
- }
- }
- components_to_stop.fetch_sub(1, Ordering::SeqCst);
- debug!("size change listener stop");
- });
- }
-
- fn filter_event(&self, event: Event<UserEvent>) -> Event<UserEvent> {
- match event {
- Event::Resize { .. } => {
- {
- let mut termlock = self.term_lock.lock();
- let _ = termlock.on_resize();
- }
- let (width, height) = self.term_size().unwrap_or((0, 0));
- Event::Resize { width, height }
- }
- Event::Key(Key::MousePress(button, row, col)) => {
- // adjust mouse event position
- let cursor_row = self.term_lock.lock().get_term_start_row() as u16;
- if row < cursor_row {
- Event::__Nonexhaustive
- } else {
- Event::Key(Key::MousePress(button, row - cursor_row, col))
- }
- }
- Event::Key(Key::MouseRelease(row, col)) => {
- // adjust mouse event position
- let cursor_row = self.term_lock.lock().get_term_start_row() as u16;
- if row < cursor_row {
- Event::__Nonexhaustive
- } else {
- Event::Key(Key::MouseRelease(row - cursor_row, col))
- }
- }
- Event::Key(Key::MouseHold(row, col)) => {
- // adjust mouse event position
- let cursor_row = self.term_lock.lock().get_term_start_row() as u16;
- if row < cursor_row {
- Event::__Nonexhaustive
- } else {
- Event::Key(Key::MouseHold(row - cursor_row, col))
- }
- }
- Event::Key(Key::SingleClick(button, row, col)) => {
- let cursor_row = self.term_lock.lock().get_term_start_row() as u16;
- if row < cursor_row {
- Event::__Nonexhaustive
- } else {
- Event::Key(Key::SingleClick(button, row - cursor_row, col))
- }
- }
- Event::Key(Key::DoubleClick(button, row, col)) => {
- let cursor_row = self.term_lock.lock().get_term_start_row() as u16;
- if row < cursor_row {
- Event::__Nonexhaustive
- } else {
- Event::Key(Key::DoubleClick(button, row - cursor_row, col))
- }
- }
- Event::Key(Key::WheelUp(row, col, num)) => {
- let cursor_row = self.term_lock.lock().get_term_start_row() as u16;
- if row < cursor_row {
- Event::__Nonexhaustive
- } else {
- Event::Key(Key::WheelUp(row - cursor_row, col, num))
- }
- }
- Event::Key(Key::WheelDown(row, col, num)) => {
- let cursor_row = self.term_lock.lock().get_term_start_row() as u16;
- if row < cursor_row {
- Event::__Nonexhaustive
- } else {
- Event::Key(Key::WheelDown(row - cursor_row, col, num))
- }
- }
- ev => ev,
- }
- }
-
- /// Wait an event up to `timeout` and return it
- pub fn peek_event(&self, timeout: Duration) -> Result<Event<UserEvent>> {
- let event_rx = self.event_rx.lock();
- event_rx
- .recv_timeout(timeout)
- .map(|ev| self.filter_event(ev))
- .map_err(|_| TuikitError::Timeout(timeout))
- }
-
- /// Wait for an event indefinitely and return it
- pub fn poll_event(&self) -> Result<Event<UserEvent>> {
- let event_rx = self.event_rx.lock();
- event_rx
- .recv()
- .map(|ev| self.filter_event(ev))
- .map_err(TuikitError::ChannelReceiveError)
- }
-
- /// An interface to inject event to the terminal's event queue
- pub fn send_event(&self, event: Event<UserEvent>) -> Result<()> {
- let event_tx = self.event_tx.lock();
- event_tx
- .send(event)
- .map_err(|err| TuikitError::SendEventError(err.to_string()))
- }
-
- /// Sync internal buffer with terminal
- pub fn present(&self) -> Result<()> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.present()
- }
-
- /// Return the printable size(width, height) of the term
- pub fn term_size(&self) -> Result<(usize, usize)> {
- self.ensure_not_stopped()?;
- let termlock = self.term_lock.lock();
- termlock.term_size()
- }
-
- /// Clear internal buffer
- pub fn clear(&self) -> Result<()> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.clear()
- }
-
- /// Change a cell of position `(row, col)` to `cell`
- pub fn put_cell(&self, row: usize, col: usize, cell: Cell) -> Result<usize> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.put_cell(row, col, cell)
- }
-
- /// Print `content` starting with position `(row, col)`
- pub fn print(&self, row: usize, col: usize, content: &str) -> Result<usize> {
- self.print_with_attr(row, col, content, Attr::default())
- }
-
- /// print `content` starting with position `(row, col)` with `attr`
- pub fn print_with_attr(&self, row: usize, col: usize, content: &str, attr: impl Into<Attr>) -> Result<usize> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.print_with_attr(row, col, content, attr)
- }
-
- /// Set cursor position to (row, col), and show the cursor
- pub fn set_cursor(&self, row: usize, col: usize) -> Result<()> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.set_cursor(row, col)
- }
-
- /// show/hide cursor, set `show` to `false` to hide the cursor
- pub fn show_cursor(&self, show: bool) -> Result<()> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.show_cursor(show)
- }
-
- /// Enable mouse support
- pub fn enable_mouse_support(&self) -> Result<()> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.enable_mouse_support()
- }
-
- /// Disable mouse support
- pub fn disable_mouse_support(&self) -> Result<()> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.disable_mouse_support()
- }
-
- /// Whether to clear the terminal upon exiting. Defaults to true.
- pub fn clear_on_exit(&self, clear: bool) -> Result<()> {
- self.ensure_not_stopped()?;
- let mut termlock = self.term_lock.lock();
- termlock.clear_on_exit(clear);
- Ok(())
- }
-
- pub fn draw(&self, draw: &dyn Draw) -> Result<()> {
- let mut canvas = TermCanvas { term: self };
- draw.draw(&mut canvas).map_err(TuikitError::DrawError)
- }
-
- pub fn draw_mut(&self, draw: &mut dyn Draw) -> Result<()> {
- let mut canvas = TermCanvas { term: self };
- draw.draw_mut(&mut canvas).map_err(TuikitError::DrawError)
- }
-}
-
-impl<UserEvent: Send + 'static> Drop for Term<UserEvent> {
- fn drop(&mut self) {
- let _ = self.pause_internal(true);
- }
-}
-
-pub struct TermCanvas<'a, UserEvent: Send + 'static> {
- term: &'a Term<UserEvent>,
-}
-
-impl<UserEvent: Send + 'static> Canvas for TermCanvas<'_, UserEvent> {
- fn size(&self) -> Result<(usize, usize)> {
- self.term.term_size()
- }
-
- fn clear(&mut self) -> Result<()> {
- self.term.clear()
- }
-
- fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize> {
- self.term.put_cell(row, col, cell)
- }
-
- fn print_with_attr(&mut self, row: usize, col: usize, content: &str, attr: Attr) -> Result<usize> {
- self.term.print_with_attr(row, col, content, attr)
- }
-
- fn set_cursor(&mut self, row: usize, col: usize) -> Result<()> {
- self.term.set_cursor(row, col)
- }
-
- fn show_cursor(&mut self, show: bool) -> Result<()> {
- self.term.show_cursor(show)
- }
-}
-
-struct TermLock {
- prefer_height: TermHeight,
- max_height: TermHeight,
- min_height: TermHeight,
- // keep bottom intact when resize?
- bottom_intact: bool,
- clear_on_exit: bool,
- clear_on_start: bool,
- mouse_enabled: bool,
- alternate_screen: bool,
- disable_alternate_screen: bool,
- cursor_row: usize,
- screen_height: usize,
- screen_width: usize,
- screen: Screen,
- output: Option<Output>,
-}
-
-impl Default for TermLock {
- fn default() -> Self {
- Self {
- prefer_height: TermHeight::Percent(100),
- max_height: TermHeight::Percent(100),
- min_height: TermHeight::Fixed(3),
- bottom_intact: false,
- alternate_screen: false,
- disable_alternate_screen: false,
- cursor_row: 0,
- screen_height: 0,
- screen_width: 0,
- screen: Screen::new(0, 0),
- output: None,
- clear_on_exit: true,
- clear_on_start: true,
- mouse_enabled: false,
- }
- }
-}
-
-impl TermLock {
- pub fn with_options(options: &TermOptions) -> Self {
- let mut term = TermLock::default();
- term.prefer_height = options.height;
- term.max_height = options.max_height;
- term.min_height = options.min_height;
- term.clear_on_exit = options.clear_on_exit;
- term.clear_on_start = options.clear_on_start;
- term.screen.clear_on_start(options.clear_on_start);
- term.disable_alternate_screen = options.disable_alternate_screen;
- term.mouse_enabled = options.mouse_enabled;
- term
- }
-
- /// Present the content to the terminal
- pub fn present(&mut self) -> Result<()> {
- let output = self.output.as_mut().ok_or(TuikitError::TerminalNotStarted)?;
- let mut commands = self.screen.present();
-
- let cursor_row = self.cursor_row;
- // add cursor_row to all CursorGoto commands
- for cmd in commands.iter_mut() {
- if let Command::CursorGoto { row, col } = *cmd {
- *cmd = Command::CursorGoto {
- row: row + cursor_row,
- col,
- }
- }
- }
-
- for cmd in commands.into_iter() {
- output.execute(cmd);
- }
- output.flush();
- Ok(())
- }
-
- /// Resize the internal buffer to according to new terminal size
- pub fn on_resize(&mut self) -> Result<()> {
- let output = self.output.as_mut().ok_or(TuikitError::TerminalNotStarted)?;
- let (screen_width, screen_height) = output.terminal_size().expect("term:restart get terminal size failed");
- self.screen_height = screen_height;
- self.screen_width = screen_width;
-
- let width = screen_width;
- let height =
- Self::calc_preferred_height(&self.min_height, &self.max_height, &self.prefer_height, screen_height);
-
- // update the cursor position
- if self.cursor_row + height >= screen_height {
- self.bottom_intact = true;
- }
-
- if self.bottom_intact {
- // Saturating subtraction: when the terminal is smaller than the
- // picker's preferred height, `height > screen_height` and the
- // original `screen_height - height` underflows on `usize` and
- // panics. Clamp to 0 (top of screen) — matches the
- // `cursor_row = 0` fallback `ensure_height` already uses for the
- // full-screen case.
- self.cursor_row = screen_height.saturating_sub(height);
- }
-
- // clear the screen
- output.cursor_goto(self.cursor_row, 0);
- if self.clear_on_start {
- output.erase_down();
- }
-
- // clear the screen buffer
- self.screen.resize(width, height);
- Ok(())
- }
-
- fn calc_height(height_spec: &TermHeight, actual_height: usize) -> usize {
- match *height_spec {
- TermHeight::Fixed(h) => h,
- TermHeight::Percent(p) => actual_height * min(p, 100) / 100,
- }
- }
-
- fn calc_preferred_height(
- min_height: &TermHeight,
- max_height: &TermHeight,
- prefer_height: &TermHeight,
- height: usize,
- ) -> usize {
- let max_height = Self::calc_height(max_height, height);
- let min_height = Self::calc_height(min_height, height);
- let prefer_height = Self::calc_height(prefer_height, height);
-
- // ensure the calculated height is in range (MIN_HEIGHT, height)
- let max_height = max(min(max_height, height), MIN_HEIGHT);
- let min_height = max(min(min_height, height), MIN_HEIGHT);
- max(min(prefer_height, max_height), min_height)
- }
-
- /// Pause the terminal
- fn pause(&mut self, exiting: bool) -> Result<()> {
- self.disable_mouse()?;
- if let Some(mut output) = self.output.take() {
- output.show_cursor();
- if self.clear_on_exit || !exiting {
- // clear drawn contents
- //
- // Only send rmcup if we actually sent smcup in `ensure_height`;
- // otherwise use cursor_goto + erase_down. Previously this gated
- // on `!self.disable_alternate_screen`, which emitted rmcup even
- // in partial-height mode (where smcup was skipped), leaving
- // terminal artifacts. See skim-rs/skim#880.
- if self.alternate_screen {
- output.quit_alternate_screen();
- } else {
- output.cursor_goto(self.cursor_row, 0);
- output.erase_down();
- }
- } else {
- output.cursor_goto(self.cursor_row + self.screen.height(), 0);
- if self.bottom_intact {
- output.write("\n");
- }
- }
- output.flush();
- }
- Ok(())
- }
-
- /// ensure the screen had enough height
- /// If the prefer height is full screen, it will enter alternate screen
- /// otherwise it will ensure there are enough lines at the bottom
- fn ensure_height(&mut self, cursor_pos: (usize, usize)) -> Result<()> {
- let output = self.output.as_mut().ok_or(TuikitError::TerminalNotStarted)?;
-
- // initialize
-
- let (screen_width, screen_height) = output
- .terminal_size()
- .expect("termlock:ensure_height get terminal size failed");
- let height_to_be =
- Self::calc_preferred_height(&self.min_height, &self.max_height, &self.prefer_height, screen_height);
-
- self.alternate_screen = false;
- let (mut cursor_row, cursor_col) = cursor_pos;
- if height_to_be >= screen_height {
- // whole screen
- self.bottom_intact = false;
- self.cursor_row = 0;
- if !self.disable_alternate_screen {
- output.enter_alternate_screen();
- // Track that smcup was actually emitted so `pause` can emit
- // rmcup symmetrically. See skim-rs/skim#880.
- self.alternate_screen = true;
- }
- } else {
- // only use part of the screen
-
- // go to a new line so that existing line won't be messed up
- if cursor_col > 0 {
- output.write("\n");
- cursor_row += 1;
- }
-
- if (cursor_row + height_to_be) <= screen_height {
- self.bottom_intact = false;
- self.cursor_row = cursor_row;
- } else {
- for _ in 0..(height_to_be - 1) {
- output.write("\n");
- }
- self.bottom_intact = true;
- self.cursor_row = min(cursor_row, screen_height - height_to_be);
- }
- }
-
- output.cursor_goto(self.cursor_row, 0);
- output.flush();
- self.screen_height = screen_height;
- self.screen_width = screen_width;
- Ok(())
- }
-
- /// get the start row of the terminal
- pub fn get_term_start_row(&self) -> usize {
- self.cursor_row
- }
-
- /// restart the terminal
- pub fn restart(&mut self, output: Output, cursor_pos: (usize, usize)) -> Result<()> {
- // ensure the output area had enough height
- self.output.replace(output);
- self.ensure_height(cursor_pos)?;
- self.on_resize()?;
- if self.mouse_enabled {
- self.enable_mouse()?;
- }
- Ok(())
- }
-
- /// return the printable size(width, height) of the term
- pub fn term_size(&self) -> Result<(usize, usize)> {
- self.screen.size()
- }
-
- /// clear internal buffer
- pub fn clear(&mut self) -> Result<()> {
- self.screen.clear()
- }
-
- /// change a cell of position `(row, col)` to `cell`
- pub fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> Result<usize> {
- self.screen.put_cell(row, col, cell)
- }
-
- /// print `content` starting with position `(row, col)`
- pub fn print_with_attr(&mut self, row: usize, col: usize, content: &str, attr: impl Into<Attr>) -> Result<usize> {
- self.screen.print_with_attr(row, col, content, attr.into())
- }
-
- /// set cursor position to (row, col)
- pub fn set_cursor(&mut self, row: usize, col: usize) -> Result<()> {
- self.screen.set_cursor(row, col)
- }
-
- /// show/hide cursor, set `show` to `false` to hide the cursor
- pub fn show_cursor(&mut self, show: bool) -> Result<()> {
- self.screen.show_cursor(show)
- }
-
- /// Enable mouse support
- pub fn enable_mouse_support(&mut self) -> Result<()> {
- self.mouse_enabled = true;
- self.enable_mouse()
- }
-
- /// Disable mouse support
- pub fn disable_mouse_support(&mut self) -> Result<()> {
- self.mouse_enabled = false;
- self.disable_mouse()
- }
-
- pub fn clear_on_exit(&mut self, clear: bool) {
- self.clear_on_exit = clear;
- }
-
- /// Enable mouse (send ANSI codes to enable mouse)
- fn enable_mouse(&mut self) -> Result<()> {
- let output = self.output.as_mut().ok_or(TuikitError::TerminalNotStarted)?;
- output.enable_mouse_support();
- Ok(())
- }
-
- /// Disable mouse (send ANSI codes to disable mouse)
- fn disable_mouse(&mut self) -> Result<()> {
- let output = self.output.as_mut().ok_or(TuikitError::TerminalNotStarted)?;
- output.disable_mouse_support();
- Ok(())
- }
-}
-
-impl Drop for TermLock {
- fn drop(&mut self) {
- let _ = self.pause(true);
- }
-}
diff --git a/vendor/skim-tuikit/src/widget/align.rs b/vendor/skim-tuikit/src/widget/align.rs
deleted file mode 100644
index fede49fdd..000000000
--- a/vendor/skim-tuikit/src/widget/align.rs
+++ /dev/null
@@ -1,119 +0,0 @@
-pub trait AlignSelf {
- /// say horizontal align, given container's (start, end) and self's size
- /// Adjust the actual start position of self.
- ///
- /// Note that if the container's size < self_size, will return `start`
- fn adjust(&self, start: usize, end_exclusive: usize, self_size: usize) -> usize;
-}
-
-pub enum HorizontalAlign {
- Left,
- Center,
- Right,
-}
-
-pub enum VerticalAlign {
- Top,
- Middle,
- Bottom,
-}
-
-impl AlignSelf for HorizontalAlign {
- fn adjust(&self, start: usize, end: usize, self_size: usize) -> usize {
- if start >= end {
- // wrong input
- return start;
- }
- let container_size = end - start;
- if container_size <= self_size {
- return start;
- }
-
- match self {
- HorizontalAlign::Left => start,
- HorizontalAlign::Center => start + (container_size - self_size) / 2,
- HorizontalAlign::Right => end - self_size,
- }
- }
-}
-
-impl AlignSelf for VerticalAlign {
- fn adjust(&self, start: usize, end: usize, self_size: usize) -> usize {
- if start >= end {
- // wrong input
- return start;
- }
- let container_size = end - start;
- if container_size <= self_size {
- return start;
- }
-
- match self {
- VerticalAlign::Top => start,
- VerticalAlign::Middle => start + (container_size - self_size) / 2,
- VerticalAlign::Bottom => end - self_size,
- }
- }
-}
-
-#[cfg(test)]
-mod tests {
- use crate::widget::align::{AlignSelf, HorizontalAlign, VerticalAlign};
-
- #[test]
- fn size_lt0_return_start() {
- assert_eq!(0, HorizontalAlign::Left.adjust(0, 0, 2));
- assert_eq!(0, HorizontalAlign::Center.adjust(0, 0, 2));
- assert_eq!(0, HorizontalAlign::Right.adjust(0, 0, 2));
- assert_eq!(0, VerticalAlign::Top.adjust(0, 0, 2));
- assert_eq!(0, VerticalAlign::Middle.adjust(0, 0, 2));
- assert_eq!(0, VerticalAlign::Bottom.adjust(0, 0, 2));
-
- assert_eq!(2, HorizontalAlign::Left.adjust(2, 0, 2));
- assert_eq!(2, HorizontalAlign::Center.adjust(2, 0, 2));
- assert_eq!(2, HorizontalAlign::Right.adjust(2, 0, 2));
- assert_eq!(2, VerticalAlign::Top.adjust(2, 0, 2));
- assert_eq!(2, VerticalAlign::Middle.adjust(2, 0, 2));
- assert_eq!(2, VerticalAlign::Bottom.adjust(2, 0, 2));
- }
-
- #[test]
- fn container_size_too_small_return_start() {
- assert_eq!(2, HorizontalAlign::Left.adjust(2, 3, 2));
- assert_eq!(2, HorizontalAlign::Center.adjust(2, 3, 2));
- assert_eq!(2, HorizontalAlign::Right.adjust(2, 3, 2));
- assert_eq!(2, VerticalAlign::Top.adjust(2, 3, 2));
- assert_eq!(2, VerticalAlign::Middle.adjust(2, 3, 2));
- assert_eq!(2, VerticalAlign::Bottom.adjust(2, 3, 2));
- }
-
- #[test]
- fn align_start() {
- assert_eq!(2, HorizontalAlign::Left.adjust(2, 8, 2));
- assert_eq!(2, VerticalAlign::Top.adjust(2, 8, 2));
- assert_eq!(2, HorizontalAlign::Left.adjust(2, 7, 2));
- assert_eq!(2, VerticalAlign::Top.adjust(2, 7, 2));
- assert_eq!(2, HorizontalAlign::Left.adjust(2, 8, 3));
- assert_eq!(2, VerticalAlign::Top.adjust(2, 8, 3));
- }
-
- #[test]
- fn align_end() {
- assert_eq!(6, HorizontalAlign::Right.adjust(2, 8, 2));
- assert_eq!(6, VerticalAlign::Bottom.adjust(2, 8, 2));
- assert_eq!(5, HorizontalAlign::Right.adjust(2, 7, 2));
- assert_eq!(5, VerticalAlign::Bottom.adjust(2, 7, 2));
- assert_eq!(5, HorizontalAlign::Right.adjust(2, 8, 3));
- assert_eq!(5, VerticalAlign::Bottom.adjust(2, 8, 3));
- }
-
- #[test]
- fn align_center() {
- assert_eq!(4, HorizontalAlign::Center.adjust(2, 8, 2));
- assert_eq!(4, VerticalAlign::Middle.adjust(2, 8, 2));
- assert_eq!(3, HorizontalAlign::Center.adjust(2, 7, 2));
- assert_eq!(3, VerticalAlign::Middle.adjust(2, 7, 2));
- assert_eq!(3, HorizontalAlign::Center.adjust(2, 8, 3));
- assert_eq!(3, VerticalAlign::Middle.adjust(2, 8, 3));
- }
-}
diff --git a/vendor/skim-tuikit/src/widget/mod.rs b/vendor/skim-tuikit/src/widget/mod.rs
deleted file mode 100644
index 2d5a6382d..000000000
--- a/vendor/skim-tuikit/src/widget/mod.rs
+++ /dev/null
@@ -1,137 +0,0 @@
-pub use self::align::*;
-// Various pre-defined widget that implements Draw
-pub use self::split::*;
-pub use self::stack::*;
-pub use self::win::*;
-use crate::draw::Draw;
-use crate::event::Event;
-use std::cmp::min;
-mod align;
-mod split;
-mod stack;
-mod util;
-mod win;
-
-/// Whether fixed size or percentage
-#[derive(Debug, Copy, Clone, Default)]
-pub enum Size {
- Fixed(usize),
- Percent(usize),
- #[default]
- Default,
-}
-
-impl Size {
- pub fn calc_fixed_size(&self, total_size: usize, default_size: usize) -> usize {
- match *self {
- Size::Fixed(fixed) => min(total_size, fixed),
- Size::Percent(percent) => min(total_size, total_size * percent / 100),
- Size::Default => default_size,
- }
- }
-}
-
-impl From<usize> for Size {
- fn from(size: usize) -> Self {
- Size::Fixed(size)
- }
-}
-
-#[derive(Copy, Clone, Debug)]
-pub struct Rectangle {
- pub top: usize,
- pub left: usize,
- pub width: usize,
- pub height: usize,
-}
-
-impl Rectangle {
- /// check if the given point(row, col) lies in the rectangle
- pub fn contains(&self, row: usize, col: usize) -> bool {
- if row < self.top || row >= self.top + self.height {
- false
- } else {
- !(col < self.left || col >= self.left + self.width)
- }
- }
-
- /// assume the point (row, col) lies in the rectangle, adjust the origin to the rectangle's
- /// origin (top, left)
- pub fn relative_to_origin(&self, row: usize, col: usize) -> (usize, usize) {
- (row - self.top, col - self.left)
- }
-
- pub fn adjust_origin(&self) -> Rectangle {
- Self {
- top: 0,
- left: 0,
- width: self.width,
- height: self.height,
- }
- }
-}
-
-/// A widget could be recursive nested
-pub trait Widget<Message = ()>: Draw {
- /// the (width, height) of the content
- /// it will be the hint for layouts to calculate the final size
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- (None, None)
- }
-
- /// given a key event, emit zero or more messages
- /// typical usage is the mouse click event where containers would pass the event down
- /// to their children.
- fn on_event(&self, event: Event, rect: Rectangle) -> Vec<Message> {
- let _ = (event, rect); // avoid warning
- Vec::new()
- }
-
- /// same as `on_event` except that the self reference is mutable
- fn on_event_mut(&mut self, event: Event, rect: Rectangle) -> Vec<Message> {
- let _ = (event, rect); // avoid warning
- Vec::new()
- }
-}
-
-impl<Message, T: Widget<Message>> Widget<Message> for &T {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- (*self).size_hint()
- }
-
- fn on_event(&self, event: Event, rect: Rectangle) -> Vec<Message> {
- (*self).on_event(event, rect)
- }
-
- fn on_event_mut(&mut self, event: Event, rect: Rectangle) -> Vec<Message> {
- (**self).on_event(event, rect)
- }
-}
-
-impl<Message, T: Widget<Message>> Widget<Message> for &mut T {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- (**self).size_hint()
- }
-
- fn on_event(&self, event: Event, rect: Rectangle) -> Vec<Message> {
- (**self).on_event(event, rect)
- }
-
- fn on_event_mut(&mut self, event: Event, rect: Rectangle) -> Vec<Message> {
- (**self).on_event_mut(event, rect)
- }
-}
-
-impl<Message, T: Widget<Message> + ?Sized> Widget<Message> for Box<T> {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- self.as_ref().size_hint()
- }
-
- fn on_event(&self, event: Event, rect: Rectangle) -> Vec<Message> {
- self.as_ref().on_event(event, rect)
- }
-
- fn on_event_mut(&mut self, event: Event, rect: Rectangle) -> Vec<Message> {
- self.as_mut().on_event_mut(event, rect)
- }
-}
diff --git a/vendor/skim-tuikit/src/widget/split.rs b/vendor/skim-tuikit/src/widget/split.rs
deleted file mode 100644
index 62ff7b667..000000000
--- a/vendor/skim-tuikit/src/widget/split.rs
+++ /dev/null
@@ -1,1267 +0,0 @@
-use super::Size;
-use super::util::adjust_event;
-use super::{Rectangle, Widget};
-use crate::canvas::{BoundedCanvas, Canvas};
-use crate::draw::Draw;
-use crate::draw::DrawResult;
-use crate::event::Event;
-use std::cmp::{Ordering, min};
-
-/// A Split item would contain 3 things
-/// 0. inner_size, will be used if `basis` is `Size::Default`.
-/// 1. basis, the original size
-/// 2. grow, the factor to grow if there is still enough room
-/// 3. shrink, the factor to shrink if there is not enough room
-pub trait Split<Message = ()>: Widget<Message> {
- fn get_basis(&self) -> Size;
-
- fn get_grow(&self) -> usize;
-
- fn get_shrink(&self) -> usize;
-
- /// get the default size of inner content, will be used if `basis` is Default
- fn inner_size(&self) -> (Size, Size) {
- let (width, height) = self.size_hint();
- let width = width.map(Size::Fixed).unwrap_or(Size::Default);
- let height = height.map(Size::Fixed).unwrap_or(Size::Default);
- (width, height)
- }
-}
-
-impl<Message, T: Split<Message> + Widget<Message>> Split<Message> for &T {
- fn get_basis(&self) -> Size {
- (*self).get_basis()
- }
-
- fn get_grow(&self) -> usize {
- (*self).get_grow()
- }
-
- fn get_shrink(&self) -> usize {
- (*self).get_shrink()
- }
-
- fn inner_size(&self) -> (Size, Size) {
- (*self).inner_size()
- }
-}
-
-impl<Message, T: Split<Message> + Widget<Message>> Split<Message> for &mut T {
- fn get_basis(&self) -> Size {
- (**self).get_basis()
- }
-
- fn get_grow(&self) -> usize {
- (**self).get_grow()
- }
-
- fn get_shrink(&self) -> usize {
- (**self).get_shrink()
- }
-
- fn inner_size(&self) -> (Size, Size) {
- (**self).inner_size()
- }
-}
-
-enum Op {
- Noop,
- Grow,
- Shrink,
-}
-
-enum SplitType {
- Horizontal,
- Vertical,
-}
-
-trait SplitContainer<'a, Message = ()> {
- fn get_splits(&self) -> &[Box<dyn Split<Message> + 'a>];
-
- fn get_split_type(&self) -> SplitType;
-
- /// return the target sizes of the splits
- fn retrieve_split_info(&self, actual_size: usize) -> Vec<usize> {
- let split_type = self.get_split_type();
-
- let split_sizes: Vec<usize> = self
- .get_splits()
- .iter()
- .map(|split| {
- let (width, height) = split.inner_size();
- let default = match &split_type {
- SplitType::Horizontal => width,
- SplitType::Vertical => height,
- };
-
- match split.get_basis() {
- Size::Default => default,
- basis => basis,
- }
- })
- .map(|size| size.calc_fixed_size(actual_size, actual_size))
- .collect();
-
- let target_total_size: usize = split_sizes.iter().sum();
-
- let op = match target_total_size.cmp(&actual_size) {
- Ordering::Equal => Op::Noop,
- Ordering::Less => Op::Grow,
- Ordering::Greater => Op::Shrink,
- };
-
- let size_diff = match op {
- Op::Noop => 0,
- Op::Grow => actual_size - target_total_size,
- Op::Shrink => target_total_size - actual_size,
- };
-
- let split_factors: Vec<usize> = self
- .get_splits()
- .iter()
- .map(|split| match op {
- Op::Noop => 0,
- Op::Shrink => split.get_shrink(),
- Op::Grow => split.get_grow(),
- })
- .collect();
-
- let total_factors: usize = split_factors.iter().sum();
-
- let unit = if total_factors == 0 {
- 0
- } else {
- size_diff / total_factors
- };
-
- (0..split_sizes.len())
- .map(|idx| {
- let diff = split_factors[idx] * unit;
- match op {
- Op::Noop => split_sizes[idx],
- Op::Grow => split_sizes[idx] + diff,
- Op::Shrink => split_sizes[idx] - min(split_sizes[idx], diff),
- }
- })
- .collect()
- }
-}
-
-/// HSplit will split the area horizontally. It will
-/// 1. Count the total width(basis) of the split items it contains
-/// 2. Judge if the current width is enough or not for the split items
-/// 3. shrink/grow the split items according to their factors / (total factors)
-/// 4. If still not enough room, the last one(s) would be set width 0
-pub struct HSplit<'a, Message = ()> {
- basis: Size,
- grow: usize,
- shrink: usize,
- splits: Vec<Box<dyn Split<Message> + 'a>>,
-}
-
-impl<Message> Default for HSplit<'_, Message> {
- fn default() -> Self {
- Self {
- basis: Size::Default,
- grow: 1,
- shrink: 1,
- splits: Vec::new(),
- }
- }
-}
-
-impl<'a, Message> HSplit<'a, Message> {
- pub fn split(mut self, split: impl Split<Message> + 'a) -> Self {
- self.splits.push(Box::new(split));
- self
- }
-
- pub fn basis(mut self, basis: impl Into<Size>) -> Self {
- self.basis = basis.into();
- self
- }
-
- pub fn grow(mut self, grow: usize) -> Self {
- self.grow = grow;
- self
- }
-
- pub fn shrink(mut self, shrink: usize) -> Self {
- self.shrink = shrink;
- self
- }
-}
-
-impl<'a, Message> SplitContainer<'a, Message> for HSplit<'a, Message> {
- fn get_splits(&self) -> &[Box<dyn Split<Message> + 'a>] {
- &self.splits
- }
-
- fn get_split_type(&self) -> SplitType {
- SplitType::Horizontal
- }
-}
-
-impl<Message> Draw for HSplit<'_, Message> {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let target_widths = self.retrieve_split_info(width);
-
- // iterate over the splits
- let mut left = 0;
- for (idx, split) in self.splits.iter().enumerate() {
- let target_width = target_widths[idx];
- let right = min(left + target_width, width);
- let mut new_canvas = BoundedCanvas::new(0, left, right - left, height, canvas);
- let _ = split.draw(&mut new_canvas);
- left = right;
- }
-
- Ok(())
- }
-
- fn draw_mut(&mut self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let target_widths = self.retrieve_split_info(width);
-
- // iterate over the splits
- let mut left = 0;
- for (idx, split) in self.splits.iter_mut().enumerate() {
- let target_width = target_widths[idx];
- let right = min(left + target_width, width);
- let mut new_canvas = BoundedCanvas::new(0, left, right - left, height, canvas);
- let _ = split.draw_mut(&mut new_canvas);
- left = right;
- }
-
- Ok(())
- }
-}
-
-impl<Message> Widget<Message> for HSplit<'_, Message> {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- let has_width_hint = self.splits.iter().any(|split| split.size_hint().0.is_some());
- let has_height_hint = self.splits.iter().any(|split| split.size_hint().1.is_some());
-
- let width = if has_width_hint {
- Some(self.splits.iter().map(|split| split.size_hint().0.unwrap_or(0)).sum())
- } else {
- None
- };
-
- let height = if has_height_hint {
- Some(
- self.splits
- .iter()
- .map(|split| split.size_hint().1.unwrap_or(0))
- .max()
- .unwrap_or(0),
- )
- } else {
- None
- };
-
- (width, height)
- }
-
- fn on_event(&self, event: Event, rect: Rectangle) -> Vec<Message> {
- // should collect events from every children
- let target_widths = self.retrieve_split_info(rect.width);
- let Rectangle { top, width, height, .. } = rect;
- let mut messages = vec![];
-
- // iterate over the splits
- let mut left = 0;
- for (idx, split) in self.splits.iter().enumerate() {
- let target_width = target_widths[idx];
- let right = min(left + target_width, width);
- let sub_rect = Rectangle {
- top,
- left,
- width: target_width,
- height,
- };
-
- let mut sub_message = adjust_event(event, sub_rect)
- .map(|ev| split.as_ref().on_event(ev, sub_rect.adjust_origin()))
- .unwrap_or_default();
- messages.append(&mut sub_message);
- left = right;
- }
-
- messages
- }
-
- fn on_event_mut(&mut self, event: Event, rect: Rectangle) -> Vec<Message> {
- // should collect events from every children
- let target_widths = self.retrieve_split_info(rect.width);
- let Rectangle { top, width, height, .. } = rect;
- let mut messages = vec![];
-
- // iterate over the splits
- let mut left = 0;
- for (idx, split) in self.splits.iter_mut().enumerate() {
- let target_width = target_widths[idx];
- let right = min(left + target_width, width);
- let sub_rect = Rectangle {
- top,
- left,
- width: target_width,
- height,
- };
-
- let mut sub_message = adjust_event(event, sub_rect)
- .map(|ev| split.as_mut().on_event_mut(ev, sub_rect.adjust_origin()))
- .unwrap_or_default();
- messages.append(&mut sub_message);
- left = right;
- }
-
- messages
- }
-}
-
-impl<Message> Split<Message> for HSplit<'_, Message> {
- fn get_basis(&self) -> Size {
- self.basis
- }
-
- fn get_grow(&self) -> usize {
- self.grow
- }
-
- fn get_shrink(&self) -> usize {
- self.shrink
- }
-}
-
-/// VSplit will split the area vertically. It will
-/// 1. Count the total height(basis) of the split items it contains
-/// 2. Judge if the current height is enough or not for the split items
-/// 3. shrink/grow the split items according to their factors / (total factors)
-/// 4. If still not enough room, the last one(s) would be set height 0
-pub struct VSplit<'a, Message = ()> {
- basis: Size,
- grow: usize,
- shrink: usize,
- splits: Vec<Box<dyn Split<Message> + 'a>>,
-}
-
-impl<Message> Default for VSplit<'_, Message> {
- fn default() -> Self {
- Self {
- basis: Size::Default,
- grow: 1,
- shrink: 1,
- splits: Vec::new(),
- }
- }
-}
-
-impl<'a, Message> VSplit<'a, Message> {
- pub fn split(mut self, split: impl Split<Message> + 'a) -> Self {
- self.splits.push(Box::new(split));
- self
- }
-
- pub fn basis(mut self, basis: impl Into<Size>) -> Self {
- self.basis = basis.into();
- self
- }
-
- pub fn grow(mut self, grow: usize) -> Self {
- self.grow = grow;
- self
- }
-
- pub fn shrink(mut self, shrink: usize) -> Self {
- self.shrink = shrink;
- self
- }
-}
-
-impl<'a, Message> SplitContainer<'a, Message> for VSplit<'a, Message> {
- fn get_splits(&self) -> &[Box<dyn Split<Message> + 'a>] {
- &self.splits
- }
-
- fn get_split_type(&self) -> SplitType {
- SplitType::Vertical
- }
-}
-
-impl<Message> Draw for VSplit<'_, Message> {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let target_heights = self.retrieve_split_info(height);
-
- // iterate over the splits
- let mut top = 0;
- for (idx, split) in self.splits.iter().enumerate() {
- let target_height = target_heights[idx];
- let bottom = min(top + target_height, height);
- let mut new_canvas = BoundedCanvas::new(top, 0, width, bottom - top, canvas);
- let _ = split.draw(&mut new_canvas);
- top = bottom;
- }
-
- Ok(())
- }
- fn draw_mut(&mut self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let target_heights = self.retrieve_split_info(height);
-
- // iterate over the splits
- let mut top = 0;
- for (idx, split) in self.splits.iter_mut().enumerate() {
- let target_height = target_heights[idx];
- let bottom = min(top + target_height, height);
- let mut new_canvas = BoundedCanvas::new(top, 0, width, bottom - top, canvas);
- let _ = split.draw_mut(&mut new_canvas);
- top = bottom;
- }
-
- Ok(())
- }
-}
-
-impl<Message> Widget<Message> for VSplit<'_, Message> {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- let has_width_hint = self.splits.iter().any(|split| split.size_hint().0.is_some());
- let has_height_hint = self.splits.iter().any(|split| split.size_hint().1.is_some());
-
- let width = if has_width_hint {
- Some(
- self.splits
- .iter()
- .map(|split| split.size_hint().0.unwrap_or(0))
- .max()
- .unwrap_or(0),
- )
- } else {
- None
- };
-
- let height = if has_height_hint {
- Some(self.splits.iter().map(|split| split.size_hint().1.unwrap_or(0)).sum())
- } else {
- None
- };
-
- (width, height)
- }
-
- fn on_event(&self, event: Event, rect: Rectangle) -> Vec<Message> {
- // should collect events from every children
- let target_heights = self.retrieve_split_info(rect.height);
- let Rectangle {
- left, width, height, ..
- } = rect;
- let mut messages = vec![];
-
- // iterate over the splits
- let mut top = 0;
- for (idx, split) in self.splits.iter().enumerate() {
- let target_height = target_heights[idx];
- let bottom = min(top + target_height, height);
- let sub_rect = Rectangle {
- top,
- left,
- width,
- height: target_height,
- };
- let mut sub_message = adjust_event(event, sub_rect)
- .map(|ev| split.as_ref().on_event(ev, sub_rect.adjust_origin()))
- .unwrap_or_default();
- messages.append(&mut sub_message);
- top = bottom;
- }
-
- messages
- }
-
- fn on_event_mut(&mut self, event: Event, rect: Rectangle) -> Vec<Message> {
- // should collect events from every children
- let target_heights = self.retrieve_split_info(rect.height);
- let Rectangle {
- left, width, height, ..
- } = rect;
- let mut messages = vec![];
-
- // iterate over the splits
- let mut top = 0;
- for (idx, split) in self.splits.iter_mut().enumerate() {
- let target_height = target_heights[idx];
- let bottom = min(top + target_height, height);
- let sub_rect = Rectangle {
- top,
- left,
- width,
- height: target_height,
- };
- let mut sub_message = adjust_event(event, sub_rect)
- .map(|ev| split.as_mut().on_event_mut(ev, sub_rect.adjust_origin()))
- .unwrap_or_default();
- messages.append(&mut sub_message);
- top = bottom;
- }
-
- messages
- }
-}
-
-impl<Message> Split<Message> for VSplit<'_, Message> {
- fn get_basis(&self) -> Size {
- self.basis
- }
-
- fn get_grow(&self) -> usize {
- self.grow
- }
-
- fn get_shrink(&self) -> usize {
- self.shrink
- }
-}
-
-#[cfg(test)]
-#[allow(dead_code)]
-mod test {
- use super::*;
- use crate::Result;
- use crate::cell::Cell;
- use crate::key::Key;
- use crate::key::Key::*;
- use crate::key::MouseButton;
- use std::sync::Mutex;
-
- struct TestCanvas {
- pub width: usize,
- pub height: usize,
- }
-
- impl Canvas for TestCanvas {
- fn size(&self) -> Result<(usize, usize)> {
- Ok((self.width, self.height))
- }
-
- fn clear(&mut self) -> Result<()> {
- unimplemented!()
- }
-
- fn put_cell(&mut self, _row: usize, _col: usize, _cell: Cell) -> Result<usize> {
- unimplemented!()
- }
-
- fn set_cursor(&mut self, _row: usize, _col: usize) -> Result<()> {
- unimplemented!()
- }
-
- fn show_cursor(&mut self, _show: bool) -> Result<()> {
- unimplemented!()
- }
- }
-
- struct WSplit<'a> {
- pub basis: Size,
- pub grow: usize,
- pub shrink: usize,
- pub draw: &'a dyn Draw,
- }
-
- impl<'a> WSplit<'a> {
- pub fn new(draw: &'a dyn Draw) -> Self {
- Self {
- basis: Size::Default,
- grow: 1,
- shrink: 1,
- draw,
- }
- }
-
- pub fn basis(mut self, basis: impl Into<Size>) -> Self {
- self.basis = basis.into();
- self
- }
-
- pub fn grow(mut self, grow: usize) -> Self {
- self.grow = grow;
- self
- }
-
- pub fn shrink(mut self, shrink: usize) -> Self {
- self.shrink = shrink;
- self
- }
- }
-
- impl Split for WSplit<'_> {
- fn get_basis(&self) -> Size {
- self.basis
- }
-
- fn get_grow(&self) -> usize {
- self.grow
- }
-
- fn get_shrink(&self) -> usize {
- self.shrink
- }
- }
-
- impl Draw for WSplit<'_> {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- self.draw.draw(canvas)
- }
- }
-
- impl Widget for WSplit<'_> {}
-
- #[derive(Default)]
- struct SingleWindow {
- pub width: usize,
- pub height: usize,
- }
-
- impl Draw for SingleWindow {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size().unwrap();
- assert_eq!(self.width, width);
- assert_eq!(self.height, height);
- Ok(())
- }
- }
-
- #[test]
- fn splits_should_create_on_empty_items() {
- let mut canvas = TestCanvas { width: 80, height: 60 };
- let hsplit = HSplit::<()>::default();
- let vsplit = VSplit::<()>::default();
- let _ = hsplit.draw(&mut canvas);
- let _ = vsplit.draw(&mut canvas);
- }
-
- #[test]
- fn single_splits_should_take_over_all_spaces() {
- let width = 80;
- let height = 60;
- let mut canvas = TestCanvas { width, height };
- let window = SingleWindow { width, height };
- let hsplit = HSplit::default().split(WSplit::new(&window));
- let vsplit = VSplit::default().split(WSplit::new(&window));
- let _ = hsplit.draw(&mut canvas);
- let _ = vsplit.draw(&mut canvas);
- }
-
- #[test]
- fn two_splits_should_take_50_percent() {
- let width = 80;
- let height = 60;
- let mut canvas = TestCanvas { width, height };
-
- let h_window = SingleWindow {
- width: width / 2,
- height,
- };
- let v_window = SingleWindow {
- width,
- height: height / 2,
- };
-
- let hsplit = HSplit::default()
- .split(WSplit::new(&h_window))
- .split(WSplit::new(&h_window));
- let vsplit = VSplit::default()
- .split(WSplit::new(&v_window))
- .split(WSplit::new(&v_window));
-
- let _ = hsplit.draw(&mut canvas);
- let _ = vsplit.draw(&mut canvas);
- }
-
- #[test]
- fn exceeded_should_be_ignored() {
- // |<-- screen width: 80 -->|
- // |<-- 60 -->|<-- 60 -->|
- // |<-- 60 -->|<-- | (will be cut)
-
- let width = 80;
- let height = 80;
- let mut canvas = TestCanvas { width, height };
-
- let h_first = SingleWindow { width: 60, height };
- let h_second = SingleWindow { width: 20, height };
- let h_third = SingleWindow { width: 0, height };
-
- let hsplit = HSplit::default()
- .split(WSplit::new(&h_first).basis(60).shrink(0))
- .split(WSplit::new(&h_second).basis(60).shrink(0))
- .split(WSplit::new(&h_third).basis(60).shrink(0));
-
- let _ = hsplit.draw(&mut canvas);
-
- let v_first = SingleWindow { width, height: 60 };
- let v_second = SingleWindow { width, height: 20 };
- let v_third = SingleWindow { width, height: 0 };
-
- let vsplit = VSplit::default()
- .split(WSplit::new(&v_first).basis(60).shrink(0))
- .split(WSplit::new(&v_second).basis(60).shrink(0))
- .split(WSplit::new(&v_third).basis(60).shrink(0));
-
- let _ = vsplit.draw(&mut canvas);
- }
-
- #[test]
- fn grow() {
- // |<-- screen width: 80 -->|
- // 1. 10 (with grow: 1) => 30
- // 2. 10 (with grow: 2) => 50
-
- let width = 80;
- let height = 80;
- let mut canvas = TestCanvas { width, height };
-
- let h_first = SingleWindow { width: 30, height };
- let h_second = SingleWindow { width: 50, height };
-
- let hsplit = HSplit::default()
- .split(WSplit::new(&h_first).basis(10).grow(1))
- .split(WSplit::new(&h_second).basis(10).grow(2));
-
- let _ = hsplit.draw(&mut canvas);
-
- let v_first = SingleWindow { width, height: 30 };
- let v_second = SingleWindow { width, height: 50 };
-
- let vsplit = VSplit::default()
- .split(WSplit::new(&v_first).basis(10).grow(1))
- .split(WSplit::new(&v_second).basis(10).grow(2));
-
- let _ = vsplit.draw(&mut canvas);
- }
-
- #[test]
- fn shrink() {
- // |<-- screen width: 80 -->|
- // 1. 70 (with shrink: 1) => 30
- // 2. 70 (with shrink: 2) => 50
-
- let width = 80;
- let height = 80;
- let mut canvas = TestCanvas { width, height };
-
- let h_first = SingleWindow { width: 50, height };
- let h_second = SingleWindow { width: 30, height };
-
- let hsplit = HSplit::default()
- .split(WSplit::new(&h_first).basis(70).shrink(1))
- .split(WSplit::new(&h_second).basis(70).shrink(2));
-
- let _ = hsplit.draw(&mut canvas);
-
- let v_first = SingleWindow { width, height: 50 };
- let v_second = SingleWindow { width, height: 30 };
-
- let vsplit = VSplit::default()
- .split(WSplit::new(&v_first).basis(70).shrink(1))
- .split(WSplit::new(&v_second).basis(70).shrink(2));
-
- let _ = vsplit.draw(&mut canvas);
- }
-
- struct WinHint {
- pub width_hint: Option<usize>,
- pub height_hint: Option<usize>,
- }
-
- impl Draw for WinHint {
- fn draw(&self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- unimplemented!()
- }
- }
-
- impl Widget for WinHint {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- (self.width_hint, self.height_hint)
- }
- }
-
- impl Split for WinHint {
- fn get_basis(&self) -> Size {
- Size::Default
- }
- fn get_grow(&self) -> usize {
- 0
- }
- fn get_shrink(&self) -> usize {
- 0
- }
- }
-
- #[test]
- fn size_hint_of_hsplit() {
- let hint_none = WinHint {
- width_hint: None,
- height_hint: None,
- };
- let hint_width_1 = WinHint {
- width_hint: Some(1),
- height_hint: None,
- };
- let hint_width_2 = WinHint {
- width_hint: Some(2),
- height_hint: None,
- };
- let hint_height_1 = WinHint {
- width_hint: None,
- height_hint: Some(1),
- };
- let hint_height_2 = WinHint {
- width_hint: None,
- height_hint: Some(2),
- };
-
- // sum(width), max(height)
- let split = HSplit::default()
- .split(&hint_none)
- .split(&hint_width_1)
- .split(&hint_width_2)
- .split(&hint_height_1)
- .split(&hint_height_2);
-
- assert_eq!((Some(3), Some(2)), split.size_hint());
-
- // None, max(height)
- let split = HSplit::default()
- .split(&hint_none)
- .split(&hint_height_1)
- .split(&hint_height_2);
-
- assert_eq!((None, Some(2)), split.size_hint());
-
- // sum(width), None
- let split = HSplit::default()
- .split(&hint_none)
- .split(&hint_width_1)
- .split(&hint_width_2);
- assert_eq!((Some(3), None), split.size_hint());
-
- // None
- let split = HSplit::default().split(&hint_none).split(&hint_none);
- assert_eq!((None, None), split.size_hint());
- }
-
- #[test]
- fn size_hint_of_vsplit() {
- let hint_none = WinHint {
- width_hint: None,
- height_hint: None,
- };
- let hint_width_1 = WinHint {
- width_hint: Some(1),
- height_hint: None,
- };
- let hint_width_2 = WinHint {
- width_hint: Some(2),
- height_hint: None,
- };
- let hint_height_1 = WinHint {
- width_hint: None,
- height_hint: Some(1),
- };
- let hint_height_2 = WinHint {
- width_hint: None,
- height_hint: Some(2),
- };
-
- // max(width), sum(height)
- let split = VSplit::default()
- .split(&hint_none)
- .split(&hint_width_1)
- .split(&hint_width_2)
- .split(&hint_height_1)
- .split(&hint_height_2);
-
- assert_eq!((Some(2), Some(3)), split.size_hint());
-
- // None, sum(height)
- let split = VSplit::default()
- .split(&hint_none)
- .split(&hint_height_1)
- .split(&hint_height_2);
-
- assert_eq!((None, Some(3)), split.size_hint());
-
- // max(width), None
- let split = VSplit::default()
- .split(&hint_none)
- .split(&hint_width_1)
- .split(&hint_width_2);
- assert_eq!((Some(2), None), split.size_hint());
-
- // None
- let split = VSplit::default().split(&hint_none).split(&hint_none);
- assert_eq!((None, None), split.size_hint());
- }
-
- #[derive(Copy, Clone, PartialOrd, PartialEq, Debug)]
- enum Message {
- Window(i32),
- }
-
- struct WindowWithId {
- id: i32,
- }
-
- impl WindowWithId {
- pub fn new(id: i32) -> Self {
- Self { id }
- }
- }
-
- impl Draw for WindowWithId {
- fn draw(&self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- unimplemented!()
- }
- }
-
- impl Widget<Message> for WindowWithId {
- fn on_event(&self, _event: Event, _rect: Rectangle) -> Vec<Message> {
- vec![Message::Window(self.id)]
- }
- fn on_event_mut(&mut self, _event: Event, _rect: Rectangle) -> Vec<Message> {
- vec![Message::Window(self.id)]
- }
- }
-
- impl Split<Message> for WindowWithId {
- fn get_basis(&self) -> Size {
- Size::Default
- }
- fn get_grow(&self) -> usize {
- 1
- }
- fn get_shrink(&self) -> usize {
- 1
- }
- }
-
- #[test]
- fn message_should_be_dispatched_correctly() {
- let width = 80;
- let height = 60;
- let rect = Rectangle {
- top: 0,
- left: 0,
- width,
- height,
- };
-
- let win1 = WindowWithId::new(1);
- let win2 = WindowWithId::new(2);
- let win3 = WindowWithId::new(3);
- let win4 = WindowWithId::new(4);
-
- let ev_left_1 = Event::Key(Key::MouseHold(0, 0));
- let ev_left_2 = Event::Key(Key::MouseHold(0, 39));
- let ev_right_1 = Event::Key(Key::MouseHold(20, 40));
- let ev_right_2 = Event::Key(Key::MouseHold(20, 41));
- let ev_right_3 = Event::Key(Key::MouseHold(59, 79));
- let ev_out_of_bound = Event::Key(Key::MouseHold(60, 80));
-
- let hsplit = HSplit::default().split(&win1).split(&win2);
- let msg = hsplit.on_event(ev_left_1, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(1), msg[0]);
- let msg = hsplit.on_event(ev_left_2, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(1), msg[0]);
- let msg = hsplit.on_event(ev_right_1, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = hsplit.on_event(ev_right_2, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = hsplit.on_event(ev_right_3, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = hsplit.on_event(ev_out_of_bound, rect);
- assert!(msg.is_empty());
-
- let ev_top_1 = Event::Key(Key::MouseHold(0, 0));
- let ev_top_2 = Event::Key(Key::MouseHold(29, 39));
- let ev_bottom_1 = Event::Key(Key::MouseHold(30, 40));
- let ev_bottom_2 = Event::Key(Key::MouseHold(31, 41));
- let ev_bottom_3 = Event::Key(Key::MouseHold(59, 79));
- let ev_out_of_bound = Event::Key(Key::MouseHold(60, 80));
-
- let vsplit = VSplit::default().split(&win1).split(&win2);
-
- let msg = vsplit.on_event(ev_top_1, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(1), msg[0]);
- let msg = vsplit.on_event(ev_top_2, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(1), msg[0]);
- let msg = vsplit.on_event(ev_bottom_1, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = vsplit.on_event(ev_bottom_2, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = vsplit.on_event(ev_bottom_3, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = vsplit.on_event(ev_out_of_bound, rect);
- assert!(msg.is_empty());
-
- // 1 | 2
- // --|--
- // 3 | 4
- let nested = HSplit::default()
- .split(VSplit::default().split(&win1).split(&win3))
- .split(VSplit::default().split(&win2).split(&win4));
- let row_col_event = [
- ((0, 0), Message::Window(1)),
- ((0, 39), Message::Window(1)),
- ((29, 0), Message::Window(1)),
- ((29, 39), Message::Window(1)),
- ((0, 40), Message::Window(2)),
- ((0, 79), Message::Window(2)),
- ((29, 40), Message::Window(2)),
- ((29, 79), Message::Window(2)),
- ((30, 0), Message::Window(3)),
- ((30, 39), Message::Window(3)),
- ((59, 0), Message::Window(3)),
- ((59, 39), Message::Window(3)),
- ((30, 40), Message::Window(4)),
- ((30, 79), Message::Window(4)),
- ((59, 40), Message::Window(4)),
- ((59, 79), Message::Window(4)),
- ];
-
- for &((row, col), event) in row_col_event.iter() {
- let ev = Event::Key(MousePress(MouseButton::Left, row, col));
- let msg = nested.on_event(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(MouseRelease(row, col));
- let msg = nested.on_event(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(MouseHold(row, col));
- let msg = nested.on_event(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(SingleClick(MouseButton::Left, row, col));
- let msg = nested.on_event(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(DoubleClick(MouseButton::Left, row, col));
- let msg = nested.on_event(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(Key::WheelUp(row, col, 1));
- let msg = nested.on_event(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(Key::WheelDown(row, col, 1));
- let msg = nested.on_event(ev, rect);
- assert_eq!(msg[0], event);
- }
- }
-
- #[test]
- fn message_should_be_dispatched_correctly_mut() {
- let width = 80;
- let height = 60;
- let rect = Rectangle {
- top: 0,
- left: 0,
- width,
- height,
- };
-
- let mut win1 = WindowWithId::new(1);
- let mut win2 = WindowWithId::new(2);
- let mut win3 = WindowWithId::new(3);
- let mut win4 = WindowWithId::new(4);
-
- let ev_left_1 = Event::Key(Key::MouseHold(0, 0));
- let ev_left_2 = Event::Key(Key::MouseHold(0, 39));
- let ev_right_1 = Event::Key(Key::MouseHold(20, 40));
- let ev_right_2 = Event::Key(Key::MouseHold(20, 41));
- let ev_right_3 = Event::Key(Key::MouseHold(59, 79));
- let ev_out_of_bound = Event::Key(Key::MouseHold(60, 80));
-
- {
- let mut hsplit = HSplit::default().split(&mut win1).split(&mut win2);
- let msg = hsplit.on_event_mut(ev_left_1, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(1), msg[0]);
- let msg = hsplit.on_event_mut(ev_left_2, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(1), msg[0]);
- let msg = hsplit.on_event_mut(ev_right_1, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = hsplit.on_event_mut(ev_right_2, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = hsplit.on_event_mut(ev_right_3, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = hsplit.on_event_mut(ev_out_of_bound, rect);
- assert!(msg.is_empty());
- }
-
- let ev_top_1 = Event::Key(Key::MouseHold(0, 0));
- let ev_top_2 = Event::Key(Key::MouseHold(29, 39));
- let ev_bottom_1 = Event::Key(Key::MouseHold(30, 40));
- let ev_bottom_2 = Event::Key(Key::MouseHold(31, 41));
- let ev_bottom_3 = Event::Key(Key::MouseHold(59, 79));
- let ev_out_of_bound = Event::Key(Key::MouseHold(60, 80));
-
- {
- let mut vsplit = VSplit::default().split(&mut win1).split(&mut win2);
-
- let msg = vsplit.on_event_mut(ev_top_1, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(1), msg[0]);
- let msg = vsplit.on_event_mut(ev_top_2, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(1), msg[0]);
- let msg = vsplit.on_event_mut(ev_bottom_1, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = vsplit.on_event_mut(ev_bottom_2, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = vsplit.on_event_mut(ev_bottom_3, rect);
- assert!(!msg.is_empty());
- assert_eq!(Message::Window(2), msg[0]);
- let msg = vsplit.on_event_mut(ev_out_of_bound, rect);
- assert!(msg.is_empty());
- }
-
- // 1 | 2
- // --|--
- // 3 | 4
- {
- let mut nested = HSplit::default()
- .split(VSplit::default().split(&mut win1).split(&mut win3))
- .split(VSplit::default().split(&mut win2).split(&mut win4));
- let row_col_event = [
- ((0, 0), Message::Window(1)),
- ((0, 39), Message::Window(1)),
- ((29, 0), Message::Window(1)),
- ((29, 39), Message::Window(1)),
- ((0, 40), Message::Window(2)),
- ((0, 79), Message::Window(2)),
- ((29, 40), Message::Window(2)),
- ((29, 79), Message::Window(2)),
- ((30, 0), Message::Window(3)),
- ((30, 39), Message::Window(3)),
- ((59, 0), Message::Window(3)),
- ((59, 39), Message::Window(3)),
- ((30, 40), Message::Window(4)),
- ((30, 79), Message::Window(4)),
- ((59, 40), Message::Window(4)),
- ((59, 79), Message::Window(4)),
- ];
-
- for &((row, col), event) in row_col_event.iter() {
- let ev = Event::Key(MousePress(MouseButton::Left, row, col));
- let msg = nested.on_event_mut(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(MouseRelease(row, col));
- let msg = nested.on_event_mut(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(MouseHold(row, col));
- let msg = nested.on_event_mut(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(SingleClick(MouseButton::Left, row, col));
- let msg = nested.on_event_mut(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(DoubleClick(MouseButton::Left, row, col));
- let msg = nested.on_event_mut(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(Key::WheelUp(row, col, 1));
- let msg = nested.on_event_mut(ev, rect);
- assert_eq!(msg[0], event);
- let ev = Event::Key(Key::WheelDown(row, col, 1));
- let msg = nested.on_event_mut(ev, rect);
- assert_eq!(msg[0], event);
- }
- }
- }
-
- #[derive(PartialEq, Debug)]
- enum Called {
- No,
- Mut,
- Immut,
- }
-
- struct Drawn {
- called: Mutex<Called>,
- }
-
- impl Draw for Drawn {
- fn draw(&self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- *self.called.lock().unwrap() = Called::Immut;
- Ok(())
- }
- fn draw_mut(&mut self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- *self.called.lock().unwrap() = Called::Mut;
- Ok(())
- }
- }
-
- impl Widget for Drawn {}
-
- impl Split for Drawn {
- fn get_basis(&self) -> Size {
- Size::Default
- }
-
- fn get_grow(&self) -> usize {
- 1
- }
-
- fn get_shrink(&self) -> usize {
- 1
- }
- }
-
- #[test]
- fn mutable_widget() {
- let mut canvas = TestCanvas { width: 80, height: 80 };
-
- let mut mutable = Drawn {
- called: Mutex::new(Called::No),
- };
- {
- let mut hsplit = HSplit::default().split(&mut mutable);
- hsplit.draw_mut(&mut canvas).unwrap();
- }
- assert_eq!(Called::Mut, *mutable.called.lock().unwrap());
-
- let mut mutable = Drawn {
- called: Mutex::new(Called::No),
- };
- {
- let mut vsplit = VSplit::default().split(&mut mutable);
- vsplit.draw_mut(&mut canvas).unwrap();
- }
- assert_eq!(Called::Mut, *mutable.called.lock().unwrap());
-
- let immutable = Drawn {
- called: Mutex::new(Called::No),
- };
- let hsplit = HSplit::default().split(&immutable);
- hsplit.draw(&mut canvas).unwrap();
- assert_eq!(Called::Immut, *immutable.called.lock().unwrap());
- let immutable = Drawn {
- called: Mutex::new(Called::No),
- };
- let vsplit = VSplit::default().split(&immutable);
- vsplit.draw(&mut canvas).unwrap();
- assert_eq!(Called::Immut, *immutable.called.lock().unwrap());
- }
-}
diff --git a/vendor/skim-tuikit/src/widget/stack.rs b/vendor/skim-tuikit/src/widget/stack.rs
deleted file mode 100644
index 80fd30673..000000000
--- a/vendor/skim-tuikit/src/widget/stack.rs
+++ /dev/null
@@ -1,222 +0,0 @@
-use crate::canvas::Canvas;
-use crate::draw::{Draw, DrawResult};
-use crate::event::Event;
-use crate::widget::{Rectangle, Widget};
-
-/// A stack of widgets, will draw the including widgets back to front
-pub struct Stack<'a, Message = ()> {
- inner: Vec<Box<dyn Widget<Message> + 'a>>,
-}
-
-impl<Message> Default for Stack<'_, Message> {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl<'a, Message> Stack<'a, Message> {
- pub fn new() -> Self {
- Self { inner: vec![] }
- }
-
- pub fn top(mut self, widget: impl Widget<Message> + 'a) -> Self {
- self.inner.push(Box::new(widget));
- self
- }
-
- pub fn bottom(mut self, widget: impl Widget<Message> + 'a) -> Self {
- self.inner.insert(0, Box::new(widget));
- self
- }
-}
-
-impl<Message> Draw for Stack<'_, Message> {
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- for widget in self.inner.iter() {
- widget.draw(canvas)?
- }
-
- Ok(())
- }
- fn draw_mut(&mut self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- for widget in self.inner.iter_mut() {
- widget.draw_mut(canvas)?
- }
-
- Ok(())
- }
-}
-
-impl<Message> Widget<Message> for Stack<'_, Message> {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- // max of the inner widgets
- let width = self
- .inner
- .iter()
- .map(|widget| widget.size_hint().0)
- .max()
- .unwrap_or(None);
- let height = self
- .inner
- .iter()
- .map(|widget| widget.size_hint().1)
- .max()
- .unwrap_or(None);
- (width, height)
- }
-
- fn on_event(&self, event: Event, rect: Rectangle) -> Vec<Message> {
- // like javascript's capture, from top to bottom
- for widget in self.inner.iter().rev() {
- let message = widget.on_event(event, rect);
- if !message.is_empty() {
- return message;
- }
- }
- vec![]
- }
-
- fn on_event_mut(&mut self, event: Event, rect: Rectangle) -> Vec<Message> {
- // like javascript's capture, from top to bottom
- for widget in self.inner.iter_mut().rev() {
- let message = widget.on_event_mut(event, rect);
- if !message.is_empty() {
- return message;
- }
- }
- vec![]
- }
-}
-
-#[cfg(test)]
-#[allow(dead_code)]
-mod test {
- use super::*;
- use crate::cell::Cell;
- use std::sync::Mutex;
-
- struct WinHint {
- pub width_hint: Option<usize>,
- pub height_hint: Option<usize>,
- }
-
- impl Draw for WinHint {
- fn draw(&self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- unimplemented!()
- }
- }
-
- impl Widget for WinHint {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- (self.width_hint, self.height_hint)
- }
- }
-
- #[test]
- fn size_hint() {
- let stack = Stack::new().top(WinHint {
- width_hint: None,
- height_hint: None,
- });
- assert_eq!((None, None), stack.size_hint());
-
- let stack = Stack::new().top(WinHint {
- width_hint: Some(1),
- height_hint: Some(1),
- });
- assert_eq!((Some(1), Some(1)), stack.size_hint());
-
- let stack = Stack::new()
- .top(WinHint {
- width_hint: Some(1),
- height_hint: Some(2),
- })
- .top(WinHint {
- width_hint: Some(2),
- height_hint: Some(1),
- });
- assert_eq!((Some(2), Some(2)), stack.size_hint());
-
- let stack = Stack::new()
- .top(WinHint {
- width_hint: None,
- height_hint: None,
- })
- .top(WinHint {
- width_hint: Some(2),
- height_hint: Some(1),
- });
- assert_eq!((Some(2), Some(1)), stack.size_hint());
- }
-
- #[derive(PartialEq, Debug)]
- enum Called {
- No,
- Mut,
- Immut,
- }
-
- struct Drawn {
- called: Mutex<Called>,
- }
-
- impl Draw for Drawn {
- fn draw(&self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- *self.called.lock().unwrap() = Called::Immut;
- Ok(())
- }
- fn draw_mut(&mut self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- *self.called.lock().unwrap() = Called::Mut;
- Ok(())
- }
- }
-
- impl Widget for Drawn {}
-
- #[derive(Default)]
- struct TestCanvas {}
-
- #[allow(unused_variables)]
- impl Canvas for TestCanvas {
- fn size(&self) -> crate::Result<(usize, usize)> {
- Ok((100, 100))
- }
-
- fn clear(&mut self) -> crate::Result<()> {
- unimplemented!()
- }
-
- fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> crate::Result<usize> {
- Ok(1)
- }
-
- fn set_cursor(&mut self, row: usize, col: usize) -> crate::Result<()> {
- unimplemented!()
- }
-
- fn show_cursor(&mut self, show: bool) -> crate::Result<()> {
- unimplemented!()
- }
- }
-
- #[test]
- fn mutable_widget() {
- let mut canvas = TestCanvas::default();
-
- let mut mutable = Drawn {
- called: Mutex::new(Called::No),
- };
- {
- let mut stack = Stack::new().top(&mut mutable);
- stack.draw_mut(&mut canvas).unwrap();
- }
- assert_eq!(Called::Mut, *mutable.called.lock().unwrap());
-
- let immutable = Drawn {
- called: Mutex::new(Called::No),
- };
- let stack = Stack::new().top(&immutable);
- stack.draw(&mut canvas).unwrap();
- assert_eq!(Called::Immut, *immutable.called.lock().unwrap());
- }
-}
diff --git a/vendor/skim-tuikit/src/widget/util.rs b/vendor/skim-tuikit/src/widget/util.rs
deleted file mode 100644
index fcb390776..000000000
--- a/vendor/skim-tuikit/src/widget/util.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-use crate::event::Event;
-use crate::key::Key;
-use crate::widget::Rectangle;
-
-pub fn adjust_event(event: Event, inner_rect: Rectangle) -> Option<Event> {
- match event {
- Event::Key(Key::MousePress(button, row, col)) => {
- if inner_rect.contains(row as usize, col as usize) {
- let (row, col) = inner_rect.relative_to_origin(row as usize, col as usize);
- Some(Event::Key(Key::MousePress(button, row as u16, col as u16)))
- } else {
- None
- }
- }
- Event::Key(Key::MouseRelease(row, col)) => {
- if inner_rect.contains(row as usize, col as usize) {
- let (row, col) = inner_rect.relative_to_origin(row as usize, col as usize);
- Some(Event::Key(Key::MouseRelease(row as u16, col as u16)))
- } else {
- None
- }
- }
- Event::Key(Key::MouseHold(row, col)) => {
- if inner_rect.contains(row as usize, col as usize) {
- let (row, col) = inner_rect.relative_to_origin(row as usize, col as usize);
- Some(Event::Key(Key::MouseHold(row as u16, col as u16)))
- } else {
- None
- }
- }
- Event::Key(Key::SingleClick(button, row, col)) => {
- if inner_rect.contains(row as usize, col as usize) {
- let (row, col) = inner_rect.relative_to_origin(row as usize, col as usize);
- Some(Event::Key(Key::SingleClick(button, row as u16, col as u16)))
- } else {
- None
- }
- }
- Event::Key(Key::DoubleClick(button, row, col)) => {
- if inner_rect.contains(row as usize, col as usize) {
- let (row, col) = inner_rect.relative_to_origin(row as usize, col as usize);
- Some(Event::Key(Key::DoubleClick(button, row as u16, col as u16)))
- } else {
- None
- }
- }
- Event::Key(Key::WheelDown(row, col, count)) => {
- if inner_rect.contains(row as usize, col as usize) {
- let (row, col) = inner_rect.relative_to_origin(row as usize, col as usize);
- Some(Event::Key(Key::WheelDown(row as u16, col as u16, count)))
- } else {
- None
- }
- }
- Event::Key(Key::WheelUp(row, col, count)) => {
- if inner_rect.contains(row as usize, col as usize) {
- let (row, col) = inner_rect.relative_to_origin(row as usize, col as usize);
- Some(Event::Key(Key::WheelUp(row as u16, col as u16, count)))
- } else {
- None
- }
- }
- ev => Some(ev),
- }
-}
diff --git a/vendor/skim-tuikit/src/widget/win.rs b/vendor/skim-tuikit/src/widget/win.rs
deleted file mode 100644
index f49009ac9..000000000
--- a/vendor/skim-tuikit/src/widget/win.rs
+++ /dev/null
@@ -1,736 +0,0 @@
-use super::Size;
-use super::split::Split;
-use super::util::adjust_event;
-use super::{Rectangle, Widget};
-use crate::attr::Attr;
-use crate::canvas::{BoundedCanvas, Canvas};
-use crate::cell::Cell;
-use crate::draw::{Draw, DrawResult};
-use crate::event::Event;
-use crate::widget::align::{AlignSelf, HorizontalAlign};
-use crate::{ok_or_return, some_or_return};
-use std::cmp::max;
-use unicode_width::UnicodeWidthStr;
-
-type FnDrawHeader = dyn Fn(&mut dyn Canvas) -> DrawResult<()>;
-
-/// A Win is like a div in HTML, it has its margin/padding, and border
-pub struct Win<'a, Message = ()> {
- margin_top: Size,
- margin_right: Size,
- margin_bottom: Size,
- margin_left: Size,
-
- padding_top: Size,
- padding_right: Size,
- padding_bottom: Size,
- padding_left: Size,
-
- border_top: bool,
- border_right: bool,
- border_bottom: bool,
- border_left: bool,
-
- border_top_attr: Attr,
- border_right_attr: Attr,
- border_bottom_attr: Attr,
- border_left_attr: Attr,
-
- fn_draw_header: Option<Box<FnDrawHeader>>,
- title: Option<String>,
- title_attr: Attr,
- right_prompt: Option<String>,
- right_prompt_attr: Attr,
- title_align: HorizontalAlign,
- title_on_top: bool,
-
- basis: Size,
- grow: usize,
- shrink: usize,
-
- inner: Box<dyn Widget<Message> + 'a>,
-}
-
-// Builder
-impl<'a, Message> Win<'a, Message> {
- pub fn new(widget: impl Widget<Message> + 'a) -> Self {
- Self {
- margin_top: Default::default(),
- margin_right: Default::default(),
- margin_bottom: Default::default(),
- margin_left: Default::default(),
- padding_top: Default::default(),
- padding_right: Default::default(),
- padding_bottom: Default::default(),
- padding_left: Default::default(),
- border_top: false,
- border_right: false,
- border_bottom: false,
- border_left: false,
- border_top_attr: Default::default(),
- border_right_attr: Default::default(),
- border_bottom_attr: Default::default(),
- border_left_attr: Default::default(),
- fn_draw_header: None,
- title: None,
- title_attr: Default::default(),
- right_prompt: None,
- right_prompt_attr: Default::default(),
- title_align: HorizontalAlign::Left,
- title_on_top: true,
- basis: Size::Default,
- grow: 1,
- shrink: 1,
- inner: Box::new(widget),
- }
- }
-
- pub fn margin_top(mut self, margin_top: impl Into<Size>) -> Self {
- self.margin_top = margin_top.into();
- self
- }
-
- pub fn margin_right(mut self, margin_right: impl Into<Size>) -> Self {
- self.margin_right = margin_right.into();
- self
- }
-
- pub fn margin_bottom(mut self, margin_bottom: impl Into<Size>) -> Self {
- self.margin_bottom = margin_bottom.into();
- self
- }
-
- pub fn margin_left(mut self, margin_left: impl Into<Size>) -> Self {
- self.margin_left = margin_left.into();
- self
- }
-
- pub fn margin(mut self, margin: impl Into<Size>) -> Self {
- let margin = margin.into();
- self.margin_top = margin;
- self.margin_right = margin;
- self.margin_bottom = margin;
- self.margin_left = margin;
- self
- }
-
- pub fn padding_top(mut self, padding_top: impl Into<Size>) -> Self {
- self.padding_top = padding_top.into();
- self
- }
-
- pub fn padding_right(mut self, padding_right: impl Into<Size>) -> Self {
- self.padding_right = padding_right.into();
- self
- }
-
- pub fn padding_bottom(mut self, padding_bottom: impl Into<Size>) -> Self {
- self.padding_bottom = padding_bottom.into();
- self
- }
-
- pub fn padding_left(mut self, padding_left: impl Into<Size>) -> Self {
- self.padding_left = padding_left.into();
- self
- }
-
- pub fn padding(mut self, padding: impl Into<Size>) -> Self {
- let padding = padding.into();
- self.padding_top = padding;
- self.padding_right = padding;
- self.padding_bottom = padding;
- self.padding_left = padding;
- self
- }
-
- pub fn border_top(mut self, border_top: bool) -> Self {
- self.border_top = border_top;
- self
- }
-
- pub fn border_right(mut self, border_right: bool) -> Self {
- self.border_right = border_right;
- self
- }
-
- pub fn border_bottom(mut self, border_bottom: bool) -> Self {
- self.border_bottom = border_bottom;
- self
- }
-
- pub fn border_left(mut self, border_left: bool) -> Self {
- self.border_left = border_left;
- self
- }
-
- pub fn border(mut self, border: bool) -> Self {
- self.border_top = border;
- self.border_right = border;
- self.border_bottom = border;
- self.border_left = border;
- self
- }
-
- pub fn border_top_attr(mut self, border_top_attr: impl Into<Attr>) -> Self {
- self.border_top_attr = border_top_attr.into();
- self
- }
-
- pub fn border_right_attr(mut self, border_right_attr: impl Into<Attr>) -> Self {
- self.border_right_attr = border_right_attr.into();
- self
- }
-
- pub fn border_bottom_attr(mut self, border_bottom_attr: impl Into<Attr>) -> Self {
- self.border_bottom_attr = border_bottom_attr.into();
- self
- }
-
- pub fn border_left_attr(mut self, border_left_attr: impl Into<Attr>) -> Self {
- self.border_left_attr = border_left_attr.into();
- self
- }
-
- pub fn border_attr(mut self, attr: impl Into<Attr>) -> Self {
- let attr = attr.into();
- self.border_top_attr = attr;
- self.border_right_attr = attr;
- self.border_bottom_attr = attr;
- self.border_left_attr = attr;
- self
- }
-
- pub fn fn_draw_header(mut self, fn_draw_header: Box<FnDrawHeader>) -> Self {
- self.fn_draw_header = Some(fn_draw_header);
- self
- }
-
- pub fn title(mut self, title: impl Into<String>) -> Self {
- self.title = Some(title.into());
- self
- }
-
- pub fn title_attr(mut self, title_attr: impl Into<Attr>) -> Self {
- self.title_attr = title_attr.into();
- self
- }
-
- pub fn right_prompt(mut self, right_prompt: impl Into<String>) -> Self {
- self.right_prompt = Some(right_prompt.into());
- self
- }
-
- pub fn right_prompt_attr(mut self, right_prompt_attr: impl Into<Attr>) -> Self {
- self.right_prompt_attr = right_prompt_attr.into();
- self
- }
-
- pub fn title_align(mut self, align: HorizontalAlign) -> Self {
- self.title_align = align;
- self
- }
-
- pub fn title_on_top(mut self, title_on_top: bool) -> Self {
- self.title_on_top = title_on_top;
- self
- }
-
- pub fn basis(mut self, basis: impl Into<Size>) -> Self {
- self.basis = basis.into();
- self
- }
-
- pub fn grow(mut self, grow: usize) -> Self {
- self.grow = grow;
- self
- }
-
- pub fn shrink(mut self, shrink: usize) -> Self {
- self.shrink = shrink;
- self
- }
-}
-
-impl<'a, Message> Win<'a, Message> {
- fn rect_reserve_margin(&self, rect: Rectangle) -> DrawResult<Rectangle> {
- let Rectangle { width, height, .. } = rect;
-
- let margin_top = self.margin_top.calc_fixed_size(height, 0);
- let margin_right = self.margin_right.calc_fixed_size(width, 0);
- let margin_bottom = self.margin_bottom.calc_fixed_size(height, 0);
- let margin_left = self.margin_left.calc_fixed_size(width, 0);
-
- if margin_top + margin_bottom >= height || margin_left + margin_right >= width {
- return Err("margin takes too much screen".into());
- }
-
- let top = margin_top;
- let left = margin_left;
- let width = width - (margin_left + margin_right);
- let height = height - (margin_top + margin_bottom);
- Ok(Rectangle {
- top,
- left,
- width,
- height,
- })
- }
-
- fn rect_header(&self, rect_reserve_margin: Rectangle) -> Rectangle {
- let Rectangle {
- top,
- mut left,
- width,
- height,
- } = rect_reserve_margin;
-
- let new_top = if self.title_on_top {
- top
- } else {
- max(top + height, 1) - 1
- };
-
- let height_needed = if self.title_on_top && self.border_bottom { 2 } else { 1 };
- if height_needed > height {
- // not enough space, don't draw at all
- return Rectangle {
- top: new_top,
- left,
- width,
- height: 0,
- };
- }
-
- let mut width_needed = 0;
- if self.border_left {
- width_needed += 1;
- left += 1;
- }
- if self.border_right {
- width_needed += 1;
- }
- if width_needed > width {
- return Rectangle {
- top: new_top,
- left,
- width: 0,
- height,
- };
- }
-
- Rectangle {
- top: new_top,
- left,
- width: width - width_needed,
- height: 1,
- }
- }
-
- fn rect_reserve_border(&self, rect: Rectangle) -> DrawResult<Rectangle> {
- let Rectangle {
- top,
- left,
- width,
- height,
- } = rect;
-
- // title and right prompt will be displayed on top
- let border_top =
- self.border_top || (self.title_on_top && (self.title.is_some() || self.right_prompt.is_some()));
- let border_bottom =
- self.border_bottom || (!self.title_on_top && (self.title.is_some() || self.right_prompt.is_some()));
-
- if (border_top || border_bottom) && ((height < 1) || (border_top && border_bottom && height < 2)) {
- return Err("not enough height for border".into());
- }
-
- if (self.border_left || self.border_right)
- && ((width < 1) || (self.border_left && self.border_right && width < 2))
- {
- return Err("not enough width for border".into());
- }
-
- let top = if border_top { top + 1 } else { top };
- let left = if self.border_left { left + 1 } else { left };
- let width = if self.border_left { width - 1 } else { width };
- let width = if self.border_right { width - 1 } else { width };
- let height = if border_top { height - 1 } else { height };
- let height = if border_bottom { height - 1 } else { height };
-
- Ok(Rectangle {
- top,
- left,
- width,
- height,
- })
- }
-
- fn rect_reserve_padding(&self, rect: Rectangle) -> DrawResult<Rectangle> {
- let Rectangle {
- top,
- left,
- width,
- height,
- } = rect;
-
- let padding_top = self.padding_top.calc_fixed_size(height, 0);
- let padding_right = self.padding_right.calc_fixed_size(width, 0);
- let padding_bottom = self.padding_bottom.calc_fixed_size(height, 0);
- let padding_left = self.padding_left.calc_fixed_size(width, 0);
-
- if padding_top + padding_bottom >= height || padding_left + padding_right >= width {
- return Err("padding takes too much screen, won't draw".into());
- }
-
- let top = top + padding_top;
- let left = left + padding_left;
- let width = width - (padding_left + padding_right);
- let height = height - (padding_top + padding_bottom);
- Ok(Rectangle {
- top,
- left,
- width,
- height,
- })
- }
-
- /// Calculate the inner rectangle(inside margin, border, padding)
- fn calc_inner_rect(&self, rect: Rectangle) -> DrawResult<Rectangle> {
- self.rect_reserve_padding(self.rect_reserve_border(self.rect_reserve_margin(rect)?)?)
- }
-
- /// draw border and return the position & size of the inner canvas
- /// (top, left, width, height)
- fn draw_border(&self, rect: Rectangle, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let Rectangle {
- top,
- left,
- width,
- height,
- } = rect;
-
- if (self.border_top || self.border_bottom)
- && ((height < 1) || (self.border_top && self.border_bottom && height < 2))
- {
- return Err("not enough height for border".into());
- }
-
- if (self.border_left || self.border_right)
- && ((width < 1) || (self.border_left && self.border_right && width < 2))
- {
- return Err("not enough width for border".into());
- }
-
- let bottom = max(top + height, 1) - 1;
- let right = max(left + width, 1) - 1;
-
- if self.border_top {
- let _ = canvas.print_with_attr(top, left, &"─".repeat(width), self.border_top_attr);
- }
-
- if self.border_bottom {
- let _ = canvas.print_with_attr(bottom, left, &"─".repeat(width), self.border_bottom_attr);
- }
-
- if self.border_left {
- for i in top..(top + height) {
- let _ = canvas.print_with_attr(i, left, "│", self.border_left_attr);
- }
- }
-
- if self.border_right {
- for i in top..(top + height) {
- let _ = canvas.print_with_attr(i, right, "│", self.border_right_attr);
- }
- }
-
- // draw 4 corners if necessary
-
- if self.border_top && self.border_left {
- let _ = canvas.put_cell(top, left, Cell::default().ch('┌').attribute(self.border_top_attr));
- }
-
- if self.border_top && self.border_right {
- let _ = canvas.put_cell(top, right, Cell::default().ch('┐').attribute(self.border_top_attr));
- }
-
- if self.border_bottom && self.border_left {
- let _ = canvas.put_cell(bottom, left, Cell::default().ch('└').attribute(self.border_bottom_attr));
- }
-
- if self.border_bottom && self.border_right {
- let _ = canvas.put_cell(
- bottom,
- right,
- Cell::default().ch('┘').attribute(self.border_bottom_attr),
- );
- }
-
- Ok(())
- }
-
- fn draw_title_and_prompt(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- let row = if self.title_on_top { 0 } else { max(height, 1) - 1 };
-
- if self.right_prompt.is_some() {
- let prompt = self.right_prompt.as_ref().unwrap();
- let text_width = prompt.width_cjk();
- let left = HorizontalAlign::Right.adjust(0, width, text_width);
- canvas.print_with_attr(row, left, prompt, self.right_prompt_attr)?;
- }
-
- if self.title.is_some() {
- let title = self.title.as_ref().unwrap();
- let text_width = title.width_cjk();
- let left = self.title_align.adjust(0, width, text_width);
- canvas.print_with_attr(row, left, title, self.right_prompt_attr)?;
- }
-
- Ok(())
- }
-
- fn draw_header(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let (width, height) = canvas.size()?;
- if width == 0 || height == 0 {
- return Ok(());
- }
-
- if self.fn_draw_header.is_some() {
- self.fn_draw_header.as_ref().unwrap()(canvas)?;
- } else {
- self.draw_title_and_prompt(canvas)?;
- }
-
- Ok(())
- }
-
- fn draw_context(&self, canvas: &'a mut dyn Canvas) -> DrawResult<BoundedCanvas<'a>> {
- let (width, height) = canvas.size()?;
- let outer_rect = Rectangle {
- top: 0,
- left: 0,
- width,
- height,
- };
-
- let rect_in_margin = self.rect_reserve_margin(outer_rect)?;
- self.draw_border(rect_in_margin, canvas)?;
-
- let Rectangle {
- top,
- left,
- width,
- height,
- } = self.rect_header(rect_in_margin);
- let mut header_canvas = BoundedCanvas::new(top, left, width, height, canvas);
- self.draw_header(&mut header_canvas)?;
-
- let Rectangle {
- top,
- left,
- width,
- height,
- } = self.calc_inner_rect(outer_rect)?;
-
- Ok(BoundedCanvas::new(top, left, width, height, canvas))
- }
-}
-
-impl<Message> Draw for Win<'_, Message> {
- /// Reserve margin & padding, draw border.
- fn draw(&self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let mut new_canvas = self.draw_context(canvas)?;
- self.inner.draw(&mut new_canvas)
- }
-
- fn draw_mut(&mut self, canvas: &mut dyn Canvas) -> DrawResult<()> {
- let mut new_canvas = self.draw_context(canvas)?;
- self.inner.draw_mut(&mut new_canvas)
- }
-}
-
-impl<Message> Widget<Message> for Win<'_, Message> {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- // plus border size
- let (width, height) = self.inner.size_hint();
- let width = width.map(|mut w| {
- w += if self.border_left { 1 } else { 0 };
- w += if self.border_right { 1 } else { 0 };
- w
- });
-
- let height = height.map(|mut h| {
- h += if self.border_top { 1 } else { 0 };
- h += if self.border_bottom { 1 } else { 0 };
- h
- });
-
- (width, height)
- }
-
- fn on_event(&self, event: Event, rect: Rectangle) -> Vec<Message> {
- let empty = vec![];
- let inner_rect = ok_or_return!(self.calc_inner_rect(rect), empty);
- let adjusted_event = some_or_return!(adjust_event(event, inner_rect), empty);
- self.inner.on_event(adjusted_event, inner_rect)
- }
-
- fn on_event_mut(&mut self, event: Event, rect: Rectangle) -> Vec<Message> {
- let empty = vec![];
- let inner_rect = ok_or_return!(self.calc_inner_rect(rect), empty);
- let adjusted_event = some_or_return!(adjust_event(event, inner_rect), empty);
- self.inner.on_event(adjusted_event, inner_rect)
- }
-}
-
-impl<Message> Split<Message> for Win<'_, Message> {
- fn get_basis(&self) -> Size {
- self.basis
- }
-
- fn get_grow(&self) -> usize {
- self.grow
- }
-
- fn get_shrink(&self) -> usize {
- self.shrink
- }
-}
-
-#[cfg(test)]
-#[allow(dead_code)]
-mod test {
- use super::*;
- use std::sync::Mutex;
-
- struct WinHint {
- pub width_hint: Option<usize>,
- pub height_hint: Option<usize>,
- }
-
- impl Draw for WinHint {
- fn draw(&self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- unimplemented!()
- }
- }
-
- impl Widget for WinHint {
- fn size_hint(&self) -> (Option<usize>, Option<usize>) {
- (self.width_hint, self.height_hint)
- }
- }
-
- #[test]
- fn size_hint_for_window_should_include_border() {
- let inner = WinHint {
- width_hint: None,
- height_hint: None,
- };
- let win_border_top = Win::new(&inner).border_top(true);
- assert_eq!((None, None), win_border_top.size_hint());
- let win_border_right = Win::new(&inner).border_right(true);
- assert_eq!((None, None), win_border_right.size_hint());
- let win_border_bottom = Win::new(&inner).border_bottom(true);
- assert_eq!((None, None), win_border_bottom.size_hint());
- let win_border_left = Win::new(&inner).border_left(true);
- assert_eq!((None, None), win_border_left.size_hint());
-
- let inner = WinHint {
- width_hint: Some(1),
- height_hint: None,
- };
- let win_border_top = Win::new(&inner).border_top(true);
- assert_eq!((Some(1), None), win_border_top.size_hint());
- let win_border_right = Win::new(&inner).border_right(true);
- assert_eq!((Some(2), None), win_border_right.size_hint());
- let win_border_bottom = Win::new(&inner).border_bottom(true);
- assert_eq!((Some(1), None), win_border_bottom.size_hint());
- let win_border_left = Win::new(&inner).border_left(true);
- assert_eq!((Some(2), None), win_border_left.size_hint());
-
- let inner = WinHint {
- width_hint: None,
- height_hint: Some(1),
- };
- let win_border_top = Win::new(&inner).border_top(true);
- assert_eq!((None, Some(2)), win_border_top.size_hint());
- let win_border_right = Win::new(&inner).border_right(true);
- assert_eq!((None, Some(1)), win_border_right.size_hint());
- let win_border_bottom = Win::new(&inner).border_bottom(true);
- assert_eq!((None, Some(2)), win_border_bottom.size_hint());
- let win_border_left = Win::new(&inner).border_left(true);
- assert_eq!((None, Some(1)), win_border_left.size_hint());
- }
-
- #[derive(PartialEq, Debug)]
- enum Called {
- No,
- Mut,
- Immut,
- }
-
- struct Drawn {
- called: Mutex<Called>,
- }
-
- impl Draw for Drawn {
- fn draw(&self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- *self.called.lock().unwrap() = Called::Immut;
- Ok(())
- }
- fn draw_mut(&mut self, _canvas: &mut dyn Canvas) -> DrawResult<()> {
- *self.called.lock().unwrap() = Called::Mut;
- Ok(())
- }
- }
-
- impl Widget for Drawn {}
-
- #[derive(Default)]
- struct TestCanvas {}
-
- #[allow(unused_variables)]
- impl Canvas for TestCanvas {
- fn size(&self) -> crate::Result<(usize, usize)> {
- Ok((100, 100))
- }
-
- fn clear(&mut self) -> crate::Result<()> {
- unimplemented!()
- }
-
- fn put_cell(&mut self, row: usize, col: usize, cell: Cell) -> crate::Result<usize> {
- Ok(1)
- }
-
- fn set_cursor(&mut self, row: usize, col: usize) -> crate::Result<()> {
- unimplemented!()
- }
-
- fn show_cursor(&mut self, show: bool) -> crate::Result<()> {
- unimplemented!()
- }
- }
-
- #[test]
- fn mutable_widget() {
- let mut canvas = TestCanvas::default();
-
- let mut mutable = Drawn {
- called: Mutex::new(Called::No),
- };
- {
- let mut win = Win::new(&mut mutable);
- win.draw_mut(&mut canvas).unwrap();
- }
- assert_eq!(Called::Mut, *mutable.called.lock().unwrap());
-
- let immutable = Drawn {
- called: Mutex::new(Called::No),
- };
- let win = Win::new(&immutable);
- win.draw(&mut canvas).unwrap();
- assert_eq!(Called::Immut, *immutable.called.lock().unwrap());
- }
-}