code-minimap-0.6.8/000077500000000000000000000000001473377720700141105ustar00rootroot00000000000000code-minimap-0.6.8/.gitattributes000066400000000000000000000000451473377720700170020ustar00rootroot00000000000000/completions/**/* linguist-generated code-minimap-0.6.8/.github/000077500000000000000000000000001473377720700154505ustar00rootroot00000000000000code-minimap-0.6.8/.github/dependabot.yml000066400000000000000000000003551473377720700203030ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: cargo directory: "/" schedule: interval: weekly reviewers: - wfxr labels: - dependencies commit-message: prefix: "chore" prefix-development: "chore" include: "scope" code-minimap-0.6.8/.github/workflows/000077500000000000000000000000001473377720700175055ustar00rootroot00000000000000code-minimap-0.6.8/.github/workflows/CICD.yml000066400000000000000000000341111473377720700207320ustar00rootroot00000000000000name: CICD env: CICD_INTERMEDIATES_DIR: "_cicd-intermediates" MSRV_FEATURES: "--all-features" on: workflow_dispatch: pull_request: push: branches: - master tags: - "*" jobs: crate_metadata: name: Extract crate metadata runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Extract crate information id: crate_metadata run: | cargo metadata --no-deps --format-version 1 | jq -r '"name=" + .packages[0].name' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"version=" + .packages[0].version' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"maintainer=" + .packages[0].authors[0]' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"homepage=" + .packages[0].homepage' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"description=" + .packages[0].description' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"msrv=" + .packages[0].rust_version' | tee -a $GITHUB_OUTPUT outputs: name: ${{ steps.crate_metadata.outputs.name }} version: ${{ steps.crate_metadata.outputs.version }} maintainer: ${{ steps.crate_metadata.outputs.maintainer }} homepage: ${{ steps.crate_metadata.outputs.homepage }} description: ${{ steps.crate_metadata.outputs.description }} msrv: ${{ steps.crate_metadata.outputs.msrv }} ensure_cargo_fmt: name: Ensure 'cargo fmt' has been run runs-on: ubuntu-latest steps: - uses: dtolnay/rust-toolchain@stable with: components: rustfmt - uses: actions/checkout@v4 - run: cargo fmt -- --check # min_version: # name: Minimum supported rust version # runs-on: ubuntu-latest # needs: crate_metadata # steps: # - name: Checkout source code # uses: actions/checkout@v4 # # - name: Install rust toolchain (v${{ needs.crate_metadata.outputs.msrv }}) # uses: dtolnay/rust-toolchain@master # with: # toolchain: ${{ needs.crate_metadata.outputs.msrv }} # components: clippy # - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) # run: cargo clippy --locked --all-targets ${{ env.MSRV_FEATURES }} # - name: Run tests # run: cargo test --locked ${{ env.MSRV_FEATURES }} build: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} needs: crate_metadata strategy: fail-fast: false matrix: job: - { target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - { target: aarch64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true } - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } - { target: i686-pc-windows-msvc , os: windows-2019 } - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } - { target: x86_64-apple-darwin , os: macos-12 } - { target: x86_64-pc-windows-gnu , os: windows-2019 } - { target: x86_64-pc-windows-msvc , os: windows-2019 } - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } env: BUILD_CMD: cargo steps: - name: Checkout source code uses: actions/checkout@v4 - name: Install prerequisites shell: bash run: | case ${{ matrix.job.target }} in arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; esac - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.job.target }} - name: Install cross if: matrix.job.use-cross uses: taiki-e/install-action@v2 with: tool: cross - name: Overwrite build command env variable if: matrix.job.use-cross shell: bash run: echo "BUILD_CMD=cross" >> $GITHUB_ENV - name: Show version information (Rust, cargo, GCC) shell: bash run: | gcc --version || true rustup -V rustup toolchain list rustup default cargo -V rustc -V - name: Build shell: bash run: $BUILD_CMD build --locked --release --target=${{ matrix.job.target }} - name: Set binary name & path id: bin shell: bash run: | # Figure out suffix of binary EXE_suffix="" case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac; # Setup paths BIN_NAME="${{ needs.crate_metadata.outputs.name }}${EXE_suffix}" BIN_PATH="target/${{ matrix.job.target }}/release/${BIN_NAME}" # Let subsequent steps know where to find the binary echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_OUTPUT echo "BIN_NAME=${BIN_NAME}" >> $GITHUB_OUTPUT - name: Set testing options id: test-options shell: bash run: | # test only library unit tests and binary for arm-type targets unset CARGO_TEST_OPTIONS unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--bin ${{ needs.crate_metadata.outputs.name }}" ;; esac; echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT - name: Run tests shell: bash run: $BUILD_CMD test --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} - name: Test run shell: bash run: $BUILD_CMD run --locked --target=${{ matrix.job.target }} -- Cargo.toml - name: Strip binary shell: bash run: | if hash strip &>/dev/null; then # strip binary if possible strip "${{ steps.bin.outputs.BIN_PATH }}" || true fi - name: Create tarball id: package shell: bash run: | PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac; PKG_BASENAME=${{ needs.crate_metadata.outputs.name }}-v${{ needs.crate_metadata.outputs.version }}-${{ matrix.job.target }} PKG_NAME=${PKG_BASENAME}${PKG_suffix} echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package" ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/" mkdir -p "${ARCHIVE_DIR}" # Binary cp "${{ steps.bin.outputs.BIN_PATH }}" "$ARCHIVE_DIR" # README and LICENSE files cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "$ARCHIVE_DIR" # Autocompletion files cp -r completions "${ARCHIVE_DIR}" # base compressed package pushd "${PKG_STAGING}/" >/dev/null case ${{ matrix.job.target }} in *-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;; *) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;; esac; popd >/dev/null # Let subsequent steps know where to find the compressed package echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT - name: Create Debian package id: debian-package shell: bash if: startsWith(matrix.job.os, 'ubuntu') run: | COPYRIGHT_YEARS="2020 - "$(date "+%Y") DPKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/debian-package" DPKG_DIR="${DPKG_STAGING}/dpkg" mkdir -p "${DPKG_DIR}" DPKG_BASENAME=${{ needs.crate_metadata.outputs.name }} DPKG_CONFLICTS=${{ needs.crate_metadata.outputs.name }}-musl case ${{ matrix.job.target }} in *-musl*) DPKG_BASENAME=${{ needs.crate_metadata.outputs.name }}-musl ; DPKG_CONFLICTS=${{ needs.crate_metadata.outputs.name }} ;; esac; DPKG_VERSION=${{ needs.crate_metadata.outputs.version }} unset DPKG_ARCH case ${{ matrix.job.target }} in aarch64-*-linux-*) DPKG_ARCH=arm64 ;; arm-*-linux-*hf) DPKG_ARCH=armhf ;; i686-*-linux-*) DPKG_ARCH=i686 ;; x86_64-*-linux-*) DPKG_ARCH=amd64 ;; *) DPKG_ARCH=notset ;; esac; DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" echo "DPKG_NAME=${DPKG_NAME}" >> $GITHUB_OUTPUT # Binary install -Dm755 "${{ steps.bin.outputs.BIN_PATH }}" "${DPKG_DIR}/usr/bin/${{ steps.bin.outputs.BIN_NAME }}" # Man page # install -Dm644 'doc/${{ needs.crate_metadata.outputs.name }}.1' "${DPKG_DIR}/usr/share/man/man1/${{ needs.crate_metadata.outputs.name }}.1" # gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${{ needs.crate_metadata.outputs.name }}.1" # Autocompletion files install -Dm644 'completions/bash/${{ needs.crate_metadata.outputs.name }}.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/${{ needs.crate_metadata.outputs.name }}" install -Dm644 'completions/fish/${{ needs.crate_metadata.outputs.name }}.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ needs.crate_metadata.outputs.name }}.fish" install -Dm644 'completions/zsh/_${{ needs.crate_metadata.outputs.name }}' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ needs.crate_metadata.outputs.name }}" # README and LICENSE install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md" install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT" install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE" cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" < "${DPKG_DIR}/DEBIAN/control" <> $GITHUB_OUTPUT # build dpkg fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}" - name: "Artifact upload: tarball" uses: actions/upload-artifact@master with: name: ${{ steps.package.outputs.PKG_NAME }} path: ${{ steps.package.outputs.PKG_PATH }} - name: "Artifact upload: Debian package" uses: actions/upload-artifact@master if: steps.debian-package.outputs.DPKG_NAME with: name: ${{ steps.debian-package.outputs.DPKG_NAME }} path: ${{ steps.debian-package.outputs.DPKG_PATH }} - name: Check for release id: is-release shell: bash run: | unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT - name: Publish archives and packages uses: softprops/action-gh-release@v1 if: steps.is-release.outputs.IS_RELEASE with: files: | ${{ steps.package.outputs.PKG_PATH }} ${{ steps.debian-package.outputs.DPKG_PATH }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} code-minimap-0.6.8/.gitignore000066400000000000000000000000101473377720700160670ustar00rootroot00000000000000/target code-minimap-0.6.8/.pre-commit-config.yaml000066400000000000000000000020241473377720700203670ustar00rootroot00000000000000# See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: trailing-whitespace - id: check-yaml - id: check-added-large-files - id: mixed-line-ending - id: check-toml - repo: local hooks: - id: cargo-fmt name: cargo fmt pass_filenames: false always_run: true language: system entry: cargo fmt - id: cargo-check name: cargo check pass_filenames: false always_run: true language: system entry: cargo check - id: cargo-clippy name: cargo clippy pass_filenames: false language: system always_run: true entry: cargo clippy args: ["--", "-D", "warnings"] - id: update-completions name: update shell completions pass_filenames: false language: system always_run: true entry: > sh -c ' touch build.rs && SHELL_COMPLETIONS_DIR=completions cargo build && git add completions ' code-minimap-0.6.8/.rustfmt.toml000066400000000000000000000004611473377720700165700ustar00rootroot00000000000000edition = "2021" struct_field_align_threshold = 40 max_width = 120 comment_width = 120 reorder_imports = true fn_single_line = false imports_layout = "HorizontalVertical" match_arm_blocks = false overflow_delimited_expr = true imports_granularity = "Crate" struct_lit_width = 60 struct_variant_width = 60 code-minimap-0.6.8/Cargo.lock000066400000000000000000000421631473377720700160230ustar00rootroot00000000000000# 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.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", "windows-sys", ] [[package]] name = "anyhow" version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", "winapi", ] [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", ] [[package]] name = "clap_builder" version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", "terminal_size", ] [[package]] name = "clap_complete" version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac2e663e3e3bed2d32d065a8404024dad306e699a04263ec59919529f803aee9" dependencies = [ "clap", ] [[package]] name = "clap_derive" version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", "quote", "syn", ] [[package]] name = "clap_lex" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "code-minimap" version = "0.6.8" dependencies = [ "anyhow", "atty", "clap", "clap_complete", "itertools", "rstest", ] [[package]] name = "colorchoice" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", "windows-sys", ] [[package]] name = "futures" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", "futures-executor", "futures-io", "futures-sink", "futures-task", "futures-util", ] [[package]] name = "futures-channel" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", ] [[package]] name = "futures-core" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", "futures-util", ] [[package]] name = "futures-io" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "futures-sink" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-timer" version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", "futures-io", "futures-macro", "futures-sink", "futures-task", "memchr", "pin-project-lite", "pin-utils", "slab", ] [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] [[package]] name = "indexmap" version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown", ] [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] name = "libc" version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "linux-raw-sys" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "pin-project-lite" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro-crate" version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro2" version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] [[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 = "relative-path" version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba39f3699c378cd8970968dcbff9c43159ea4cfbd88d43c00b22f2ef10a435d2" [[package]] name = "rstest" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a2c585be59b6b5dd66a9d2084aa1d8bd52fbdb806eafdeffb52791147862035" dependencies = [ "futures", "futures-timer", "rstest_macros", "rustc_version", ] [[package]] name = "rstest_macros" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "825ea780781b15345a146be27eaefb05085e337e869bff01b4306a4fd4a9ad5a" dependencies = [ "cfg-if", "glob", "proc-macro-crate", "proc-macro2", "quote", "regex", "relative-path", "rustc_version", "syn", "unicode-ident", ] [[package]] name = "rustc_version" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys", ] [[package]] name = "semver" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" [[package]] name = "slab" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" version = "2.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ae51629bf965c5c098cc9e87908a3df5301051a9e087d6f9bef5c9771ed126" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "terminal_size" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5352447f921fda68cf61b4101566c0bdb5104eff6804d0678e5227580ab6a4e9" dependencies = [ "rustix", "windows-sys", ] [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "toml_datetime", "winnow", ] [[package]] name = "unicode-ident" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[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-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "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.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[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_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[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_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] code-minimap-0.6.8/Cargo.toml000066400000000000000000000022241473377720700160400ustar00rootroot00000000000000[package] name = "code-minimap" version = "0.6.8" authors = ["Wenxuan Zhang "] description = "A high performance code minimap generator" categories = ["command-line-utilities"] homepage = "https://github.com/wfxr/code-minimap" keywords = ["minimap", "tool"] license = "Apache-2.0 OR MIT" exclude = ["/completions"] repository = "https://github.com/wfxr/code-minimap" edition = "2021" build = "build.rs" [features] default = ["application"] # Feature required for build the `code-minimap` application. Should be disabled when # depending on `code-minimap` as a library. application = ["clap", "clap_complete"] [lib] name = "code_minimap" path = "src/lib.rs" [[bin]] name = "code-minimap" path = "src/bin/code-minimap/main.rs" [dependencies] anyhow = "1" itertools = "0" clap = { version = "4", features = ["wrap_help", "derive"], optional = true } clap_complete = { version = "4", optional = true } atty = "0.2.14" [build-dependencies] clap = { version = "4", features = ["wrap_help", "derive"], optional = true } clap_complete = { version = "4", optional = true } [dev-dependencies] rstest = "0" [profile.release] lto = true codegen-units = 1 code-minimap-0.6.8/FUNDING.yml000066400000000000000000000000141473377720700157200ustar00rootroot00000000000000ko_fi: wfxr code-minimap-0.6.8/LICENSE-APACHE000066400000000000000000000261351473377720700160430ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. code-minimap-0.6.8/LICENSE-MIT000066400000000000000000000021131473377720700155410ustar00rootroot00000000000000Copyright (c) 2020-2024 Wenxuan Zhang (https://wfxr.mit-license.org/2020). 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. code-minimap-0.6.8/README.md000066400000000000000000000127311473377720700153730ustar00rootroot00000000000000

🛰 code-minimap

A high performance code minimap render.

CICD License Version Platform

This tool is for generating text minimaps at 🚀 speed. You can use it to implement IDE-like minimap plugin for a terminal text editor, [minimap.vim](https://github.com/wfxr/minimap.vim) for example. ### Features * Small and *fast* (see [benchmarks](#benchmark) below). * Memory efficient. * Freely zoom. * [Multi platforms](https://github.com/wfxr/code-minimap/releases) support. ### Usage ``` $ code-minimap src/core.rs -H 0.6 -V 0.5 ⣿⣿⣿⣿⣿⠿⠛⠓⠒⠒⠂ ⣉⣿⣿⣿⣟⣛⣛⣛⠒⠒⠂ ⠀⠉⣿⣿⣿⣿⠭⠭⠭⠭⠤⠤⠤⠤⠤ ⠀⠉⠛⠻⢿⣿⣿⣿⣿⣶⣶⣶⣒⣒⣒⣒⣒⣒⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀ ⠀⣀⣶⣾⣿⣿⣿⣿⣭⣭⣭⣤⣤⣤⣤⣤⠤⠤⠤⠤⠤ ⣿⣿⣿⣶⡒⠒⠒⠒ ⣿⣿⣶⣶⣶⣶⣶⣶⣤⣤⣤⣤⣤⣤⣤⣤⣄ ⣭⣭⣭⣭⠭⠭⠭⠭⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉ ⣿⣿⣿⣿⣧⣤⣤⣤⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀ ⣛⣿⣿⣿⣟⣛⣒⣒⠂ ⣀⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣋⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀ ⠀⣤⣭⣽⣿⣷⣶⣶⣶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠶⠒⠒⠒⠒⠒ ⠀⠶⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠛⠓⠒⠒⠒⠒⠒ ⣉⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⣛⡛⠛⠛⠛⠛ ⠒⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⡄ ⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇ ⠄⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠃ ``` Run `code-minimap --help` to view detailed usage. ### Installation #### On Linux ##### Arch Linux `code-minimap` is available in the Arch User Repository. To install it from [AUR](https://aur.archlinux.org/packages/code-minimap): ``` yay -S code-minimap ``` ##### Alpine Linux `code-minimap` is available in the [testing](https://pkgs.alpinelinux.org/packages?name=code-minimap&branch=edge&repo=testing) repository: ``` apk add code-minimap ``` ##### Gentoo `code-minimap` is available in the [GURU](https://github.com/gentoo/guru/) project repository: ``` emerge --ask code-minimap ``` #### On macOS You can install `code-minimap` with Homebrew: ``` brew install code-minimap ``` or with MacPorts: ``` sudo port install code-minimap ``` #### On Windows You can install `code-minimap` with [scoop](https://github.com/lukesampson/scoop): ``` scoop bucket add extras scoop install code-minimap ``` #### From binaries Prebuilt versions of `code-minimap` for various architectures are available at [Github release page](https://github.com/wfxr/code-minimap/releases). *Note that you can try the `musl` version (which is statically-linked) if runs into dependency related errors.* #### From source `code-minimap` is also published on [crates.io](https://crates.io). If you have the latest Rust toolchains installed you can use `cargo` to install it from source: ``` cargo install --locked code-minimap ``` If you want the latest version, clone this repository and run `cargo build --release`. ### Benchmark - [src/core.rs](https://github.com/wfxr/code-minimap/blob/v0.3.0/src/core.rs): ``` $ hyperfine -w 10 'code-minimap src/core.rs' Benchmark #1: code-minimap src/core.rs Time (mean ± σ): 0.2 ms ± 0.1 ms [User: 0.4 ms, System: 0.3 ms] Range (min … max): 0.2 ms … 1.1 ms 1560 runs ``` **79** lines, **4K** size, **0.2ms**. --------------------------------- - [all rust code from rust-1.46.0](https://github.com/rust-lang/rust/archive/1.46.0.tar.gz): ``` $ fd -t f -e rs -x cat "{}" >> /tmp/all-in-one.rs $ hyperfine -w 10 'code-minimap /tmp/all-in-one.rs' Benchmark #1: code-minimap /tmp/all-in-one.rs Time (mean ± σ): 322.7 ms ± 4.5 ms [User: 298.7 ms, System: 23.8 ms] Range (min … max): 318.5 ms … 334.1 ms 10 runs ``` **1,153,225** lines, **37M** size, **323ms**. --------------------------------- - [huge random file](): ``` $ base64 /dev/urandom | head -10000000 > huge.txt $ hyperfine -w 1 'code-minimap huge.txt' Benchmark #1: code-minimap huge.txt Time (mean ± σ): 2.941 s ± 0.034 s [User: 2.618 s, System: 0.321 s] Range (min … max): 2.919 s … 3.028 s 10 runs ``` **10,000,000** lines, **735M** size, **2.9s**. --------------------------------- *Test environment:* ``` Binary version: 0.3.0 OS: Arch Linux x86_64 Kernel: 5.8.10-arch1-1 CPU: Intel i9-9900K (16) @ 5.000GHz ``` ### Related Project [minimap.vim](https://github.com/wfxr/minimap.vim): Blazing fast minimap for vim. ### License `code-minimap` is distributed under the terms of both the MIT License and the Apache License 2.0. See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details. code-minimap-0.6.8/build.rs000066400000000000000000000011421473377720700155530ustar00rootroot00000000000000use clap::CommandFactory; use std::{fs, path::Path}; include!("src/bin/code-minimap/cli.rs"); fn main() -> Result<(), Box> { let outdir = std::env::var_os("SHELL_COMPLETIONS_DIR") .or_else(|| std::env::var_os("OUT_DIR")) .expect("OUT_DIR not found"); let outdir_path = Path::new(&outdir); let cmd = &mut App::command(); for shell in Shell::value_variants() { let dir = outdir_path.join(shell.to_string()); fs::create_dir_all(&dir)?; clap_complete::generate_to(*shell, cmd, cmd.get_name().to_string(), &dir)?; } Ok(()) } code-minimap-0.6.8/examples/000077500000000000000000000000001473377720700157265ustar00rootroot00000000000000code-minimap-0.6.8/examples/simple.rs000066400000000000000000000001711473377720700175640ustar00rootroot00000000000000use std::io; fn main() { let stdin = io::stdin(); code_minimap::print(stdin.lock(), 1.0, 1.0, None).unwrap(); } code-minimap-0.6.8/examples/write_to_string.rs000066400000000000000000000002541473377720700215170ustar00rootroot00000000000000use std::io; fn main() { let stdin = io::stdin(); let minimap = code_minimap::write_to_string(stdin.lock(), 1.0, 1.0, None).unwrap(); print!("{}", minimap); } code-minimap-0.6.8/src/000077500000000000000000000000001473377720700146775ustar00rootroot00000000000000code-minimap-0.6.8/src/bin/000077500000000000000000000000001473377720700154475ustar00rootroot00000000000000code-minimap-0.6.8/src/bin/code-minimap/000077500000000000000000000000001473377720700200115ustar00rootroot00000000000000code-minimap-0.6.8/src/bin/code-minimap/cli.rs000066400000000000000000000032171473377720700211310ustar00rootroot00000000000000use std::path::PathBuf; use clap::{ builder::{ styling::{AnsiColor, Effects}, Styles, }, ArgAction, Parser, ValueEnum, }; use clap_complete::Shell; #[derive(Parser)] #[clap(about, version)] #[clap(next_line_help = true)] #[clap(disable_version_flag = true)] #[clap( styles(Styles::styled() .header(AnsiColor::Yellow.on_default() | Effects::BOLD) .usage(AnsiColor::Yellow.on_default() | Effects::BOLD) .literal(AnsiColor::Green.on_default() | Effects::BOLD) .placeholder(AnsiColor::Cyan.on_default()) ) )] pub struct App { /// File to read. pub file: Option, /// Specify horizontal scale factor. #[arg(short = 'H', long = "horizontal-scale", default_value = "1.0")] pub hscale: f64, /// Specify vertical scale factor. #[arg(short = 'V', long = "vertical-scale", default_value = "1.0")] pub vscale: f64, #[arg(long)] /// Specify padding width. pub padding: Option, /// Specify input encoding. #[arg(long, value_enum, default_value_t = Encoding::UTF8Lossy, ignore_case = true)] pub encoding: Encoding, /// Subcommand. #[command(subcommand)] pub subcommand: Option, /// Print version. #[arg(long, action = ArgAction::Version)] version: Option, } #[derive(Parser)] pub enum Subcommand { /// Generate shell completion file Completion { /// Target shell name. shell: Shell, }, } #[derive(Parser)] pub struct CompletionOpt { /// Target shell name. pub shell: Shell, } #[derive(Copy, Clone, ValueEnum)] pub enum Encoding { UTF8Lossy, UTF8, } code-minimap-0.6.8/src/bin/code-minimap/main.rs000066400000000000000000000030401473377720700213000ustar00rootroot00000000000000mod cli; use anyhow::bail; use clap::{CommandFactory, Parser}; use cli::{App, Encoding, Subcommand}; use code_minimap::lossy_reader::LossyReader; use std::{ fs::File, io::{self, BufRead, BufReader, Read}, process, }; fn main() { if let Err(e) = try_main() { if let Some(ioerr) = e.root_cause().downcast_ref::() { if ioerr.kind() == io::ErrorKind::BrokenPipe { std::process::exit(0); } } eprintln!("{}: {}", env!("CARGO_PKG_NAME"), e); process::exit(1) } } fn try_main() -> anyhow::Result<()> { let opt: App = App::parse(); match opt.subcommand { Some(Subcommand::Completion { shell }) => { let cmd = &mut App::command(); clap_complete::generate(shell, cmd, cmd.get_name().to_string(), &mut io::stdout()) } None => { let stdin = io::stdin(); let reader = match &opt.file { Some(path) => buf_reader(&opt.encoding, File::open(path)?), None if atty::is(atty::Stream::Stdin) => bail!("no input file specified (use -h for help)"), None => buf_reader(&opt.encoding, stdin), }; code_minimap::print(reader, opt.hscale, opt.vscale, opt.padding)?; } } Ok(()) } fn buf_reader(encoding: &Encoding, reader: R) -> Box { match encoding { Encoding::UTF8 => Box::new(BufReader::new(reader)), Encoding::UTF8Lossy => Box::new(LossyReader::new(reader)), } } code-minimap-0.6.8/src/core.rs000066400000000000000000000127271473377720700162060ustar00rootroot00000000000000use std::{ io::{self, BufRead, Write}, ops::Range, }; use itertools::Itertools; /// Write minimap to the writer. pub fn write( mut writer: impl Write, reader: impl BufRead, hscale: f64, vscale: f64, padding: Option, ) -> io::Result<()> { let mut frame = [0..0, 0..0, 0..0, 0..0]; reader .lines() .map(|line| { line.map(|line| { let beg = line.find(|c: char| !c.is_whitespace()).unwrap_or(usize::MAX); let end = line.rfind(|c: char| !c.is_whitespace()).unwrap_or(0); (beg, end) }) }) .enumerate() .map(|(i, line)| (scale(i, vscale), line)) .chunk_by(|(i, _)| *i) .into_iter() .chunks(4) .into_iter() .try_for_each(|chunk| { let mut chunk_size = 0; for (i, (_, group)) in chunk.enumerate() { let (beg, end) = group.into_iter().try_fold((usize::MAX, 0), |(beg, end), (_, line)| { line.map(|(b, e)| (beg.min(b), end.max(e))) })?; frame[i] = beg..(end + 1); chunk_size += 1; } frame.iter_mut().skip(chunk_size).for_each(|row| *row = 0..0); scale_frame(&mut frame, hscale); write_frame(&mut writer, &frame, padding) }) } /// Print minimap to the stdout. /// /// # Examples /// /// Basic usage: /// /// ``` /// use std::{io, io::BufReader}; /// /// let stdin = io::stdin(); /// code_minimap::print(stdin.lock(), 1.0, 1.0, None).unwrap(); /// ``` pub fn print(reader: impl BufRead, hscale: f64, vscale: f64, padding: Option) -> io::Result<()> { write(io::stdout(), reader, hscale, vscale, padding) } /// Write minimap to a string. /// /// # Examples /// /// Basic usage: /// /// ``` /// use std::{io, io::BufReader}; /// /// let stdin = io::stdin(); /// let s = /// code_minimap::write_to_string(stdin.lock(), 1.0, 1.0, None).unwrap(); /// print!("{}", s); /// ``` pub fn write_to_string(reader: impl BufRead, hscale: f64, vscale: f64, padding: Option) -> io::Result { let mut buf = Vec::new(); write(&mut buf, reader, hscale, vscale, padding)?; Ok(String::from_utf8(buf).unwrap()) } fn write_frame(mut writer: impl Write, frame: &[Range], padding: Option) -> std::io::Result<()> { let idx = |pos| { frame .iter() .enumerate() .fold(0, |acc, (i, x)| if x.contains(&pos) { acc + (1 << i) } else { acc }) }; let end = frame.iter().max_by_key(|range| range.end).unwrap().end; let line: String = (0..end) .step_by(2) .map(|i| BRAILLE_MATRIX[(idx(i)) + (idx(i + 1) << 4)]) .collect(); match padding { Some(padding) => writeln!(writer, "{0:<1$}", line, padding), None => writeln!(writer, "{}", line), } } fn scale_frame(frame: &mut [Range], factor: f64) { for x in frame { *x = scale(x.start, factor)..scale(x.end, factor); } } fn scale(x: usize, factor: f64) -> usize { (x as f64 * factor) as usize } #[rustfmt::skip] const BRAILLE_MATRIX : [char; 256] = [ '⠀', '⠁', '⠂', '⠃', '⠄', '⠅', '⠆', '⠇', '⡀', '⡁', '⡂', '⡃', '⡄', '⡅', '⡆', '⡇', '⠈', '⠉', '⠊', '⠋', '⠌', '⠍', '⠎', '⠏', '⡈', '⡉', '⡊', '⡋', '⡌', '⡍', '⡎', '⡏', '⠐', '⠑', '⠒', '⠓', '⠔', '⠕', '⠖', '⠗', '⡐', '⡑', '⡒', '⡓', '⡔', '⡕', '⡖', '⡗', '⠘', '⠙', '⠚', '⠛', '⠜', '⠝', '⠞', '⠟', '⡘', '⡙', '⡚', '⡛', '⡜', '⡝', '⡞', '⡟', '⠠', '⠡', '⠢', '⠣', '⠤', '⠥', '⠦', '⠧', '⡠', '⡡', '⡢', '⡣', '⡤', '⡥', '⡦', '⡧', '⠨', '⠩', '⠪', '⠫', '⠬', '⠭', '⠮', '⠯', '⡨', '⡩', '⡪', '⡫', '⡬', '⡭', '⡮', '⡯', '⠰', '⠱', '⠲', '⠳', '⠴', '⠵', '⠶', '⠷', '⡰', '⡱', '⡲', '⡳', '⡴', '⡵', '⡶', '⡷', '⠸', '⠹', '⠺', '⠻', '⠼', '⠽', '⠾', '⠿', '⡸', '⡹', '⡺', '⡻', '⡼', '⡽', '⡾', '⡿', '⢀', '⢁', '⢂', '⢃', '⢄', '⢅', '⢆', '⢇', '⣀', '⣁', '⣂', '⣃', '⣄', '⣅', '⣆', '⣇', '⢈', '⢉', '⢊', '⢋', '⢌', '⢍', '⢎', '⢏', '⣈', '⣉', '⣊', '⣋', '⣌', '⣍', '⣎', '⣏', '⢐', '⢑', '⢒', '⢓', '⢔', '⢕', '⢖', '⢗', '⣐', '⣑', '⣒', '⣓', '⣔', '⣕', '⣖', '⣗', '⢘', '⢙', '⢚', '⢛', '⢜', '⢝', '⢞', '⢟', '⣘', '⣙', '⣚', '⣛', '⣜', '⣝', '⣞', '⣟', '⢠', '⢡', '⢢', '⢣', '⢤', '⢥', '⢦', '⢧', '⣠', '⣡', '⣢', '⣣', '⣤', '⣥', '⣦', '⣧', '⢨', '⢩', '⢪', '⢫', '⢬', '⢭', '⢮', '⢯', '⣨', '⣩', '⣪', '⣫', '⣬', '⣭', '⣮', '⣯', '⢰', '⢱', '⢲', '⢳', '⢴', '⢵', '⢶', '⢷', '⣰', '⣱', '⣲', '⣳', '⣴', '⣵', '⣶', '⣷', '⢸', '⢹', '⢺', '⢻', '⢼', '⢽', '⢾', '⢿', '⣸', '⣹', '⣺', '⣻', '⣼', '⣽', '⣾', '⣿', ]; #[cfg(test)] mod test { use rstest::*; use super::*; #[rstest( input, expected, case("", ""), case("a", "⠁"), case("aaaa\nbbbb\ncccc\ndddd", "⣿⣿"), case("aaa\n aa\n a\n a", "⠙⢇"), case(" a b c\n d efg \n h i\n jk", "⢐⡛⠿⠭") )] fn test_write_to_string(input: &'static str, expected: &str) { let actual = write_to_string(input.as_bytes(), 1.0, 1.0, None).unwrap(); assert_eq!(expected, actual.trim()); } } code-minimap-0.6.8/src/lib.rs000066400000000000000000000001031473377720700160050ustar00rootroot00000000000000pub(crate) mod core; pub mod lossy_reader; pub use crate::core::*; code-minimap-0.6.8/src/lossy_reader.rs000066400000000000000000000014631473377720700177440ustar00rootroot00000000000000use std::io::{self, BufRead, BufReader, Read}; pub struct LossyReader { inner: BufReader, } impl LossyReader { pub fn new(inner: R) -> Self { Self { inner: BufReader::new(inner) } } } impl Read for LossyReader { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.inner.read(buf) } } impl BufRead for LossyReader { fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() } fn consume(&mut self, amt: usize) { self.inner.consume(amt) } fn read_line(&mut self, buf: &mut String) -> std::io::Result { let mut bytes = Vec::new(); let len = self.read_until(b'\n', &mut bytes)?; buf.push_str(&String::from_utf8_lossy(&bytes)); Ok(len) } }