feat(build): new cargo-make based build system

This commit is contained in:
Brooks Rady 2021-04-13 18:36:06 +01:00 committed by GitHub
commit 24161375d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 438 additions and 396 deletions

View file

@ -11,48 +11,36 @@ env:
jobs:
build:
name: Build & test
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Add WASM target
run: rustup target add wasm32-wasi
- name: Build
run: ./build-all.sh --verbose
- name: Run tests
run: cargo test -j 1 --verbose
fmt:
name: Rustfmt
- name: Install cargo-make
run: cargo install --debug cargo-make
- name: Build & Test
run: cargo make
format:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions/checkout@v2
- name: Install cargo-make
run: cargo install --debug cargo-make
- name: Check Format
run: cargo make check-format
clippy:
name: Clippy
name: Check Clippy Lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
- name: Add WASM target
run: rustup target add wasm32-wasi
- name: Build
run: ./build-all.sh --verbose
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets
- uses: actions/checkout@v2
- name: Install cargo-make
run: cargo install --debug cargo-make
- name: Check Lints
run: cargo make clippy -D clippy::all

View file

@ -14,16 +14,30 @@ Before contributing please read our [Code of Conduct](CODE_OF_CONDUCT.md) which
all contributors are expected to adhere to.
## Building
To work around a [Cargo bug][https://github.com/rust-lang/cargo/issues/7004], you'll need to use the included `build-all.sh` script.
To build Zellij, we're using cargo-make you can install it by running `cargo install --force cargo-make`.
Here are some of the commands currently supported by the build system:
```sh
# An unoptimized debug build
./build-all.sh
# A fully optimized release build
./build-all.sh --release
# Format code, build, then run tests and clippy
cargo make
# You can also perform these actions individually
cargo make format
cargo make build
cargo make test
# Run Zellij (optionally with a non-default layout)
cargo make run
cargo make run strider
# Run Clippy (potentially with additional options)
cargo make clippy
cargo make clippy -W clippy::pedantic
# Install Zellij to some directory
cargo make install /path/of/zellij/binary
# Publish the zellij and zellij-tile crates
cargo make publish
```
The build script has an optional dependency on `binaryen --version` > 97, for it's command `wasm-opt`.
To run `install` or `publish`, you'll need `binaryen --version` > 97, for it's command `wasm-opt`.
## Looking for something to work on?

228
Cargo.lock generated
View file

@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "addr2line"
version = "0.14.1"
@ -207,11 +209,10 @@ dependencies = [
[[package]]
name = "bincode"
version = "1.3.2"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d175dfa69e619905c4c3cdb7c3c203fa3bdd5d51184e3afdb2742c0280493772"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
"byteorder",
"serde",
]
@ -255,9 +256,9 @@ checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
[[package]]
name = "byteorder"
version = "1.3.4"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
name = "cache-padded"
@ -320,9 +321,9 @@ dependencies = [
[[package]]
name = "console"
version = "0.14.0"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cc80946b3480f421c2f17ed1cb841753a371c7c5104f51d507e13f532c856aa"
checksum = "3993e6445baa160675931ec041a5e03ca84b9c6e32a056150d3aa2bdda0a1f45"
dependencies = [
"encode_unicode",
"lazy_static",
@ -407,9 +408,9 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
version = "0.5.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
@ -452,9 +453,9 @@ dependencies = [
[[package]]
name = "ctor"
version = "0.1.19"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8f45d9ad417bcef4817d614a501ab55cdd96a6fdb24f49aab89a54acfd66b19"
checksum = "5e98e2ad1a782e33928b96fc3948e7c355e5af34ba4de7670fe8bac2a3b2006d"
dependencies = [
"quote",
"syn",
@ -462,9 +463,9 @@ dependencies = [
[[package]]
name = "darling"
version = "0.12.2"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06d4a9551359071d1890820e3571252b91229e0712e7c36b08940e603c5a8fc"
checksum = "e9d6ddad5866bb2170686ed03f6839d31a76e5407d80b1c334a2c24618543ffa"
dependencies = [
"darling_core",
"darling_macro",
@ -472,9 +473,9 @@ dependencies = [
[[package]]
name = "darling_core"
version = "0.12.2"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b443e5fb0ddd56e0c9bfa47dc060c5306ee500cb731f2b91432dd65589a77684"
checksum = "a9ced1fd13dc386d5a8315899de465708cf34ee2a6d9394654515214e67bb846"
dependencies = [
"fnv",
"ident_case",
@ -486,9 +487,9 @@ dependencies = [
[[package]]
name = "darling_macro"
version = "0.12.2"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0220073ce504f12a70efc4e7cdaea9e9b1b324872e7ad96a208056d7a638b81"
checksum = "0a7a1445d54b2f9792e3b31a3e715feabbace393f38dc4ffd49d94ee9bc487d5"
dependencies = [
"darling_core",
"quote",
@ -518,9 +519,9 @@ dependencies = [
[[package]]
name = "dtoa"
version = "0.4.7"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e"
checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
[[package]]
name = "either"
@ -599,9 +600,9 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7"
[[package]]
name = "futures"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1"
checksum = "a9d5813545e459ad3ca1bff9915e9ad7f1a47dc6a91b627ce321d5863b7dd253"
dependencies = [
"futures-channel",
"futures-core",
@ -614,9 +615,9 @@ dependencies = [
[[package]]
name = "futures-channel"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939"
checksum = "ce79c6a52a299137a6013061e0cf0e688fce5d7f1bc60125f520912fdb29ec25"
dependencies = [
"futures-core",
"futures-sink",
@ -624,15 +625,15 @@ dependencies = [
[[package]]
name = "futures-core"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15496a72fabf0e62bdc3df11a59a3787429221dd0710ba8ef163d6f7a9112c94"
checksum = "098cd1c6dda6ca01650f1a37a794245eb73181d0d4d4e955e2f3c37db7af1815"
[[package]]
name = "futures-executor"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891a4b7b96d84d5940084b2a37632dd65deeae662c114ceaa2c879629c9c0ad1"
checksum = "10f6cb7042eda00f0049b1d2080aa4b93442997ee507eb3828e8bd7577f94c9d"
dependencies = [
"futures-core",
"futures-task",
@ -641,9 +642,9 @@ dependencies = [
[[package]]
name = "futures-io"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59"
checksum = "365a1a1fb30ea1c03a830fdb2158f5236833ac81fa0ad12fe35b29cddc35cb04"
[[package]]
name = "futures-lite"
@ -662,9 +663,9 @@ dependencies = [
[[package]]
name = "futures-macro"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea405816a5139fb39af82c2beb921d52143f556038378d6db21183a5c37fbfb7"
checksum = "668c6733a182cd7deb4f1de7ba3bf2120823835b3bcfbeacf7d2c4a773c1bb8b"
dependencies = [
"proc-macro-hack",
"proc-macro2",
@ -674,21 +675,21 @@ dependencies = [
[[package]]
name = "futures-sink"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85754d98985841b7d4f5e8e6fbfa4a4ac847916893ec511a2917ccd8525b8bb3"
checksum = "5c5629433c555de3d82861a7a4e3794a4c40040390907cfbfd7143a92a426c23"
[[package]]
name = "futures-task"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa189ef211c15ee602667a6fcfe1c1fd9e07d42250d2156382820fba33c9df80"
checksum = "ba7aa51095076f3ba6d9a1f702f74bd05ec65f555d70d2033d55ba8d69f581bc"
[[package]]
name = "futures-util"
version = "0.3.13"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1"
checksum = "3c144ad54d60f23927f0a6b6d816e4271278b64f005ad65e4e35291d2de9c025"
dependencies = [
"futures-channel",
"futures-core",
@ -818,9 +819,9 @@ dependencies = [
[[package]]
name = "insta"
version = "1.7.0"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1b6cf41e31a7e7b78055b548826da45c7dc74e6a13a3fa6b897a17a01322f26"
checksum = "c4a1b21a2971cea49ca4613c0e9fe8225ecaf5de64090fddc6002284726e9244"
dependencies = [
"console",
"lazy_static",
@ -893,9 +894,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "js-sys"
version = "0.3.48"
version = "0.3.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78"
checksum = "2d99f9e3e84b8f67f846ef5b4cbbc3b1c29f6c759fcbce6f01aa0e73d932a24c"
dependencies = [
"wasm-bindgen",
]
@ -936,9 +937,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.88"
version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a"
checksum = "9385f66bf6105b241aa65a61cb923ef20efc665cb9f9bb50ac2f0c4b7f378d41"
[[package]]
name = "libloading"
@ -958,9 +959,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]]
name = "lock_api"
version = "0.4.2"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176"
dependencies = [
"scopeguard",
]
@ -992,18 +993,18 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
[[package]]
name = "memmap2"
version = "0.2.1"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04e3e85b970d650e2ae6d70592474087051c11c54da7f7b4949725c5735fbcc6"
checksum = "397d1a6d6d0563c0f5462bbdae662cf6c784edf5e828e40c7257f85d82bf56dd"
dependencies = [
"libc",
]
[[package]]
name = "memoffset"
version = "0.6.1"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
checksum = "f83fb6581e8ed1f85fd45c116db8405483899489e38406156c25eb743554361d"
dependencies = [
"autocfg",
]
@ -1026,9 +1027,9 @@ checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"
[[package]]
name = "nb-connect"
version = "1.0.3"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "670361df1bc2399ee1ff50406a0d422587dd3bb0da596e1978fe8e05dabddf4f"
checksum = "a19900e7eee95eb2b3c2e26d12a874cc80aaf750e31be6fcbe743ead369fa45d"
dependencies = [
"libc",
"socket2",
@ -1117,11 +1118,11 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "polling"
version = "2.0.2"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2a7bc6b2a29e632e45451c941832803a18cce6781db04de8a04696cdca8bde4"
checksum = "4fc12d774e799ee9ebae13f4076ca003b40d18a11ac0f3641e6f899618580b7b"
dependencies = [
"cfg-if 0.1.10",
"cfg-if 1.0.0",
"libc",
"log",
"wepoll-sys",
@ -1182,9 +1183,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"
[[package]]
name = "proc-macro2"
version = "1.0.24"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
dependencies = [
"unicode-xid",
]
@ -1347,15 +1348,6 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
dependencies = [
"winapi-util",
]
[[package]]
name = "scopeguard"
version = "1.1.0"
@ -1364,9 +1356,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "serde"
version = "1.0.124"
version = "1.0.125"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f"
checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171"
dependencies = [
"serde_derive",
]
@ -1382,9 +1374,9 @@ dependencies = [
[[package]]
name = "serde_derive"
version = "1.0.124"
version = "1.0.125"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b"
checksum = "b093b7a2bb58203b5da3056c05b4ec1fed827dcfdb37347a8841695263b3d06d"
dependencies = [
"proc-macro2",
"quote",
@ -1416,9 +1408,9 @@ dependencies = [
[[package]]
name = "signal-hook"
version = "0.3.6"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a7f3f92a1da3d6b1d32245d0cbcbbab0cfc45996d8df619c42bccfa6d2bbb5f"
checksum = "ef33d6d0cd06e0840fba9985aab098c147e67e05cee14d412d3345ed14ff30ac"
dependencies = [
"libc",
"signal-hook-registry",
@ -1453,11 +1445,10 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]]
name = "socket2"
version = "0.3.19"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2"
dependencies = [
"cfg-if 1.0.0",
"libc",
"winapi",
]
@ -1566,9 +1557,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.62"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "123a78a3596b24fee53a6464ce52d8ecbf62241e6294c7e7fe12086cd161f512"
checksum = "48fe99c6bd8b1cc636890bcc071842de909d902c81ac7dab53ba33c421ab8ffb"
dependencies = [
"proc-macro2",
"quote",
@ -1680,15 +1671,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "toml"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
dependencies = [
"serde",
]
[[package]]
name = "tracing"
version = "0.1.25"
@ -1704,9 +1686,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
version = "0.1.13"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8a9bd1db7706f2373a190b0d067146caa39350c486f3d455b0e33b431f94c07"
checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2"
dependencies = [
"proc-macro2",
"quote",
@ -1802,9 +1784,9 @@ dependencies = [
[[package]]
name = "vec-arena"
version = "1.0.0"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d"
checksum = "34b2f665b594b07095e3ac3f718e13c2197143416fae4c5706cffb7b1af8d7f1"
[[package]]
name = "vec_map"
@ -1814,9 +1796,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.2"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
[[package]]
name = "vte"
@ -1854,17 +1836,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
[[package]]
name = "walkdir"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
dependencies = [
"same-file",
"winapi",
"winapi-util",
]
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
@ -1873,9 +1844,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "wasm-bindgen"
version = "0.2.71"
version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7"
checksum = "83240549659d187488f91f33c0f8547cbfef0b2088bc470c116d1d260ef623d9"
dependencies = [
"cfg-if 1.0.0",
"wasm-bindgen-macro",
@ -1883,9 +1854,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.71"
version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8"
checksum = "ae70622411ca953215ca6d06d3ebeb1e915f0f6613e3b495122878d7ebec7dae"
dependencies = [
"bumpalo",
"lazy_static",
@ -1898,9 +1869,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.21"
version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e67a5806118af01f0d9045915676b22aaebecf4178ae7021bc171dab0b897ab"
checksum = "81b8b767af23de6ac18bf2168b690bed2902743ddf0fb39252e36f9e2bfc63ea"
dependencies = [
"cfg-if 1.0.0",
"js-sys",
@ -1910,9 +1881,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.71"
version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b"
checksum = "3e734d91443f177bfdb41969de821e15c516931c3c3db3d318fa1b68975d0f6f"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -1920,9 +1891,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.71"
version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e"
checksum = "d53739ff08c8a68b0fdbcd54c372b8ab800b1449ab3c9d706503bc7dd1621b2c"
dependencies = [
"proc-macro2",
"quote",
@ -1933,9 +1904,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.71"
version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1"
checksum = "d9a543ae66aa233d14bb765ed9af4a33e81b8b58d1584cf1b47ff8cd0b9e4489"
[[package]]
name = "wasmer"
@ -2139,27 +2110,27 @@ checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf"
[[package]]
name = "wast"
version = "35.0.0"
version = "35.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db5ae96da18bb5926341516fd409b5a8ce4e4714da7f0a1063d3b20ac9f9a1e1"
checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68"
dependencies = [
"leb128",
]
[[package]]
name = "wat"
version = "1.0.36"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b0fa059022c5dabe129f02b429d67086400deb8277f89c975555dacc1dadbcc"
checksum = "8ec280a739b69173e0ffd12c1658507996836ba4e992ed9bc1e5385a0bd72a02"
dependencies = [
"wast",
]
[[package]]
name = "web-sys"
version = "0.3.48"
version = "0.3.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b"
checksum = "a905d57e488fec8861446d3393670fb50d27a262344013181c2cdf9fff5481be"
dependencies = [
"js-sys",
"wasm-bindgen",
@ -2176,12 +2147,12 @@ dependencies = [
[[package]]
name = "which"
version = "4.0.2"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87c14ef7e1b8b8ecfc75d5eca37949410046e66f15d185c01d70824f1f8111ef"
checksum = "b55551e42cbdf2ce2bedd2203d0cc08dba002c27510f86dab6d0ce304cba3dfe"
dependencies = [
"either",
"libc",
"thiserror",
]
[[package]]
@ -2200,15 +2171,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
@ -2255,11 +2217,9 @@ dependencies = [
"strum",
"termion",
"termios",
"toml",
"unicode-truncate",
"unicode-width",
"vte 0.8.0",
"walkdir",
"wasmer",
"wasmer-wasi",
"zellij-tile",

View file

@ -7,9 +7,6 @@ description = "Terminal workspace (WIP)"
license = "MIT"
repository = "https://github.com/zellij-org/zellij"
[features]
publish = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
@ -47,10 +44,7 @@ features = ["unstable"]
insta = "1.6.0"
[build-dependencies]
directories-next = "2.0"
structopt = "0.3"
walkdir = "2"
toml = "0.5.8"
[workspace]
members = [
@ -58,6 +52,7 @@ members = [
"default-tiles/status-bar",
"default-tiles/strider",
"default-tiles/tab-bar",
".",
]
[profile.release]

167
Makefile.toml Normal file
View file

@ -0,0 +1,167 @@
# Global Settings
[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
SKIP_TEST = false
# Add clippy to the default flow
[tasks.dev-test-flow]
dependencies = [
"format-flow",
"format-toml-conditioned-flow",
"pre-build",
"build",
"post-build",
"test-flow",
"clippy",
]
# Patching the default flows to skip testing of wasm32-wasi targets
[tasks.pre-test]
condition = { env = { "CARGO_MAKE_CRATE_TARGET_TRIPLE" = "wasm32-wasi" } }
env = { "SKIP_TEST" = true }
[tasks.test]
condition = { env_false = ["SKIP_TEST"] }
dependencies = ["pre-test"]
[tasks.post-test]
env = { "SKIP_TEST" = false }
# Running Zellij using patched layouts
[tasks.run]
workspace = false
dependencies = ["build-workspace", "patch-layouts"]
run_task = "launch"
[tasks.build-workspace]
run_task = { name = "build", fork = true }
[tasks.patch-layouts]
script_runner = "@rust"
script = '''
//! ```cargo
//! [dependencies]
//! yaml-rust = "0.4"
//! ```
use std::{env, error::Error, fs, path::Path};
use yaml_rust::{Yaml, YamlEmitter, YamlLoader};
fn main() -> Result<(), Box<dyn Error>> {
let root = env::var("CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY")?;
let layout_path = Path::new(&root).join("assets/layouts");
for layout in fs::read_dir(layout_path)? {
let layout = layout?.path();
let yaml = fs::read_to_string(&layout)?;
let yaml = YamlLoader::load_from_str(&yaml)?.remove(0);
let yaml = patch_plugins(&root, yaml);
let new_layout = Path::new(&root)
.join("target")
.join(layout.file_name().unwrap());
let mut new_yaml = String::new();
let mut emitter = YamlEmitter::new(&mut new_yaml);
emitter.dump(&yaml)?;
fs::write(new_layout, new_yaml)?;
}
Ok(())
}
fn patch_plugins(root: &str, part: Yaml) -> Yaml {
let mut map = part.into_hash().unwrap();
if let Some(plugin) = map.get_mut(&Yaml::from_str("plugin")) {
let new_plugin = Path::new(root)
.join("target/wasm32-wasi/debug")
.join(plugin.as_str().unwrap());
*plugin = Yaml::String(new_plugin.to_string_lossy().into_owned());
}
if let Some(parts) = map.get_mut(&Yaml::from_str("parts")) {
let new_parts = parts
.clone()
.into_iter()
.map(|p| patch_plugins(root, p))
.collect();
*parts = Yaml::Array(new_parts);
}
Yaml::Hash(map)
}
'''
[tasks.pre-launch]
script_runner = "@duckscript"
script = '''
if is_empty ${CARGO_MAKE_TASK_ARGS}
set_env CARGO_MAKE_TASK_ARGS default
end
'''
[tasks.launch]
dependencies = ["pre-launch"]
command = "cargo"
args = ["run", "--", "-l", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${CARGO_MAKE_TASK_ARGS}.yaml"]
# Simple clippy tweak
[tasks.clippy]
args = ["clippy", "--", "@@split(CARGO_MAKE_TASK_ARGS,;)"]
# Release building and installing Zellij
[tasks.install]
workspace = false
dependencies = ["build-tiles-release", "wasm-opt-tiles", "build-release", "clear-data-directory"]
script_runner = "@duckscript"
script = '''
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/release/${CARGO_MAKE_CRATE_NAME} ${CARGO_MAKE_TASK_ARGS}
'''
[tasks.build-tiles-release]
env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = ["."] }
run_task = { name = "build-release", fork = true }
[tasks.wasm-opt-tiles]
script_runner = "@duckscript"
script = '''
tiles = glob_array ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/wasm32-wasi/release/*.wasm
for tile in ${tiles}
tile_name = basename ${tile}
tile_out = set ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/assets/plugins/${tile_name}
if is_path_newer ${tile} ${tile_out}
exec wasm-opt -O ${tile} -o ${tile_out}
end
end
'''
# FIXME: Maybe this should be more generic? Or just blow away the whole directory?
[tasks.clear-data-directory]
script_runner = "@rust"
script = '''
//! ```cargo
//! [dependencies]
//! directories-next = "2.0"
//! ```
use directories_next::ProjectDirs;
use std::fs;
fn main() {
let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
let data_dir = project_dirs.data_dir();
drop(fs::remove_file(data_dir.join("plugins/status-bar.wasm")));
drop(fs::remove_file(data_dir.join("plugins/tab-bar.wasm")));
drop(fs::remove_file(data_dir.join("plugins/strider.wasm")));
drop(fs::remove_file(data_dir.join("layouts/default.yaml")));
drop(fs::remove_file(data_dir.join("layouts/strider.yaml")));
}
'''
# Publishing Zellij
[tasks.publish]
clear = true
workspace = false
dependencies = ["build-tiles-release", "wasm-opt-tiles", "build-release", "publish-zellij-tile", "publish-zellij"]
[tasks.publish-zellij-tile]
cwd = "zellij-tile"
command = "cargo"
args = ["publish"]
[tasks.publish-zellij]
command = "cargo"
args = ["publish"]

View file

@ -30,12 +30,16 @@ Zellij was initially called "Mosaic".
## How to use it?
* Clone the project
* In the project folder, run: `./build-all.sh && cargo run`
* Install cargo-make with `cargo install --force cargo-make`
* Make sure that the `~/.cargo/bin` directory is on your PATH
* In the project folder, run: `cargo make run`
(note that right now Zellij only supports linux and mac)
The status bar on the bottom should guide you through the possible keyboard shortcuts in the app.
For more build commands, take a look at [`Contributing.md`](CONTRIBUTING.md).
# Configuration
It is possible to configure keyboard shortcuts and their actions in a yaml file.
An example file can be found under `example/config.yaml`.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,25 +0,0 @@
#!/bin/sh
total=5
# This is temporary while https://github.com/rust-lang/cargo/issues/7004 is open
echo "Building status-bar (1/$total)..."
cd default-tiles/status-bar
cargo build --release --target-dir ../../target
echo "Building strider (2/$total)..."
cd ../strider
cargo build --release --target-dir ../../target
echo "Building tab-bar (3/$total)..."
cd ../tab-bar
cargo build --release --target-dir ../../target
echo "Optimising WASM executables (4/$total)..."
cd ../..
wasm-opt -O target/wasm32-wasi/release/status-bar.wasm -o target/status-bar.wasm || cp target/wasm32-wasi/release/status-bar.wasm target/status-bar.wasm
wasm-opt -O target/wasm32-wasi/release/strider.wasm -o target/strider.wasm || cp target/wasm32-wasi/release/strider.wasm target/strider.wasm
wasm-opt -O target/wasm32-wasi/release/tab-bar.wasm -o target/tab-bar.wasm || cp target/wasm32-wasi/release/tab-bar.wasm target/tab-bar.wasm
echo "Building zellij (5/$total)..."
cargo build --target-dir target $@

View file

@ -1,7 +1,5 @@
use directories_next::ProjectDirs;
use std::{ffi::OsStr, fs};
use std::fs;
use structopt::clap::Shell;
use walkdir::WalkDir;
include!("src/cli.rs");
@ -22,32 +20,4 @@ fn main() {
clap_app.gen_completions(BIN_NAME, Shell::Bash, &out_dir);
clap_app.gen_completions(BIN_NAME, Shell::Zsh, &out_dir);
clap_app.gen_completions(BIN_NAME, Shell::Fish, &out_dir);
// Clear Default Plugins and Layouts
// Rerun on layout change
for entry in WalkDir::new("assets/layouts") {
let entry = entry.unwrap();
println!("cargo:rerun-if-changed={}", entry.path().to_string_lossy());
}
// Rerun on plugin change
#[cfg(not(feature = "publish"))]
let plugin_dir = "target";
#[cfg(feature = "publish")]
let plugin_dir = "assets/plugins";
for entry in WalkDir::new(plugin_dir) {
let entry = entry.unwrap();
if entry.path().extension() == Some(OsStr::new("wasm")) {
println!("cargo:rerun-if-changed={}", entry.path().to_string_lossy());
}
}
let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap();
let data_dir = project_dirs.data_dir();
drop(fs::remove_file(data_dir.join("plugins/status-bar.wasm")));
drop(fs::remove_file(data_dir.join("plugins/tab-bar.wasm")));
drop(fs::remove_file(data_dir.join("plugins/strider.wasm")));
drop(fs::remove_file(data_dir.join("layouts/default.yaml")));
drop(fs::remove_file(data_dir.join("layouts/strider.yaml")));
}

View file

@ -1,23 +0,0 @@
#!/bin/sh
total=6
echo "Building zellij-tile (1/$total)..."
cd zellij-tile
cargo build --release
echo "Building status-bar (2/$total)..."
cd ../default-tiles/status-bar
cargo build --release
echo "Building strider (3/$total)..."
cd ../strider
cargo build --release
echo "Building tab-bar (4/$total)..."
cd ../tab-bar
cargo build --release
echo "Optimising WASM executables (5/$total)..."
cd ../..
wasm-opt -O target/wasm32-wasi/release/status-bar.wasm -o assets/plugins/status-bar.wasm
wasm-opt -O target/wasm32-wasi/release/strider.wasm -o assets/plugins/strider.wasm
wasm-opt -O target/wasm32-wasi/release/tab-bar.wasm -o assets/plugins/tab-bar.wasm
echo "Publishing zellij (6/$total)..."
cargo publish --features publish $@

View file

@ -1,8 +1,4 @@
# https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file
[toolchain]
# can be further pinned eg:
# date: "stable-2020-07-10"
# version: "nightly-1.0.0"
channel = "1.49.0"
components = [ "rustfmt", "rust-src", "clippy", "rust-analysis"]
channel = "nightly"
components = ["rustfmt", "clippy", "rust-analysis"]
targets = ["wasm32-wasi"]

View file

@ -1,7 +1,10 @@
use crate::os_input_output::OsApi;
use crate::panes::{PaneId, PositionAndSize};
use crate::tab::Pane;
use std::collections::{BTreeMap, HashSet};
use std::{
cmp::Ordering,
collections::{BTreeMap, HashSet},
};
pub struct PaneResizer<'a> {
panes: &'a mut BTreeMap<PaneId, Box<dyn Pane>>,
@ -29,63 +32,72 @@ impl<'a> PaneResizer<'a> {
let mut successfully_resized = false;
let mut column_difference: isize = 0;
let mut row_difference: isize = 0;
if new_size.columns < current_size.columns {
let reduce_by = current_size.columns - new_size.columns;
find_reducible_vertical_chain(
&self.panes,
reduce_by,
current_size.columns,
current_size.rows,
)
.map(|panes_to_resize| {
self.reduce_panes_left_and_pull_adjacents_left(panes_to_resize, reduce_by);
column_difference = new_size.columns as isize - current_size.columns as isize;
current_size.columns = (current_size.columns as isize + column_difference) as usize;
successfully_resized = true;
});
} else if new_size.columns > current_size.columns {
let increase_by = new_size.columns - current_size.columns;
find_increasable_vertical_chain(
&self.panes,
increase_by,
current_size.columns,
current_size.rows,
)
.map(|panes_to_resize| {
self.increase_panes_right_and_push_adjacents_right(panes_to_resize, increase_by);
column_difference = new_size.columns as isize - current_size.columns as isize;
current_size.columns = (current_size.columns as isize + column_difference) as usize;
successfully_resized = true;
});
match new_size.columns.cmp(&current_size.columns) {
Ordering::Greater => {
let increase_by = new_size.columns - current_size.columns;
if let Some(panes_to_resize) = find_increasable_vertical_chain(
&self.panes,
increase_by,
current_size.columns,
current_size.rows,
) {
self.increase_panes_right_and_push_adjacents_right(
panes_to_resize,
increase_by,
);
column_difference = new_size.columns as isize - current_size.columns as isize;
current_size.columns =
(current_size.columns as isize + column_difference) as usize;
successfully_resized = true;
};
}
Ordering::Less => {
let reduce_by = current_size.columns - new_size.columns;
if let Some(panes_to_resize) = find_reducible_vertical_chain(
&self.panes,
reduce_by,
current_size.columns,
current_size.rows,
) {
self.reduce_panes_left_and_pull_adjacents_left(panes_to_resize, reduce_by);
column_difference = new_size.columns as isize - current_size.columns as isize;
current_size.columns =
(current_size.columns as isize + column_difference) as usize;
successfully_resized = true;
};
}
Ordering::Equal => (),
}
if new_size.rows < current_size.rows {
let reduce_by = current_size.rows - new_size.rows;
find_reducible_horizontal_chain(
&self.panes,
reduce_by,
current_size.columns,
current_size.rows,
)
.map(|panes_to_resize| {
self.reduce_panes_up_and_pull_adjacents_up(panes_to_resize, reduce_by);
row_difference = new_size.rows as isize - current_size.rows as isize;
current_size.rows = (current_size.rows as isize + row_difference) as usize;
successfully_resized = true;
});
} else if new_size.rows > current_size.rows {
let increase_by = new_size.rows - current_size.rows;
find_increasable_horizontal_chain(
&self.panes,
increase_by,
current_size.columns,
current_size.rows,
)
.map(|panes_to_resize| {
self.increase_panes_down_and_push_down_adjacents(panes_to_resize, increase_by);
row_difference = new_size.rows as isize - current_size.rows as isize;
current_size.rows = (current_size.rows as isize + row_difference) as usize;
successfully_resized = true;
});
match new_size.rows.cmp(&current_size.rows) {
Ordering::Greater => {
let increase_by = new_size.rows - current_size.rows;
if let Some(panes_to_resize) = find_increasable_horizontal_chain(
&self.panes,
increase_by,
current_size.columns,
current_size.rows,
) {
self.increase_panes_down_and_push_down_adjacents(panes_to_resize, increase_by);
row_difference = new_size.rows as isize - current_size.rows as isize;
current_size.rows = (current_size.rows as isize + row_difference) as usize;
successfully_resized = true;
};
}
Ordering::Less => {
let reduce_by = current_size.rows - new_size.rows;
if let Some(panes_to_resize) = find_reducible_horizontal_chain(
&self.panes,
reduce_by,
current_size.columns,
current_size.rows,
) {
self.reduce_panes_up_and_pull_adjacents_up(panes_to_resize, reduce_by);
row_difference = new_size.rows as isize - current_size.rows as isize;
current_size.rows = (current_size.rows as isize + row_difference) as usize;
successfully_resized = true;
};
}
Ordering::Equal => (),
}
if successfully_resized {
Some((column_difference, row_difference))
@ -229,13 +241,12 @@ impl<'a> PaneResizer<'a> {
fn find_next_increasable_horizontal_pane(
panes: &BTreeMap<PaneId, Box<dyn Pane>>,
right_of: &Box<dyn Pane>,
right_of: &dyn Pane,
increase_by: usize,
) -> Option<PaneId> {
let next_pane_candidates = panes.values().filter(
|p| {
p.x() == right_of.x() + right_of.columns() + 1
&& p.horizontally_overlaps_with(right_of.as_ref())
p.x() == right_of.x() + right_of.columns() + 1 && p.horizontally_overlaps_with(right_of)
}, // TODO: the name here is wrong, it should be vertically_overlaps_with
);
let resizable_candidates =
@ -255,11 +266,11 @@ fn find_next_increasable_horizontal_pane(
fn find_next_increasable_vertical_pane(
panes: &BTreeMap<PaneId, Box<dyn Pane>>,
below: &Box<dyn Pane>,
below: &dyn Pane,
increase_by: usize,
) -> Option<PaneId> {
let next_pane_candidates = panes.values().filter(
|p| p.y() == below.y() + below.rows() + 1 && p.vertically_overlaps_with(below.as_ref()), // TODO: the name here is wrong, it should be horizontally_overlaps_with
|p| p.y() == below.y() + below.rows() + 1 && p.vertically_overlaps_with(below), // TODO: the name here is wrong, it should be horizontally_overlaps_with
);
let resizable_candidates =
next_pane_candidates.filter(|p| p.can_increase_width_by(increase_by));
@ -278,11 +289,11 @@ fn find_next_increasable_vertical_pane(
fn find_next_reducible_vertical_pane(
panes: &BTreeMap<PaneId, Box<dyn Pane>>,
below: &Box<dyn Pane>,
below: &dyn Pane,
reduce_by: usize,
) -> Option<PaneId> {
let next_pane_candidates = panes.values().filter(
|p| p.y() == below.y() + below.rows() + 1 && p.vertically_overlaps_with(below.as_ref()), // TODO: the name here is wrong, it should be horizontally_overlaps_with
|p| p.y() == below.y() + below.rows() + 1 && p.vertically_overlaps_with(below), // TODO: the name here is wrong, it should be horizontally_overlaps_with
);
let resizable_candidates = next_pane_candidates.filter(|p| p.can_reduce_width_by(reduce_by));
resizable_candidates.fold(None, |next_pane_id, p| match next_pane_id {
@ -300,13 +311,12 @@ fn find_next_reducible_vertical_pane(
fn find_next_reducible_horizontal_pane(
panes: &BTreeMap<PaneId, Box<dyn Pane>>,
right_of: &Box<dyn Pane>,
right_of: &dyn Pane,
reduce_by: usize,
) -> Option<PaneId> {
let next_pane_candidates = panes.values().filter(
|p| {
p.x() == right_of.x() + right_of.columns() + 1
&& p.horizontally_overlaps_with(right_of.as_ref())
p.x() == right_of.x() + right_of.columns() + 1 && p.horizontally_overlaps_with(right_of)
}, // TODO: the name here is wrong, it should be vertically_overlaps_with
);
let resizable_candidates = next_pane_candidates.filter(|p| p.can_reduce_height_by(reduce_by));
@ -351,7 +361,11 @@ fn find_increasable_horizontal_chain(
if current_pane.x() + current_pane.columns() == screen_width {
return Some(panes_to_resize);
}
match find_next_increasable_horizontal_pane(panes, &current_pane, increase_by) {
match find_next_increasable_horizontal_pane(
panes,
current_pane.as_ref(),
increase_by,
) {
Some(next_pane_id) => {
current_pane = panes.get(&next_pane_id).unwrap();
}
@ -397,7 +411,11 @@ fn find_increasable_vertical_chain(
if current_pane.y() + current_pane.rows() == screen_height {
return Some(panes_to_resize);
}
match find_next_increasable_vertical_pane(panes, &current_pane, increase_by) {
match find_next_increasable_vertical_pane(
panes,
current_pane.as_ref(),
increase_by,
) {
Some(next_pane_id) => {
current_pane = panes.get(&next_pane_id).unwrap();
}
@ -443,7 +461,11 @@ fn find_reducible_horizontal_chain(
if current_pane.x() + current_pane.columns() == screen_width {
return Some(panes_to_resize);
}
match find_next_reducible_horizontal_pane(panes, &current_pane, reduce_by) {
match find_next_reducible_horizontal_pane(
panes,
current_pane.as_ref(),
reduce_by,
) {
Some(next_pane_id) => {
current_pane = panes.get(&next_pane_id).unwrap();
}
@ -489,7 +511,11 @@ fn find_reducible_vertical_chain(
if current_pane.y() + current_pane.rows() == screen_height {
return Some(panes_to_resize);
}
match find_next_reducible_vertical_pane(panes, &current_pane, increase_by) {
match find_next_reducible_vertical_pane(
panes,
current_pane.as_ref(),
increase_by,
) {
Some(next_pane_id) => {
current_pane = panes.get(&next_pane_id).unwrap();
}

View file

@ -29,11 +29,9 @@ fn get_top_non_canonical_rows(rows: &mut Vec<Row>) -> Vec<Row> {
fn get_bottom_canonical_row_and_wraps(rows: &mut Vec<Row>) -> Vec<Row> {
let mut index_of_last_non_canonical_row = None;
for (i, row) in rows.iter().enumerate().rev() {
index_of_last_non_canonical_row = Some(i);
if row.is_canonical {
index_of_last_non_canonical_row = Some(i);
break;
} else {
index_of_last_non_canonical_row = Some(i);
}
}
match index_of_last_non_canonical_row {
@ -496,9 +494,7 @@ impl Grid {
}
pub fn add_character(&mut self, terminal_character: TerminalCharacter) {
// TODO: try to separate adding characters from moving the cursors in this function
if self.cursor.x < self.width {
self.insert_character_at_cursor_position(terminal_character);
} else {
if self.cursor.x >= self.width {
// line wrap
self.cursor.x = 0;
if self.cursor.y == self.height - 1 {
@ -519,8 +515,8 @@ impl Grid {
self.viewport.push(line_wrapped_row);
}
}
self.insert_character_at_cursor_position(terminal_character);
}
self.insert_character_at_cursor_position(terminal_character);
self.move_cursor_forward_until_edge(1);
}
pub fn move_cursor_forward_until_edge(&mut self, count: usize) {

View file

@ -1,5 +1,3 @@
#![allow(clippy::clippy::if_same_then_else)]
use crate::{common::SenderWithContext, pty_bus::VteBytes, tab::Pane, wasm_vm::PluginInstruction};
use std::{sync::mpsc::channel, unimplemented};

View file

@ -48,7 +48,7 @@ pub enum NamedColor {
}
impl NamedColor {
fn to_foreground_ansi_code(&self) -> String {
fn to_foreground_ansi_code(self) -> String {
match self {
NamedColor::Black => format!("{}", 30),
NamedColor::Red => format!("{}", 31),
@ -68,7 +68,7 @@ impl NamedColor {
NamedColor::BrightWhite => format!("{}", 97),
}
}
fn to_background_ansi_code(&self) -> String {
fn to_background_ansi_code(self) -> String {
match self {
NamedColor::Black => format!("{}", 40),
NamedColor::Red => format!("{}", 41),

View file

@ -1,5 +1,3 @@
#![allow(clippy::clippy::if_same_then_else)]
use crate::tab::Pane;
use ::nix::pty::Winsize;
use ::std::os::unix::io::RawFd;
@ -566,12 +564,6 @@ impl vte::Perform for TerminalPane {
} else {
self.grid.clear_scroll_region();
}
} else if c == 't' {
// TBD - title?
} else if c == 'n' {
// TBD - device status report
} else if c == 'c' {
// TBD - identify terminal
} else if c == 'M' {
// delete lines if currently inside scroll region
let line_count_to_delete = if params[0] == 0 {

View file

@ -205,6 +205,7 @@ pub trait Pane {
impl Tab {
// FIXME: Too many arguments here! Maybe bundle all of the senders for the whole program in a struct?
#[allow(clippy::too_many_arguments)]
pub fn new(
index: usize,
position: usize,
@ -1720,24 +1721,22 @@ impl Tab {
// this is not ideal but until we get rid of expansion_boundary, it's a necessity
self.toggle_active_pane_fullscreen();
}
match PaneResizer::new(&mut self.panes, &mut self.os_api)
.resize(self.full_screen_ws, new_screen_size)
if let Some((column_difference, row_difference)) =
PaneResizer::new(&mut self.panes, &mut self.os_api)
.resize(self.full_screen_ws, new_screen_size)
{
Some((column_difference, row_difference)) => {
self.should_clear_display_before_rendering = true;
self.expansion_boundary.as_mut().map(|expansion_boundary| {
// TODO: this is not always accurate
expansion_boundary.columns =
(expansion_boundary.columns as isize + column_difference) as usize;
expansion_boundary.rows =
(expansion_boundary.rows as isize + row_difference) as usize;
});
self.full_screen_ws.columns =
(self.full_screen_ws.columns as isize + column_difference) as usize;
self.full_screen_ws.rows =
(self.full_screen_ws.rows as isize + row_difference) as usize;
}
None => {}
self.should_clear_display_before_rendering = true;
if let Some(expansion_boundary) = self.expansion_boundary.as_mut() {
// TODO: this is not always accurate
expansion_boundary.columns =
(expansion_boundary.columns as isize + column_difference) as usize;
expansion_boundary.rows =
(expansion_boundary.rows as isize + row_difference) as usize;
};
self.full_screen_ws.columns =
(self.full_screen_ws.columns as isize + column_difference) as usize;
self.full_screen_ws.rows =
(self.full_screen_ws.rows as isize + row_difference) as usize;
};
}
pub fn resize_left(&mut self) {

View file

@ -51,7 +51,6 @@ impl Config {
}
/// Deserializes from given path.
#[allow(unused_must_use)]
pub fn new(path: &Path) -> ConfigResult {
match File::open(path) {
Ok(mut file) => {
@ -90,7 +89,6 @@ impl Config {
}
}
//#[allow(unused_must_use)]
/// In order not to mess up tests from changing configurations
#[cfg(test)]
pub fn from_cli_config(_: Option<ConfigCli>) -> ConfigResult {

View file

@ -84,15 +84,10 @@ fn handle_command_exit(mut child: Child) {
}
for signal in signals.pending() {
// FIXME: We need to handle more signals here!
#[allow(clippy::single_match)]
match signal {
SIGINT => {
child.kill().unwrap();
child.wait().unwrap();
break 'handle_exit;
}
_ => {}
if let SIGINT = signal {
child.kill().unwrap();
child.wait().unwrap();
break 'handle_exit;
}
}
}

View file

@ -81,7 +81,9 @@ pub struct Screen {
}
impl Screen {
// FIXME: This lint needs actual fixing! Maybe by bundling the Senders
/// Creates and returns a new [`Screen`].
#[allow(clippy::too_many_arguments)]
pub fn new(
receive_screen_instructions: Receiver<(ScreenInstruction, ErrorContext)>,
send_pty_instructions: SenderWithContext<PtyInstruction>,

View file

@ -47,8 +47,7 @@ pub fn _debug_log_to_file_pid_3(message: String, pid: RawFd) -> io::Result<()> {
}
}
#[allow(dead_code)]
pub fn delete_log_file() -> io::Result<()> {
pub fn _delete_log_file() -> io::Result<()> {
if fs::metadata(ZELLIJ_TMP_LOG_FILE).is_ok() {
fs::remove_file(ZELLIJ_TMP_LOG_FILE)
} else {
@ -56,8 +55,7 @@ pub fn delete_log_file() -> io::Result<()> {
}
}
#[allow(dead_code)]
pub fn delete_log_dir() -> io::Result<()> {
pub fn _delete_log_dir() -> io::Result<()> {
if fs::metadata(ZELLIJ_TMP_LOG_DIR).is_ok() {
fs::remove_dir_all(ZELLIJ_TMP_LOG_DIR)
} else {

View file

@ -18,9 +18,9 @@ pub fn adjust_to_size(s: &str, rows: usize, columns: usize) -> String {
if actual_len > columns {
let mut line = String::from(l);
line.truncate(columns);
return line;
line
} else {
return [l, &str::repeat(" ", columns - ansi_len(l))].concat();
[l, &str::repeat(" ", columns - ansi_len(l))].concat()
}
})
.chain(iter::repeat(str::repeat(" ", columns)))

View file

@ -34,14 +34,6 @@ pub fn main() {
"assets/layouts/default.yaml" => "layouts/default.yaml",
"assets/layouts/strider.yaml" => "layouts/strider.yaml",
};
// FIXME: This is a hideous hack and I hate it (a lot)
#[cfg(not(feature = "publish"))]
assets.extend(asset_map! {
"target/status-bar.wasm" => "plugins/status-bar.wasm",
"target/tab-bar.wasm" => "plugins/tab-bar.wasm",
"target/strider.wasm" => "plugins/strider.wasm",
});
#[cfg(feature = "publish")]
assets.extend(asset_map! {
"assets/plugins/status-bar.wasm" => "plugins/status-bar.wasm",
"assets/plugins/tab-bar.wasm" => "plugins/tab-bar.wasm",