Compare commits

..

2 Commits

Author SHA1 Message Date
itsjunetime d8e789627c Update deps 2026-01-31 17:02:55 -06:00
itsjunetime 51120a16fe Pin ratatui and ratatui-image deps 2026-01-29 19:15:49 -06:00
13 changed files with 146 additions and 292 deletions
+11 -77
View File
@@ -3,56 +3,31 @@ name: Rust
on:
push:
branches: [ "main" ]
tags: ["v*.*.*"]
pull_request:
branches: [ "main" ]
workflow_dispatch:
workflow_call:
env:
CARGO_TERM_COLOR: always
jobs:
test-build:
strategy:
fail-fast: false
matrix:
include:
- { os: "macos-latest", target: "aarch64-apple-darwin" }
- { os: "ubuntu-latest", target: "x86_64-unknown-linux-gnu" }
- {
os: "windows-latest",
target: "x86_64-pc-windows-msvc",
ext: ".exe",
}
- { os: "ubuntu-24.04-arm", target: "aarch64-unknown-linux-gnu" }
build:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup sccache
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
uses: mozilla-actions/sccache-action@v0.0.8
- name: Configure sccache
if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
run: |
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
- name: Setup rust cache action
uses: swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: install build dependencies on ubuntu and cache
if: contains(matrix.os, 'ubuntu')
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libfontconfig1-dev libgoogle-perftools-dev google-perftools
version: latest # could be anything
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev libgoogle-perftools-dev google-perftools
- uses: actions/checkout@v4
- name: Install clippy and fmt
run: rustup component add clippy rustfmt
- name: Clippy
@@ -63,46 +38,5 @@ jobs:
run: cargo fmt -- --check
- name: Run benchmarks as tests
run: cargo test --locked --benches -- adobe_example
- name: Set build mode
shell: bash
run: if [ "${{github.ref_type}}" == "tag" ] || [ ${{ github.event_name == 'push' && github.ref_name == 'main' }} ]; then echo "BMODE=production">>"$GITHUB_ENV"; fi
- name: Build in ${{env.BMODE || 'debug'}} mode
run: cargo build --verbose --locked --profile ${{env.BMODE || 'dev'}}
- name: Prepare artifact
shell: bash
run: |
mkdir -p dist
cp "target/${{env.BMODE || 'debug'}}/tdf${{ matrix.ext }}" dist/tdf-${{ matrix.target }}${{ matrix.ext }}
tree dist || ls -la dist
- name: Upload artifacts
uses: actions/upload-artifact@v5
with:
name: tdf-${{ matrix.target }}
path: dist/tdf*
tag-release:
name: Release on tag push
runs-on: ubuntu-slim
if: github.ref_type == 'tag'
needs: test-build
steps:
- uses: actions/download-artifact@v6
with:
pattern: "**/tdf-*"
path: release-artifacts
merge-multiple: true
- name: What's up?
run: tree release-artifacts # beautiful!
- name: Create a GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: release-artifacts/*
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
- name: Build
run: cargo build --locked
-2
View File
@@ -1,8 +1,6 @@
# Unreleased
- Added windows support! (thank you to [@jarjk](https://github.com/jarjk) for helping out!)
- Added keybindings (`0`/`$`) to scroll to left or right side of zoomed-in image ([#131](https://github.com/itsjunetime/tdf/pull/131), thank you [@IshDeshpa](https://github.com/IshDeshpa)!)
- (Internal) decreased runtime footprint of tokio runtime
# v0.5.0
Generated
+71 -70
View File
@@ -82,9 +82,9 @@ checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
[[package]]
name = "anyhow"
version = "1.0.101"
version = "1.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea"
checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61"
[[package]]
name = "arbitrary"
@@ -177,9 +177,9 @@ dependencies = [
[[package]]
name = "avif-serialize"
version = "0.8.8"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375082f007bd67184fb9c0374614b29f9aaa604ec301635f72338bb65386a53d"
checksum = "47c8fbc0f831f4519fe8b810b6a7a91410ec83031b8233f730a0480029f6a23f"
dependencies = [
"arrayvec",
]
@@ -341,9 +341,9 @@ checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06"
[[package]]
name = "bytemuck"
version = "1.25.0"
version = "1.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4"
dependencies = [
"bytemuck_derive",
]
@@ -373,9 +373,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
[[package]]
name = "bytes"
version = "1.11.1"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
[[package]]
name = "cast"
@@ -394,9 +394,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.55"
version = "1.2.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"
checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583"
dependencies = [
"find-msvc-tools",
"jobserver",
@@ -476,18 +476,18 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.58"
version = "4.5.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806"
checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e"
dependencies = [
"clap_builder",
]
[[package]]
name = "clap_builder"
version = "4.5.58"
version = "4.5.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2"
checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0"
dependencies = [
"anstyle",
"clap_lex",
@@ -495,9 +495,9 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "1.0.0"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831"
checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
[[package]]
name = "compact_str"
@@ -645,9 +645,9 @@ dependencies = [
[[package]]
name = "criterion"
version = "0.8.2"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3"
checksum = "4d883447757bb0ee46f233e9dc22eb84d93a9508c9b868687b274fc431d886bf"
dependencies = [
"alloca",
"anes",
@@ -671,9 +671,9 @@ dependencies = [
[[package]]
name = "criterion-plot"
version = "0.8.2"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea"
checksum = "ed943f81ea2faa8dcecbbfa50164acf95d555afec96a27871663b300e387b2e4"
dependencies = [
"cast",
"itertools 0.13.0",
@@ -749,9 +749,9 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5"
[[package]]
name = "csscolorparser"
version = "0.8.2"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64a878cfd6075649977f548ed439564cfdbe1f190a6656a00b48af7740f2f148"
checksum = "02ee6eae4d99456f92dc379ba21cf08f783ef5525f193c3854b4e921ece045c5"
dependencies = [
"num-traits",
]
@@ -799,9 +799,9 @@ checksum = "7f2e5bc95e82bd8e9b333f4c5ff6dceab54e2e99f4d8cef2a680d417206ead34"
[[package]]
name = "deranged"
version = "0.5.6"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc3dc5ad92c2e2d1c193bbbbdf2ea477cb81331de4f3103f267ca18368b988c4"
checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587"
dependencies = [
"powerfmt",
]
@@ -963,9 +963,9 @@ dependencies = [
[[package]]
name = "find-msvc-tools"
version = "0.1.9"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db"
[[package]]
name = "fixedstr"
@@ -975,9 +975,9 @@ checksum = "75a7e79cc11f1195d9e07bd11509e1d75b51e1f48ddff52f54a25815b4abbde3"
[[package]]
name = "flate2"
version = "1.1.9"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369"
dependencies = [
"crc32fast",
"miniz_oxide",
@@ -1326,12 +1326,13 @@ dependencies = [
[[package]]
name = "hyper-util"
version = "0.1.20"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f"
dependencies = [
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"http",
"http-body",
@@ -1526,9 +1527,9 @@ dependencies = [
[[package]]
name = "kittage"
version = "0.3.4"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60c7c5cd12fa1b81b892fe06e04daa9e58ccd8993693378e8c1792aa0a4245fd"
checksum = "be6b61789e2841119b210569d4acd950d47dae805f8d3235190d28cb40677632"
dependencies = [
"base64-simd",
"crossterm",
@@ -1584,9 +1585,9 @@ checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
[[package]]
name = "libfuzzer-sys"
version = "0.4.12"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f12a681b7dd8ce12bff52488013ba614b869148d54dd79836ab85aafdd53f08d"
checksum = "5037190e1f70cbeef565bd267599242926f724d3b8a9f510fd7e0b540cfa4404"
dependencies = [
"arbitrary",
"cc",
@@ -1709,9 +1710,9 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.8.0"
version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
[[package]]
name = "memmap2"
@@ -1786,8 +1787,8 @@ dependencies = [
[[package]]
name = "mupdf"
version = "0.6.0"
source = "git+https://github.com/messense/mupdf-rs.git?rev=d7441b9998c92135e329559c0aa71d9dc92cf4de#d7441b9998c92135e329559c0aa71d9dc92cf4de"
version = "0.5.0"
source = "git+https://github.com/messense/mupdf-rs.git?rev=2e0fae910fac8048c7008211fc4d3b9f5d227a07#2e0fae910fac8048c7008211fc4d3b9f5d227a07"
dependencies = [
"bitflags 2.10.0",
"font-kit",
@@ -1798,8 +1799,8 @@ dependencies = [
[[package]]
name = "mupdf-sys"
version = "0.6.0"
source = "git+https://github.com/messense/mupdf-rs.git?rev=d7441b9998c92135e329559c0aa71d9dc92cf4de#d7441b9998c92135e329559c0aa71d9dc92cf4de"
version = "0.5.0"
source = "git+https://github.com/messense/mupdf-rs.git?rev=2e0fae910fac8048c7008211fc4d3b9f5d227a07#2e0fae910fac8048c7008211fc4d3b9f5d227a07"
dependencies = [
"bindgen",
"cc",
@@ -2171,9 +2172,9 @@ dependencies = [
[[package]]
name = "portable-atomic"
version = "1.13.1"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950"
[[package]]
name = "powerfmt"
@@ -2357,7 +2358,7 @@ dependencies = [
[[package]]
name = "ratatui"
version = "0.30.0"
source = "git+https://github.com/itsjunetime/ratatui.git?rev=720ac2d0cad1ac6424364fea74856fec9c100cb1#720ac2d0cad1ac6424364fea74856fec9c100cb1"
source = "git+https://github.com/itsjunetime/ratatui.git?rev=4209a4e7e8bff298d8f18c220eb29423c293177b#4209a4e7e8bff298d8f18c220eb29423c293177b"
dependencies = [
"instability",
"ratatui-core",
@@ -2368,7 +2369,7 @@ dependencies = [
[[package]]
name = "ratatui-core"
version = "0.1.0"
source = "git+https://github.com/itsjunetime/ratatui.git?rev=720ac2d0cad1ac6424364fea74856fec9c100cb1#720ac2d0cad1ac6424364fea74856fec9c100cb1"
source = "git+https://github.com/itsjunetime/ratatui.git?rev=4209a4e7e8bff298d8f18c220eb29423c293177b#4209a4e7e8bff298d8f18c220eb29423c293177b"
dependencies = [
"bitflags 2.10.0",
"compact_str",
@@ -2387,7 +2388,7 @@ dependencies = [
[[package]]
name = "ratatui-crossterm"
version = "0.1.0"
source = "git+https://github.com/itsjunetime/ratatui.git?rev=720ac2d0cad1ac6424364fea74856fec9c100cb1#720ac2d0cad1ac6424364fea74856fec9c100cb1"
source = "git+https://github.com/itsjunetime/ratatui.git?rev=4209a4e7e8bff298d8f18c220eb29423c293177b#4209a4e7e8bff298d8f18c220eb29423c293177b"
dependencies = [
"cfg-if",
"crossterm",
@@ -2397,8 +2398,8 @@ dependencies = [
[[package]]
name = "ratatui-image"
version = "10.0.5"
source = "git+https://github.com/itsjunetime/ratatui-image.git?rev=a276a87cb8e2976442c6cc59db831db81551da89#a276a87cb8e2976442c6cc59db831db81551da89"
version = "10.0.4"
source = "git+https://github.com/itsjunetime/ratatui-image.git?rev=cd865215737d18980379b69d20918d22f6357dda#cd865215737d18980379b69d20918d22f6357dda"
dependencies = [
"base64-simd",
"icy_sixel",
@@ -2412,7 +2413,7 @@ dependencies = [
[[package]]
name = "ratatui-widgets"
version = "0.3.0"
source = "git+https://github.com/itsjunetime/ratatui.git?rev=720ac2d0cad1ac6424364fea74856fec9c100cb1#720ac2d0cad1ac6424364fea74856fec9c100cb1"
source = "git+https://github.com/itsjunetime/ratatui.git?rev=4209a4e7e8bff298d8f18c220eb29423c293177b#4209a4e7e8bff298d8f18c220eb29423c293177b"
dependencies = [
"bitflags 2.10.0",
"hashbrown",
@@ -2539,9 +2540,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.12.3"
version = "1.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
dependencies = [
"aho-corasick",
"memchr",
@@ -2551,9 +2552,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.14"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
dependencies = [
"aho-corasick",
"memchr",
@@ -2562,9 +2563,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.9"
version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
[[package]]
name = "rgb"
@@ -2614,9 +2615,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "ryu"
version = "1.0.23"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984"
[[package]]
name = "safe_arch"
@@ -2754,9 +2755,9 @@ dependencies = [
[[package]]
name = "slab"
version = "0.4.12"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
[[package]]
name = "smallvec"
@@ -3110,9 +3111,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "unicode-ident"
version = "1.0.23"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e"
checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
[[package]]
name = "unicode-segmentation"
@@ -3133,9 +3134,9 @@ dependencies = [
[[package]]
name = "unicode-width"
version = "0.2.2"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c"
[[package]]
name = "v_frame"
@@ -3535,9 +3536,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"
[[package]]
name = "winmmf"
version = "0.6.2"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "859506e40270a5938da41bb216376bae2e681ed8027392bddc068d62d74243f8"
checksum = "71505e812c82834e7a5a31481592e5c244d7f9177a28fb88817dfa8360b40021"
dependencies = [
"fixedstr",
"microseh",
@@ -3603,18 +3604,18 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.8.39"
version = "0.8.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"
checksum = "dafd85c832c1b68bbb4ec0c72c7f6f4fc5179627d2bc7c26b30e4c0cc11e76cc"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.39"
version = "0.8.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"
checksum = "7cb7e4e8436d9db52fbd6625dbf2f45243ab84994a72882ec8227b99e72b439a"
dependencies = [
"proc-macro2",
"quote",
@@ -3623,9 +3624,9 @@ dependencies = [
[[package]]
name = "zmij"
version = "1.0.20"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4de98dfa5d5b7fef4ee834d0073d560c9ca7b6c46a71d058c48db7960f8cfaf7"
checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439"
[[package]]
name = "zune-inflate"
+4 -4
View File
@@ -23,10 +23,10 @@ name = "tdf"
[dependencies]
# we're using this branch because it has significant performance fixes that I'm waiting on responses from the upstream devs to get upstreamed. See https://github.com/ratatui-org/ratatui/issues/1116
ratatui = { git = "https://github.com/itsjunetime/ratatui.git", rev = "720ac2d0cad1ac6424364fea74856fec9c100cb1", default-features = false, features = [ "crossterm", "layout-cache" ] }
ratatui = { git = "https://github.com/itsjunetime/ratatui.git", rev = "4209a4e7e8bff298d8f18c220eb29423c293177b", default-features = false, features = [ "crossterm", "layout-cache" ] }
# ratatui = { path = "./ratatui/ratatui/" }
# We're using this to have the vb64 feature (for faster base64 encoding, since that does take up a good bit of time when converting images to the `Protocol`. It also just includes a few more features that I'm waiting on main to upstream
ratatui-image = { git = "https://github.com/itsjunetime/ratatui-image.git", rev = "a276a87cb8e2976442c6cc59db831db81551da89", default-features = false }
ratatui-image = { git = "https://github.com/itsjunetime/ratatui-image.git", rev = "cd865215737d18980379b69d20918d22f6357dda", default-features = false }
# ratatui-image = { path = "./ratatui-image", default-features = false }
crossterm = { version = "0.29.0", features = ["event-stream"] }
# crossterm = { path = "../crossterm", features = ["event-stream"] }
@@ -38,10 +38,10 @@ flume = { version = "0.12.0", default-features = false, features = ["async"] }
xflags = "0.4.0-pre.2"
mimalloc = "0.1.43"
nix = { version = "0.31.0", features = ["signal"] }
mupdf = { git = "https://github.com/messense/mupdf-rs.git", rev = "d7441b9998c92135e329559c0aa71d9dc92cf4de", default-features = false, features = ["svg", "system-fonts", "img"] }
mupdf = { git = "https://github.com/messense/mupdf-rs.git", rev = "2e0fae910fac8048c7008211fc4d3b9f5d227a07", default-features = false, features = ["svg", "system-fonts", "img"] }
rayon = { version = "1", default-features = false }
# kittage = { path = "../kittage/", features = ["crossterm-tokio", "image-crate", "log"] }
kittage = { version = "0.3.4", features = ["crossterm-tokio", "image-crate", "log"] }
kittage = { version = "0.1.1", features = ["crossterm-tokio", "image-crate", "log"] }
memmap2 = "0"
csscolorparser = { version = "0.8.0", default-features = false }
debounce = "0.2.2"
+1 -6
View File
@@ -34,12 +34,7 @@ fn for_all_combos(
name: &'static str,
mut f: impl FnMut(&Runtime, BenchmarkId, &'static str, ProtocolType)
) {
let rt = tokio::runtime::Builder::new_multi_thread()
.worker_threads(3)
.enable_time()
.build()
.unwrap();
let rt = tokio::runtime::Runtime::new().unwrap();
for proto in PROTOS {
for file in FILES {
f(
+1 -1
Submodule ratatui updated: 720ac2d0ca...4209a4e7e8
+14 -25
View File
@@ -1,12 +1,11 @@
use std::{
io::Cursor,
num::NonZeroUsize,
time::{SystemTime, UNIX_EPOCH}
};
use flume::{Receiver, SendError, Sender, TryRecvError};
use futures_util::stream::StreamExt as _;
use image::{DynamicImage, codecs::pnm::PnmDecoder};
use image::DynamicImage;
use kittage::{NumberOrId, action::NONZERO_ONE};
use ratatui::layout::Rect;
use ratatui_image::{
@@ -112,26 +111,22 @@ pub async fn run_conversion_loop(
return Ok(None);
};
let decoder = PnmDecoder::new(Cursor::new(&page_info.img_data.pixels)).map_err(|e| {
RenderError::Converting(format!(
"The image data provided from mupdf was not in pnm format ({e}); don't know how to convert"
))
})?;
// The image we get should always already be `ImageRgb8`, so this `into` shouldn't do any
// conversions or anything, but just in case some underlying detail of mupdf or image
// changes, we do the `into` instead of just `match + unreachable!()` to avoid panicking
let mut dyn_img = DynamicImage::from_decoder(decoder)
.map_err(|e| RenderError::Converting(format!("Can't load image: {e}")))?
.into_rgb8();
let mut dyn_img = image::load_from_memory_with_format(
&page_info.img_data.pixels,
image::ImageFormat::Pnm
)
.map_err(|e| RenderError::Converting(format!("Can't load image: {e}")))?;
match dyn_img {
DynamicImage::ImageRgb8(ref mut img) =>
for quad in &*page_info.result_rects {
dyn_img
.par_enumerate_pixels_mut()
img.par_enumerate_pixels_mut()
.filter(|(x, y, _)| {
*x > quad.ul_x && *x < quad.lr_x && *y > quad.ul_y && *y < quad.lr_y
})
.for_each(|(_, _, px)| px.0[2] = px.0[2].saturating_sub(u8::MAX / 2));
},
_ => unreachable!()
}
let img_area = Rect {
@@ -141,8 +136,6 @@ pub async fn run_conversion_loop(
y: 0
};
let dyn_img = DynamicImage::ImageRgb8(dyn_img);
let txt_img = match picker.protocol_type() {
ProtocolType::Kitty => {
let rn = SystemTime::now()
@@ -151,13 +144,9 @@ pub async fn run_conversion_loop(
.as_nanos() % 1_000_000;
let mut img = if shms_work {
let shm_name = format!("/tdf_{pid}_{rn}_{page_num}");
#[cfg(unix)]
let shm_name = &*shm_name;
kittage::image::Image::shm_from(dyn_img, shm_name).map_err(|e| {
RenderError::Converting(format!("Couldn't create shm: {e:?}"))
kittage::image::Image::shm_from(dyn_img, &format!("/tdf_{pid}_{rn}_{page_num}"))
.map_err(|e| {
RenderError::Converting(format!("Couldn't write to shm: {e:?}"))
})?
} else {
kittage::image::Image::from(dyn_img)
+1 -6
View File
@@ -78,12 +78,7 @@ pub async fn run_action<'es>(
pub async fn do_shms_work(ev_stream: &mut EventStream) -> bool {
let img = DynamicImage::new_rgb8(1, 1);
let pid = std::process::id();
let shm_name = format!("tdf_test_{pid}");
#[cfg(unix)]
let shm_name = &*shm_name;
let Ok(mut k_img) = kittage::image::Image::shm_from(img, shm_name) else {
let Ok(mut k_img) = kittage::image::Image::shm_from(img, &format!("tdf_test_{pid}")) else {
return false;
};
+1 -1
View File
@@ -42,7 +42,7 @@ pub fn scale_img_for_area(
// and get the ratio that this page would have to be scaled by to fit perfectly within the
// area provided to us.
// we do this first by comparing the aspect ratio of the page with the aspect ratio of the
// we do this first by comparing the aspec ratio of the page with the aspect ratio of the
// area to fit it within. If the aspect ratio of the page is larger, then we need to scale
// the width of the page to fill perfectly within the height of the area. Otherwise, we
// scale the height to fit perfectly. The dimension that _is not_ scaled to fit perfectly
+2 -10
View File
@@ -70,18 +70,11 @@ fn reset_term() {
);
}
fn main() -> Result<(), WrappedErr> {
let rt = tokio::runtime::Builder::new_multi_thread()
.worker_threads(3)
.enable_time()
.build()
.unwrap();
rt.block_on(async move {
#[tokio::main]
async fn main() -> Result<(), WrappedErr> {
let result = inner_main().await;
reset_term();
result
})
}
async fn inner_main() -> Result<(), WrappedErr> {
@@ -408,7 +401,6 @@ async fn enter_redraw_loop(
},
InputAction::Search(term) => to_renderer.send(RenderNotif::Search(term))?,
InputAction::Invert => to_renderer.send(RenderNotif::Invert)?,
InputAction::Rotate => to_renderer.send(RenderNotif::Rotate)?,
InputAction::Fullscreen => fullscreen = !fullscreen,
InputAction::SwitchRenderZoom(f_or_f) => {
to_renderer.send(RenderNotif::SwitchFitOrFill(f_or_f)).unwrap();
+4 -47
View File
@@ -20,8 +20,7 @@ pub enum RenderNotif {
Search(String),
SwitchFitOrFill(FitOrFill),
Reload,
Invert,
Rotate
Invert
}
#[derive(Debug)]
@@ -38,14 +37,6 @@ pub enum RenderInfo {
Reloaded
}
#[derive(Debug, Copy, Clone)]
pub enum RotateDirection {
Deg0,
Deg90,
Deg180,
Deg270
}
#[derive(Clone)]
pub struct PageInfo {
pub img_data: ImageData,
@@ -107,21 +98,13 @@ pub fn start_rendering(
let mut stored_doc = None;
let mut invert = false;
let mut rotate = RotateDirection::Deg0;
let mut preserved_area = None;
let mut fit_or_fill = FitOrFill::Fit;
let mut need_rerender = VecDeque::new();
#[cfg(windows)]
let path = path.to_string_lossy();
'reload: loop {
// Need to do this weird borrow thing so that we convert `Cow<'_, str>` -> `&str` on windows
// and keep unix a `&Path` -> `&Path` 'cause there are different requirements within mupdf
// about file paths per-platform
#[cfg_attr(unix, expect(clippy::borrow_deref_ref))]
let doc = match Document::open(&*path) {
let doc = match Document::open(path) {
Err(e) => {
// if there's an error, tell the main loop
sender.send(Err(RenderError::Doc(e)))?;
@@ -255,18 +238,6 @@ pub fn start_rendering(
}
continue 'render_pages;
}
RenderNotif::Rotate => {
rotate = match rotate {
RotateDirection::Deg0 => RotateDirection::Deg90,
RotateDirection::Deg90 => RotateDirection::Deg180,
RotateDirection::Deg180 => RotateDirection::Deg270,
RotateDirection::Deg270 => RotateDirection::Deg0
};
for page in &mut rendered {
page.successful = false;
}
continue 'render_pages;
}
}
}};
}
@@ -330,7 +301,6 @@ pub fn start_rendering(
black,
white,
fit_or_fill,
rotate,
(area_w, area_h)
) {
// If that fn returned Some, that means it needed to be re-rendered for some
@@ -485,7 +455,6 @@ fn render_single_page_to_ctx(
black: i32,
white: i32,
fit_or_fill: FitOrFill,
rotate: RotateDirection,
(area_w, area_h): (f32, f32)
) -> Result<RenderedContext, mupdf::error::Error> {
let result_rects = match prev_render.num_search_found {
@@ -496,12 +465,7 @@ fn render_single_page_to_ctx(
// then, get the size of the page
let bounds = page.bounds()?;
let page_dim = match rotate {
RotateDirection::Deg0 | RotateDirection::Deg180 =>
(bounds.x1 - bounds.x0, bounds.y1 - bounds.y0),
RotateDirection::Deg90 | RotateDirection::Deg270 =>
(bounds.y1 - bounds.y0, bounds.x1 - bounds.x0),
};
let page_dim = (bounds.x1 - bounds.x0, bounds.y1 - bounds.y0);
let scaled = scale_img_for_area(page_dim, (area_w, area_h), fit_or_fill);
let ScaledResult {
@@ -518,13 +482,7 @@ fn render_single_page_to_ctx(
}
let colorspace = Colorspace::device_rgb();
let mut matrix = Matrix::new_scale(scale_factor, scale_factor);
match rotate {
RotateDirection::Deg0 => matrix.rotate(0.0),
RotateDirection::Deg90 => matrix.rotate(90.0),
RotateDirection::Deg180 => matrix.rotate(180.0),
RotateDirection::Deg270 => matrix.rotate(270.0)
};
let matrix = Matrix::new_scale(scale_factor, scale_factor);
let mut pixmap = page.to_pixmap(&matrix, &colorspace, false, false)?;
if invert {
@@ -536,7 +494,6 @@ fn render_single_page_to_ctx(
let (x_res, y_res) = pixmap.resolution();
let new_x = (x_res as f32 * scale_factor) as i32;
let new_y = (y_res as f32 * scale_factor) as i32;
pixmap.set_resolution(new_x, new_y);
let result_rects = result_rects
+5 -12
View File
@@ -9,6 +9,10 @@ use crossterm::{
}
};
use kittage::display::DisplayLocation;
use nix::{
sys::signal::{Signal::SIGSTOP, kill},
unistd::Pid
};
use ratatui::{
Frame,
layout::{Constraint, Flex, Layout, Position, Rect},
@@ -797,17 +801,10 @@ impl Tui {
.unwrap();
disable_raw_mode().unwrap();
#[cfg(unix)]
{
// This process will hang after the SIGSTOP call until we get
// foregrounded again by something else, at which point we need to
// re-setup everything so that it all gets drawn again.
nix::sys::signal::kill(
nix::unistd::Pid::this(),
nix::sys::signal::Signal::SIGSTOP
)
.unwrap();
}
kill(Pid::this(), SIGSTOP).unwrap();
enable_raw_mode().unwrap();
execute!(
@@ -839,7 +836,6 @@ impl Tui {
'G' if can_zoom => self.update_zoom(Zoom::pan_top),
'0' if can_zoom => self.update_zoom(Zoom::pan_left),
'$' if can_zoom => self.update_zoom(Zoom::pan_right),
'r' => Some(InputAction::Rotate),
_ => None
}
}
@@ -1111,8 +1107,6 @@ H, J, K, L (when zoomed in):
Pan direction around page
0/$ (when on fill-screen):
Scroll to left/right side of page
r:
Rotate by 90 degrees
";
pub enum InputAction {
@@ -1121,7 +1115,6 @@ pub enum InputAction {
Search(String),
QuitApp,
Invert,
Rotate,
Fullscreen,
SwitchRenderZoom(crate::FitOrFill)
}