diff --git a/Cargo.lock b/Cargo.lock index d93f68cc5..b7edee505 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,15 +37,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4361135be9122e0870de935d7c439aef945b9f9ddd4199a553b5270b49c82a27" +checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" [[package]] name = "arc-swap" -version = "0.4.8" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" +checksum = "c5d78ce20460b82d3fa150275ed9d55e21064fc7951177baacf86a145c4a4b1f" [[package]] name = "arrayvec" @@ -80,25 +80,24 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.0.3" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c026b7e44f1316b567ee750fea85103f87fcb80792b860e979f221259796ca0a" +checksum = "fd8b508d585e01084059b60f06ade4cb7415cd2e4084b71dd1cb44e7d3fb9880" dependencies = [ "async-channel", "async-executor", "async-io", - "async-mutex", + "async-lock", "blocking", "futures-lite", - "num_cpus", "once_cell", ] [[package]] name = "async-io" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b" +checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07" dependencies = [ "concurrent-queue", "futures-lite", @@ -123,19 +122,10 @@ dependencies = [ ] [[package]] -name = "async-mutex" +name = "async-process" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-process" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6" +checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c" dependencies = [ "async-io", "blocking", @@ -144,15 +134,15 @@ dependencies = [ "futures-lite", "libc", "once_cell", - "signal-hook 0.3.13", + "signal-hook 0.3.14", "winapi", ] [[package]] name = "async-std" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8056f1455169ab86dd47b47391e4ab0cbd25410a70e9fe675544f49bafaf952" +checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c" dependencies = [ "async-channel", "async-global-executor", @@ -184,9 +174,9 @@ checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" [[package]] name = "async-trait" -version = "0.1.52" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3" +checksum = "159c7edec63db93c5eb1e5e6928f6dec9aea1174cf983a8e5fc4caa179792814" dependencies = [ "proc-macro2", "quote", @@ -218,16 +208,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" +checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" dependencies = [ "addr2line", "cc", "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.27.1", + "object 0.28.4", "rustc-demangle", ] @@ -304,9 +294,9 @@ checksum = "5988cb1d626264ac94100be357308f29ff7cbdd3b36bda27f450a4ee3f713426" [[package]] name = "bumpalo" -version = "3.9.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" +checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" [[package]] name = "byte-tools" @@ -365,16 +355,16 @@ dependencies = [ [[package]] name = "clap" -version = "3.1.6" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123" +checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b" dependencies = [ "atty", "bitflags", "clap_derive", + "clap_lex", "indexmap", "lazy_static", - "os_str_bytes", "strsim", "termcolor", "textwrap 0.15.0", @@ -382,18 +372,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "3.1.1" +version = "3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25" +checksum = "da92e6facd8d73c22745a5d3cbb59bdf8e46e3235c923e516527d8e81eec14a4" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "3.1.4" +version = "3.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16" +checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c" dependencies = [ "heck 0.4.0", "proc-macro-error", @@ -402,6 +392,15 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_lex" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "close_fds" version = "0.3.2" @@ -429,6 +428,17 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dfdf9179d546b55ff3f88c9d93ecfaa3e9760163da5a1080af5243230dbbb70" +[[package]] +name = "compact-bar" +version = "0.1.0" +dependencies = [ + "ansi_term", + "colored", + "unicode-width", + "zellij-tile", + "zellij-tile-utils", +] + [[package]] name = "concurrent-queue" version = "1.2.2" @@ -461,9 +471,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" dependencies = [ "libc", ] @@ -642,9 +652,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ "darling_core", "darling_macro", @@ -652,23 +662,22 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", "syn", ] [[package]] name = "darling_macro" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ "darling_core", "quote", @@ -771,18 +780,18 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "enumset" -version = "1.0.8" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6216d2c19a6fb5f29d1ada1dc7bc4367a8cbf0fa4af5cf12e07b5bbdde6b5b2c" +checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" dependencies = [ "enumset_derive", ] [[package]] name = "enumset_derive" -version = "0.5.5" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6451128aa6655d880755345d085494cf7561a6bee7c8dc821e5d77e6d267ecd4" +checksum = "ea83a3fbdc1d999ccfbcbee717eab36f8edf2d71693a23ce0d7cca19e085304c" dependencies = [ "darling", "proc-macro2", @@ -1008,9 +1017,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" dependencies = [ "cfg-if 1.0.0", "libc", @@ -1019,9 +1028,9 @@ dependencies = [ [[package]] name = "ghost" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5bcf1bbeab73aa4cf2fde60a846858dc036163c7c33bec309f8d17de785479" +checksum = "76c813ffb63e8fd3df6f1ac3cc1ea392c7612ac2de4d0b44dcbfe03e5c4bf94a" dependencies = [ "proc-macro2", "quote", @@ -1047,9 +1056,9 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" [[package]] name = "gloo-timers" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d12a7f4e95cfe710f1d624fb1210b7d961a5fb05c4fd942f4feab06e61f590e" +checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" dependencies = [ "futures-channel", "futures-core", @@ -1124,9 +1133,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.8.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" dependencies = [ "autocfg", "hashbrown", @@ -1135,9 +1144,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.13.0" +version = "1.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a7e1911532a662f6b08b68f884080850f2fd9544963c3ab23a5af42bda1eac" +checksum = "bcc3e639bcba360d9237acabd22014c16f3df772db463b7446cd81b070714767" dependencies = [ "console", "once_cell", @@ -1181,9 +1190,9 @@ checksum = "ae52f28f45ac2bc96edb7714de995cffc174a395fb0abf5bff453587c980d7b9" [[package]] name = "inventory" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6b5d8c669bfbad811d95ddd7a1c6cf9cfdbf2777e59928b6f3fa8ff54f72a0" +checksum = "84344c6e0b90a9e2b6f3f9abe5cc74402684e348df7b32adca28747e0cef091a" dependencies = [ "ctor", "ghost", @@ -1197,15 +1206,15 @@ checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "js-sys" -version = "0.3.56" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" +checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" dependencies = [ "wasm-bindgen", ] @@ -1239,9 +1248,9 @@ checksum = "72d9d1bd215936bc8647ad92986bb56f3f216550b53c44ab785e3217ae33625e" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" [[package]] name = "libloading" @@ -1269,9 +1278,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.5" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f35facd4a5673cb5a48822be2be1d4236c1c99cb4113cab7061ac720d5bf859" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" dependencies = [ "cc", "libc", @@ -1287,10 +1296,11 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" [[package]] name = "lock_api" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" dependencies = [ + "autocfg", "scopeguard", ] @@ -1313,9 +1323,9 @@ checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" [[package]] name = "log4rs" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1572a880d1115ff867396eee7ae2bc924554225e67a0d3c85c745b3e60ca211" +checksum = "893eaf59f4bef8e2e94302adf56385db445a0306b9823582b0b8d5a06d8822f3" dependencies = [ "anyhow", "arc-swap", @@ -1326,8 +1336,7 @@ dependencies = [ "libc", "log", "log-mdc", - "parking_lot", - "regex", + "parking_lot 0.12.1", "serde", "serde-value", "serde_json", @@ -1361,9 +1370,9 @@ checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" @@ -1421,12 +1430,11 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" dependencies = [ "adler", - "autocfg", ] [[package]] @@ -1511,9 +1519,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", "num-traits", @@ -1521,9 +1529,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] @@ -1550,18 +1558,18 @@ dependencies = [ [[package]] name = "object" -version = "0.27.1" +version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.10.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" [[package]] name = "opaque-debug" @@ -1577,9 +1585,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl-sys" -version = "0.9.72" +version = "0.9.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" +checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1" dependencies = [ "autocfg", "cc", @@ -1599,18 +1607,15 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.0.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" -dependencies = [ - "memchr", -] +checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" [[package]] name = "owo-colors" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e72e30578e0d0993c8ae20823dd9cff2bc5517d2f586a8aef462a581e8a03eb" +checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b" [[package]] name = "parking" @@ -1626,7 +1631,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.3", ] [[package]] @@ -1638,11 +1653,24 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.11", + "redox_syscall", "smallvec", "winapi", ] +[[package]] +name = "parking_lot_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -1748,9 +1776,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -1760,9 +1788,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "polling" @@ -1825,18 +1853,18 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.16" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4af2ec4714533fcdf07e886f17025ace8b997b9ce51204ee69b6da831c3da57" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" dependencies = [ "proc-macro2", ] @@ -1901,7 +1929,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "getrandom 0.2.5", + "getrandom 0.2.6", ] [[package]] @@ -1924,9 +1952,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" dependencies = [ "autocfg", "crossbeam-deque", @@ -1936,40 +1964,33 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", "num_cpus", ] [[package]] name = "redox_syscall" -version = "0.1.57" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" dependencies = [ "bitflags", ] [[package]] name = "redox_users" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7776223e2696f1aa4c6b0170e83212f47296a00424305117d013dfe86fb0fe55" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.5", - "redox_syscall 0.2.11", + "getrandom 0.2.6", + "redox_syscall", "thiserror", ] @@ -1986,9 +2007,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.5" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" dependencies = [ "aho-corasick", "memchr", @@ -1997,9 +2018,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.6.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" [[package]] name = "region" @@ -2036,9 +2057,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "scopeguard" @@ -2066,9 +2087,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" dependencies = [ "serde_derive", ] @@ -2085,18 +2106,18 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9" +checksum = "212e73464ebcde48d723aa02eb270ba62eff38a9b732df31f33f1b4e145f3a54" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.136" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" dependencies = [ "proc-macro2", "quote", @@ -2105,9 +2126,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ "itoa", "ryu", @@ -2116,9 +2137,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a521f2940385c165a24ee286aa8599633d162077a54bdcae2a6fd5a7bfa7a0" +checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" dependencies = [ "indexmap", "ryu", @@ -2163,9 +2184,9 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" +checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" dependencies = [ "libc", "signal-hook-registry", @@ -2194,9 +2215,9 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] name = "slab" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" @@ -2238,7 +2259,7 @@ dependencies = [ "bitflags", "libc", "libssh2-sys", - "parking_lot", + "parking_lot 0.11.2", ] [[package]] @@ -2344,13 +2365,13 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.89" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea297be220d52398dcc07ce15a209fce436d361735ac1db700cab3b6cdfb9f54" +checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" dependencies = [ "proc-macro2", "quote", - "unicode-xid", + "unicode-ident", ] [[package]] @@ -2394,7 +2415,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "libc", - "redox_syscall 0.2.11", + "redox_syscall", "remove_dir_all", "winapi", ] @@ -2496,18 +2517,18 @@ checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" dependencies = [ "proc-macro2", "quote", @@ -2516,12 +2537,12 @@ dependencies = [ [[package]] name = "thread-id" -version = "3.3.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" +checksum = "5fdfe0627923f7411a43ec9ec9c39c3a9b4151be313e0922042581fb6c9b717f" dependencies = [ "libc", - "redox_syscall 0.1.57", + "redox_syscall", "winapi", ] @@ -2538,9 +2559,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" dependencies = [ "tinyvec_macros", ] @@ -2553,9 +2574,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tracing" -version = "0.1.32" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1bdf54a7c28a2bbf701e1d2233f6c77f473486b94bee4f9678da5a148dca7f" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" dependencies = [ "cfg-if 1.0.0", "log", @@ -2566,9 +2587,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" +checksum = "cc6b8ad3567499f98a1db7a752b07a7c8c7c7c34c332ec00effb2b0027974b7c" dependencies = [ "proc-macro2", "quote", @@ -2577,9 +2598,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa31669fa42c09c34d94d8165dd2012e8ff3c66aca50f3bb226b68f216f2706c" +checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" dependencies = [ "lazy_static", ] @@ -2637,9 +2658,15 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] name = "unicode-bidi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" + +[[package]] +name = "unicode-ident" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee" [[package]] name = "unicode-linebreak" @@ -2671,12 +2698,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" -[[package]] -name = "unicode-xid" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" - [[package]] name = "unsafe-any" version = "0.4.2" @@ -2777,9 +2798,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.79" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -2787,9 +2808,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.79" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" dependencies = [ "bumpalo", "lazy_static", @@ -2802,9 +2823,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.29" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb6ec270a31b1d3c7e266b999739109abce8b6c87e4b31fcfcd788b65267395" +checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -2814,9 +2835,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.79" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2824,9 +2845,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.79" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" dependencies = [ "proc-macro2", "quote", @@ -2837,9 +2858,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.79" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "wasmer" @@ -3024,7 +3045,7 @@ dependencies = [ "bincode", "byteorder", "generational-arena", - "getrandom 0.2.5", + "getrandom 0.2.6", "libc", "serde", "thiserror", @@ -3043,9 +3064,9 @@ checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf" [[package]] name = "wast" -version = "39.0.0" +version = "41.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9bbbd53432b267421186feee3e52436531fa69a7cfee9403f5204352df3dd05" +checksum = "f882898b8b817cc4edc16aa3692fdc087b356edc8cc0c2164f5b5181e31c3870" dependencies = [ "leb128", "memchr", @@ -3054,18 +3075,18 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.41" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab98ed25494f97c69f28758617f27c3e92e5336040b5c3a14634f2dd3fe61830" +checksum = "48b3b9b3e39e66c7fd3f8be785e74444d216260f491e93369e317ed6482ff80f" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.56" +version = "0.3.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" +checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" dependencies = [ "js-sys", "wasm-bindgen", @@ -3141,6 +3162,49 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + [[package]] name = "yaml-rust" version = "0.4.5" @@ -3248,7 +3312,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "signal-hook 0.3.13", + "signal-hook 0.3.14", "strip-ansi-escapes", "strum", "tempfile", @@ -3262,6 +3326,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.5.4" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb5728b8afd3f280a869ce1d4c554ffaed35f45c231fc41bfbd0381bef50317" +checksum = "94693807d016b2f2d2e14420eb3bfcca689311ff775dcf113d74ea624b7cdf07" diff --git a/Cargo.toml b/Cargo.toml index 4899c4df9..14b0a765c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,7 @@ members = [ "zellij-utils", "zellij-tile", "zellij-tile-utils", + "default-plugins/compact-bar", "default-plugins/status-bar", "default-plugins/strider", "default-plugins/tab-bar", diff --git a/Makefile.toml b/Makefile.toml index 2d3e7ec82..edbc18280 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -109,6 +109,7 @@ end [tasks.build-plugins-release] env = { "CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS" = [ + "default-plugins/compact-bar", "default-plugins/status-bar", "default-plugins/strider", "default-plugins/tab-bar", @@ -117,6 +118,7 @@ run_task = { name = "build-release", fork = true } [tasks.build-plugins] env = { "CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS" = [ + "default-plugins/compact-bar", "default-plugins/status-bar", "default-plugins/strider", "default-plugins/tab-bar", diff --git a/assets/plugins/compact-bar.wasm b/assets/plugins/compact-bar.wasm new file mode 100755 index 000000000..21374cb5e Binary files /dev/null and b/assets/plugins/compact-bar.wasm differ diff --git a/default-plugins/compact-bar/.cargo/config.toml b/default-plugins/compact-bar/.cargo/config.toml new file mode 100644 index 000000000..6b77899cb --- /dev/null +++ b/default-plugins/compact-bar/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "wasm32-wasi" diff --git a/default-plugins/compact-bar/Cargo.toml b/default-plugins/compact-bar/Cargo.toml new file mode 100644 index 000000000..6f45e2c40 --- /dev/null +++ b/default-plugins/compact-bar/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "compact-bar" +version = "0.1.0" +authors = ["Alexander Kenji Berthold " ] +edition = "2021" +license = "MIT" + +[dependencies] +colored = "2" +ansi_term = "0.12" +unicode-width = "0.1.8" +zellij-tile = { path = "../../zellij-tile" } +zellij-tile-utils = { path = "../../zellij-tile-utils" } diff --git a/default-plugins/compact-bar/LICENSE.md b/default-plugins/compact-bar/LICENSE.md new file mode 120000 index 000000000..f0608a63a --- /dev/null +++ b/default-plugins/compact-bar/LICENSE.md @@ -0,0 +1 @@ +../../LICENSE.md \ No newline at end of file diff --git a/default-plugins/compact-bar/src/line.rs b/default-plugins/compact-bar/src/line.rs new file mode 100644 index 000000000..5cd9c6873 --- /dev/null +++ b/default-plugins/compact-bar/src/line.rs @@ -0,0 +1,243 @@ +use ansi_term::ANSIStrings; +use unicode_width::UnicodeWidthStr; + +use crate::{LinePart, ARROW_SEPARATOR}; +use zellij_tile::prelude::*; +use zellij_tile_utils::style; + +fn get_current_title_len(current_title: &[LinePart]) -> usize { + current_title.iter().map(|p| p.len).sum() +} + +// move elements from before_active and after_active into tabs_to_render while they fit in cols +// adds collapsed_tabs to the left and right if there's left over tabs that don't fit +fn populate_tabs_in_tab_line( + tabs_before_active: &mut Vec, + tabs_after_active: &mut Vec, + tabs_to_render: &mut Vec, + cols: usize, + palette: Palette, + capabilities: PluginCapabilities, +) { + let mut middle_size = get_current_title_len(tabs_to_render); + + let mut total_left = 0; + let mut total_right = 0; + loop { + let left_count = tabs_before_active.len(); + let right_count = tabs_after_active.len(); + let collapsed_left = left_more_message(left_count, palette, tab_separator(capabilities)); + let collapsed_right = right_more_message(right_count, palette, tab_separator(capabilities)); + + let total_size = collapsed_left.len + middle_size + collapsed_right.len; + + if total_size > cols { + // break and dont add collapsed tabs to tabs_to_render, they will not fit + break; + } + + let left = if let Some(tab) = tabs_before_active.last() { + tab.len + } else { + usize::MAX + }; + + let right = if let Some(tab) = tabs_after_active.first() { + tab.len + } else { + usize::MAX + }; + + // total size is shortened if the next tab to be added is the last one, as that will remove the collapsed tab + let size_by_adding_left = + left.saturating_add(total_size) + .saturating_sub(if left_count == 1 { + collapsed_left.len + } else { + 0 + }); + let size_by_adding_right = + right + .saturating_add(total_size) + .saturating_sub(if right_count == 1 { + collapsed_right.len + } else { + 0 + }); + + let left_fits = size_by_adding_left <= cols; + let right_fits = size_by_adding_right <= cols; + // active tab is kept in the middle by adding to the side that + // has less width, or if the tab on the other side doesn' fit + if (total_left <= total_right || !right_fits) && left_fits { + // add left tab + let tab = tabs_before_active.pop().unwrap(); + middle_size += tab.len; + total_left += tab.len; + tabs_to_render.insert(0, tab); + } else if right_fits { + // add right tab + let tab = tabs_after_active.remove(0); + middle_size += tab.len; + total_right += tab.len; + tabs_to_render.push(tab); + } else { + // there's either no space to add more tabs or no more tabs to add, so we're done + tabs_to_render.insert(0, collapsed_left); + tabs_to_render.push(collapsed_right); + break; + } + } +} + +fn left_more_message(tab_count_to_the_left: usize, palette: Palette, separator: &str) -> LinePart { + if tab_count_to_the_left == 0 { + return LinePart::default(); + } + let more_text = if tab_count_to_the_left < 10000 { + format!(" ← +{} ", tab_count_to_the_left) + } else { + " ← +many ".to_string() + }; + // 238 + // chars length plus separator length on both sides + let more_text_len = more_text.width() + 2 * separator.width(); + let text_color = match palette.theme_hue { + ThemeHue::Dark => palette.white, + ThemeHue::Light => palette.black, + }; + let left_separator = style!(text_color, palette.orange).paint(separator); + let more_styled_text = style!(text_color, palette.orange).bold().paint(more_text); + let right_separator = style!(palette.orange, text_color).paint(separator); + let more_styled_text = + ANSIStrings(&[left_separator, more_styled_text, right_separator]).to_string(); + LinePart { + part: more_styled_text, + len: more_text_len, + } +} + +fn right_more_message( + tab_count_to_the_right: usize, + palette: Palette, + separator: &str, +) -> LinePart { + if tab_count_to_the_right == 0 { + return LinePart::default(); + }; + let more_text = if tab_count_to_the_right < 10000 { + format!(" +{} → ", tab_count_to_the_right) + } else { + " +many → ".to_string() + }; + // chars length plus separator length on both sides + let more_text_len = more_text.width() + 2 * separator.width(); + let text_color = match palette.theme_hue { + ThemeHue::Dark => palette.white, + ThemeHue::Light => palette.black, + }; + let left_separator = style!(text_color, palette.orange).paint(separator); + let more_styled_text = style!(text_color, palette.orange).bold().paint(more_text); + let right_separator = style!(palette.orange, text_color).paint(separator); + let more_styled_text = + ANSIStrings(&[left_separator, more_styled_text, right_separator]).to_string(); + LinePart { + part: more_styled_text, + len: more_text_len, + } +} + +fn tab_line_prefix( + session_name: Option<&str>, + mode: InputMode, + palette: Palette, + cols: usize, +) -> Vec { + let prefix_text = " Zellij ".to_string(); + + let prefix_text_len = prefix_text.chars().count(); + let text_color = match palette.theme_hue { + ThemeHue::Dark => palette.white, + ThemeHue::Light => palette.black, + }; + let bg_color = match palette.theme_hue { + ThemeHue::Dark => palette.black, + ThemeHue::Light => palette.white, + }; + let prefix_styled_text = style!(text_color, bg_color).bold().paint(prefix_text); + let mut parts = vec![LinePart { + part: prefix_styled_text.to_string(), + len: prefix_text_len, + }]; + if let Some(name) = session_name { + let name_part = format!("({}) ", name); + let name_part_len = name_part.width(); + let text_color = match palette.theme_hue { + ThemeHue::Dark => palette.white, + ThemeHue::Light => palette.black, + }; + let name_part_styled_text = style!(text_color, bg_color).bold().paint(name_part); + if cols.saturating_sub(prefix_text_len) >= name_part_len { + parts.push(LinePart { + part: name_part_styled_text.to_string(), + len: name_part_len, + }) + } + } + let mode_part = format!("({:?})", mode); + let mode_part_len = mode_part.width(); + let mode_part_styled_text = style!(text_color, bg_color).bold().paint(mode_part); + if cols.saturating_sub(prefix_text_len) >= mode_part_len { + parts.push(LinePart { + part: format!("({:^6})", mode_part_styled_text), + len: mode_part_len, + }) + } + parts +} + +pub fn tab_separator(capabilities: PluginCapabilities) -> &'static str { + if !capabilities.arrow_fonts { + ARROW_SEPARATOR + } else { + "" + } +} + +pub fn tab_line( + session_name: Option<&str>, + mut all_tabs: Vec, + active_tab_index: usize, + cols: usize, + palette: Palette, + capabilities: PluginCapabilities, + mode: InputMode, +) -> Vec { + let mut tabs_after_active = all_tabs.split_off(active_tab_index); + let mut tabs_before_active = all_tabs; + let active_tab = if !tabs_after_active.is_empty() { + tabs_after_active.remove(0) + } else { + tabs_before_active.pop().unwrap() + }; + let mut prefix = tab_line_prefix(session_name, mode, palette, cols); + let prefix_len = get_current_title_len(&prefix); + + // if active tab alone won't fit in cols, don't draw any tabs + if prefix_len + active_tab.len > cols { + return prefix; + } + + let mut tabs_to_render = vec![active_tab]; + + populate_tabs_in_tab_line( + &mut tabs_before_active, + &mut tabs_after_active, + &mut tabs_to_render, + cols.saturating_sub(prefix_len), + palette, + capabilities, + ); + prefix.append(&mut tabs_to_render); + prefix +} diff --git a/default-plugins/compact-bar/src/main.rs b/default-plugins/compact-bar/src/main.rs new file mode 100644 index 000000000..3e5e4a184 --- /dev/null +++ b/default-plugins/compact-bar/src/main.rs @@ -0,0 +1,137 @@ +mod line; +mod tab; + +use std::cmp::{max, min}; +use std::convert::TryInto; + +use zellij_tile::prelude::*; + +use crate::line::tab_line; +use crate::tab::tab_style; + +#[derive(Debug, Default)] +pub struct LinePart { + part: String, + len: usize, +} + +#[derive(Default)] +struct State { + tabs: Vec, + active_tab_idx: usize, + mode_info: ModeInfo, + mouse_click_pos: usize, + should_render: bool, +} + +static ARROW_SEPARATOR: &str = ""; + +register_plugin!(State); + +impl ZellijPlugin for State { + fn load(&mut self) { + set_selectable(false); + subscribe(&[ + EventType::TabUpdate, + EventType::ModeUpdate, + EventType::Mouse, + ]); + } + + fn update(&mut self, event: Event) { + match event { + Event::ModeUpdate(mode_info) => self.mode_info = mode_info, + Event::TabUpdate(tabs) => { + if let Some(active_tab_index) = tabs.iter().position(|t| t.active) { + // tabs are indexed starting from 1 so we need to add 1 + self.active_tab_idx = active_tab_index + 1; + self.tabs = tabs; + } else { + eprintln!("Could not find active tab."); + } + } + Event::Mouse(me) => match me { + Mouse::LeftClick(_, col) => { + self.mouse_click_pos = col; + self.should_render = true; + } + Mouse::ScrollUp(_) => { + switch_tab_to(min(self.active_tab_idx + 1, self.tabs.len()) as u32); + } + Mouse::ScrollDown(_) => { + switch_tab_to(max(self.active_tab_idx.saturating_sub(1), 1) as u32); + } + _ => {} + }, + _ => { + eprintln!("Got unrecognized event: {:?}", event); + } + } + } + + fn render(&mut self, _rows: usize, cols: usize) { + if self.tabs.is_empty() { + return; + } + let mut all_tabs: Vec = vec![]; + let mut active_tab_index = 0; + for t in &mut self.tabs { + let mut tabname = t.name.clone(); + if t.active && self.mode_info.mode == InputMode::RenameTab { + if tabname.is_empty() { + tabname = String::from("Enter name..."); + } + active_tab_index = t.position; + } else if t.active { + active_tab_index = t.position; + } + let tab = tab_style( + tabname, + t.active, + t.is_sync_panes_active, + self.mode_info.style.colors, + self.mode_info.capabilities, + t.other_focused_clients.as_slice(), + ); + all_tabs.push(tab); + } + let tab_line = tab_line( + self.mode_info.session_name.as_deref(), + all_tabs, + active_tab_index, + cols.saturating_sub(1), + self.mode_info.style.colors, + self.mode_info.capabilities, + self.mode_info.mode, + ); + let mut s = String::new(); + let mut len_cnt = 0; + for (idx, bar_part) in tab_line.iter().enumerate() { + s = format!("{}{}", s, &bar_part.part); + + if self.should_render + && self.mouse_click_pos > len_cnt + && self.mouse_click_pos <= len_cnt + bar_part.len + && idx > 2 + { + // First three elements of tab_line are "Zellij", session name and empty thing, hence the idx > 2 condition. + // Tabs are indexed starting from 1, therefore we need subtract 2 below. + switch_tab_to(TryInto::::try_into(idx).unwrap() - 2); + } + len_cnt += bar_part.len; + } + let background = match self.mode_info.style.colors.theme_hue { + ThemeHue::Dark => self.mode_info.style.colors.black, + ThemeHue::Light => self.mode_info.style.colors.white, + }; + match background { + PaletteColor::Rgb((r, g, b)) => { + println!("{}\u{1b}[48;2;{};{};{}m\u{1b}[0K", s, r, g, b); + } + PaletteColor::EightBit(color) => { + println!("{}\u{1b}[48;5;{}m\u{1b}[0K", s, color); + } + } + self.should_render = false; + } +} diff --git a/default-plugins/compact-bar/src/tab.rs b/default-plugins/compact-bar/src/tab.rs new file mode 100644 index 000000000..993489620 --- /dev/null +++ b/default-plugins/compact-bar/src/tab.rs @@ -0,0 +1,84 @@ +use crate::{line::tab_separator, LinePart}; +use ansi_term::{ANSIString, ANSIStrings}; +use unicode_width::UnicodeWidthStr; +use zellij_tile::prelude::*; +use zellij_tile_utils::style; + +fn cursors(focused_clients: &[ClientId], palette: Palette) -> (Vec, usize) { + // cursor section, text length + let mut len = 0; + let mut cursors = vec![]; + for client_id in focused_clients.iter() { + if let Some(color) = client_id_to_colors(*client_id, palette) { + cursors.push(style!(color.1, color.0).paint(" ")); + len += 1; + } + } + (cursors, len) +} + +pub fn render_tab( + text: String, + palette: Palette, + separator: &str, + focused_clients: &[ClientId], + active: bool, +) -> LinePart { + let background_color = if active { palette.green } else { palette.fg }; + let foreground_color = match palette.theme_hue { + ThemeHue::Dark => palette.black, + ThemeHue::Light => palette.white, + }; + let left_separator = style!(foreground_color, background_color).paint(separator); + let mut tab_text_len = text.width() + 2 + separator.width() * 2; // 2 for left and right separators, 2 for the text padding + + let tab_styled_text = style!(foreground_color, background_color) + .bold() + .paint(format!(" {} ", text)); + + let right_separator = style!(background_color, foreground_color).paint(separator); + let tab_styled_text = if !focused_clients.is_empty() { + let (cursor_section, extra_length) = cursors(focused_clients, palette); + tab_text_len += extra_length; + let mut s = String::new(); + let cursor_beginning = style!(foreground_color, background_color) + .bold() + .paint("[") + .to_string(); + let cursor_section = ANSIStrings(&cursor_section).to_string(); + let cursor_end = style!(foreground_color, background_color) + .bold() + .paint("]") + .to_string(); + s.push_str(&left_separator.to_string()); + s.push_str(&tab_styled_text.to_string()); + s.push_str(&cursor_beginning); + s.push_str(&cursor_section); + s.push_str(&cursor_end); + s.push_str(&right_separator.to_string()); + s + } else { + ANSIStrings(&[left_separator, tab_styled_text, right_separator]).to_string() + }; + + LinePart { + part: tab_styled_text, + len: tab_text_len, + } +} + +pub fn tab_style( + text: String, + is_active_tab: bool, + is_sync_panes_active: bool, + palette: Palette, + capabilities: PluginCapabilities, + focused_clients: &[ClientId], +) -> LinePart { + let separator = tab_separator(capabilities); + let mut tab_text = text; + if is_sync_panes_active { + tab_text.push_str(" (Sync)"); + } + render_tab(tab_text, palette, separator, focused_clients, is_active_tab) +} diff --git a/nix/default.nix b/nix/default.nix index f001b2ec4..a863621be 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -69,6 +69,7 @@ flake-utils.lib.eachSystem [ ]; defaultPlugins = [ + plugins.compact-bar plugins.status-bar plugins.tab-bar plugins.strider @@ -123,6 +124,7 @@ flake-utils.lib.eachSystem [ cp ${plugins.tab-bar}/bin/tab-bar.wasm assets/plugins/tab-bar.wasm cp ${plugins.status-bar}/bin/status-bar.wasm assets/plugins/status-bar.wasm cp ${plugins.strider}/bin/strider.wasm assets/plugins/strider.wasm + cp ${plugins.compact-bar}/bin/compact-bar.wasm assets/plugins/compact-bar.wasm ''; desktopItems = [ diff --git a/nix/plugins.nix b/nix/plugins.nix index b20f673da..270544c95 100644 --- a/nix/plugins.nix +++ b/nix/plugins.nix @@ -50,4 +50,5 @@ in { status-bar = makeDefaultPlugin "status-bar"; tab-bar = makeDefaultPlugin "tab-bar"; strider = makeDefaultPlugin "strider"; + compact-bar = makeDefaultPlugin "compact-bar"; } diff --git a/src/install.rs b/src/install.rs index 95f1f0db3..1f50a1d60 100644 --- a/src/install.rs +++ b/src/install.rs @@ -21,6 +21,7 @@ macro_rules! asset_map { pub(crate) fn populate_data_dir(data_dir: &Path) { // First run installation of default plugins & layouts let mut assets = asset_map! { + "assets/plugins/compact-bar.wasm" => "plugins/compact-bar.wasm", "assets/plugins/status-bar.wasm" => "plugins/status-bar.wasm", "assets/plugins/tab-bar.wasm" => "plugins/tab-bar.wasm", "assets/plugins/strider.wasm" => "plugins/strider.wasm", diff --git a/zellij-utils/assets/config/default.yaml b/zellij-utils/assets/config/default.yaml index 070bacb6c..b053fa4a3 100644 --- a/zellij-utils/assets/config/default.yaml +++ b/zellij-utils/assets/config/default.yaml @@ -479,6 +479,8 @@ plugins: tag: status-bar - path: strider tag: strider + - path: compact-bar + tag: compact-bar # Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP # eg. when terminal window with an active zellij session is closed diff --git a/zellij-utils/assets/layouts/compact.yaml b/zellij-utils/assets/layouts/compact.yaml new file mode 100644 index 000000000..d20ff08af --- /dev/null +++ b/zellij-utils/assets/layouts/compact.yaml @@ -0,0 +1,13 @@ +--- +template: + direction: Horizontal + parts: + - direction: Vertical + body: true + - direction: Vertical + borderless: true + split_size: + Fixed: 1 + run: + plugin: + location: "zellij:compact-bar" diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 14b2971b8..648f09ac6 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -288,6 +288,7 @@ impl LayoutFromYamlIntermediate { Some("default") => Self::default_from_assets(), Some("strider") => Self::strider_from_assets(), Some("disable-status-bar") => Self::disable_status_from_assets(), + Some("compact") => Self::compact_from_assets(), None | Some(_) => Err(ConfigError::IoPath( std::io::Error::new(std::io::ErrorKind::Other, "The layout was not found"), path.into(), @@ -314,6 +315,12 @@ impl LayoutFromYamlIntermediate { serde_yaml::from_str(&String::from_utf8(setup::NO_STATUS_LAYOUT.to_vec())?)?; Ok(layout) } + + pub fn compact_from_assets() -> LayoutFromYamlIntermediateResult { + let layout: LayoutFromYamlIntermediate = + serde_yaml::from_str(&String::from_utf8(setup::COMPACT_BAR_LAYOUT.to_vec())?)?; + Ok(layout) + } } type LayoutFromYamlResult = Result; diff --git a/zellij-utils/src/input/plugins.rs b/zellij-utils/src/input/plugins.rs index 71ca264d5..0f11e8f4f 100644 --- a/zellij-utils/src/input/plugins.rs +++ b/zellij-utils/src/input/plugins.rs @@ -271,7 +271,7 @@ mod tests { )?; let plugins = PluginsConfig::get_plugins_with_default(plugins.try_into()?); - assert_eq!(plugins.iter().count(), 4); + assert_eq!(plugins.iter().count(), 5); Ok(()) } diff --git a/zellij-utils/src/setup.rs b/zellij-utils/src/setup.rs index 301bcee93..2df138eda 100644 --- a/zellij-utils/src/setup.rs +++ b/zellij-utils/src/setup.rs @@ -109,6 +109,12 @@ pub const NO_STATUS_LAYOUT: &[u8] = include_bytes!(concat!( "assets/layouts/disable-status-bar.yaml" )); +pub const COMPACT_BAR_LAYOUT: &[u8] = include_bytes!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/", + "assets/layouts/compact.yaml" +)); + pub const FISH_EXTRA_COMPLETION: &[u8] = include_bytes!(concat!( env!("CARGO_MANIFEST_DIR"), "/", @@ -141,6 +147,7 @@ pub fn dump_specified_layout(layout: &str) -> std::io::Result<()> { match layout { "strider" => dump_asset(STRIDER_LAYOUT), "default" => dump_asset(DEFAULT_LAYOUT), + "compact" => dump_asset(COMPACT_BAR_LAYOUT), "disable-status" => dump_asset(NO_STATUS_LAYOUT), not_found => Err(std::io::Error::new( std::io::ErrorKind::Other,