Fix SelectAll and UI colors

- SelectAll will not unselect the existing paths. Same for
  ToggleSelectAll.
- Fixed UI bug causing random bold characters (deps).
This commit is contained in:
Arijit Basu 2023-03-25 11:21:12 +05:30
parent 5e414c9ce2
commit d664d97bce
No known key found for this signature in database
GPG Key ID: 0F8EF5258DC38077
5 changed files with 65 additions and 72 deletions

101
Cargo.lock generated
View File

@ -38,10 +38,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
[[package]] [[package]]
name = "ansi-to-tui-forked" name = "ansi-to-tui"
version = "3.0.0-ratatui" version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0b908b67a7faf8682254111ae9aecee03d4a3b613de03088f9a77953f85bab3" checksum = "5f3d156989cd98fb225b1a83e82e133e95a151774a420c884f6a65c5f6fb1ee2"
dependencies = [ dependencies = [
"nom", "nom",
"ratatui", "ratatui",
@ -347,22 +347,6 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "crossterm"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
dependencies = [
"bitflags",
"crossterm_winapi",
"libc",
"mio",
"parking_lot",
"signal-hook",
"signal-hook-mio",
"winapi",
]
[[package]] [[package]]
name = "crossterm" name = "crossterm"
version = "0.26.1" version = "0.26.1"
@ -412,7 +396,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"scratch", "scratch",
"syn 2.0.2", "syn 2.0.10",
] ]
[[package]] [[package]]
@ -429,7 +413,7 @@ checksum = "631569015d0d8d54e6c241733f944042623ab6df7bc3be7466874b05fcdb1c5f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.2", "syn 2.0.10",
] ]
[[package]] [[package]]
@ -611,7 +595,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a329e22866dd78b35d2c639a4a23d7b950aeae300dfd79f4fb19f74055c2404" checksum = "8a329e22866dd78b35d2c639a4a23d7b950aeae300dfd79f4fb19f74055c2404"
dependencies = [ dependencies = [
"libc", "libc",
"windows", "windows 0.43.0",
] ]
[[package]] [[package]]
@ -675,16 +659,16 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "iana-time-zone" name = "iana-time-zone"
version = "0.1.53" version = "0.1.54"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" checksum = "0c17cc76786e99f8d2f055c11159e7f0091c42474dcc3189fbab96072e873e6d"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"core-foundation-sys", "core-foundation-sys",
"iana-time-zone-haiku", "iana-time-zone-haiku",
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
"winapi", "windows 0.46.0",
] ]
[[package]] [[package]]
@ -705,9 +689,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.2" version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown",
@ -837,9 +821,9 @@ dependencies = [
[[package]] [[package]]
name = "mime" name = "mime"
version = "0.3.16" version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]] [[package]]
name = "mime_guess" name = "mime_guess"
@ -1092,9 +1076,9 @@ dependencies = [
[[package]] [[package]]
name = "predicates" name = "predicates"
version = "3.0.1" version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ba7d6ead3e3966038f68caa9fc1f860185d95a793180bbcfe0d0da47b3961ed" checksum = "c575290b64d24745b6c57a12a31465f0a66f3a4799686a6921526a33b0797965"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"difflib", "difflib",
@ -1120,9 +1104,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.52" version = "1.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -1138,13 +1122,13 @@ dependencies = [
[[package]] [[package]]
name = "ratatui" name = "ratatui"
version = "0.20.0" version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d690717aac4aca6e901da642fafcceff63ded0ab4c65c18ceff39c9a27f21508" checksum = "dcc0d032bccba900ee32151ec0265667535c230169f5a011154cdcd984e16829"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cassowary", "cassowary",
"crossterm 0.26.1", "crossterm",
"serde", "serde",
"unicode-segmentation", "unicode-segmentation",
"unicode-width", "unicode-width",
@ -1194,9 +1178,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.7.1" version = "1.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -1211,9 +1195,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.6.28" version = "0.6.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
[[package]] [[package]]
name = "rustc-hash" name = "rustc-hash"
@ -1256,22 +1240,22 @@ checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.157" version = "1.0.158"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707de5fcf5df2b5788fca98dd7eab490bc2fd9b7ef1404defc462833b83f25ca" checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.157" version = "1.0.158"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78997f4555c22a7971214540c4a661291970619afd56de19f77e0de86296e1e5" checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.2", "syn 2.0.10",
] ]
[[package]] [[package]]
@ -1404,9 +1388,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.2" version = "2.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59d3276aee1fa0c33612917969b5172b5be2db051232a6e4826f1a1a9191b045" checksum = "5aad1363ed6d37b84299588d62d3a7d95b5a5c2d9aad5c85609fda12afaa1f40"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1467,7 +1451,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.2", "syn 2.0.10",
] ]
[[package]] [[package]]
@ -1541,11 +1525,11 @@ dependencies = [
[[package]] [[package]]
name = "tui-input" name = "tui-input"
version = "0.6.1" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6a207b3c48d2affc4a9645068b83512eebf3b586214af2a9784b6e7ec5aa41b" checksum = "40419b12b152aaa1a295741903c9b6253e66ef07e0630e2e2503c736f280fdde"
dependencies = [ dependencies = [
"crossterm 0.25.0", "crossterm",
"serde", "serde",
"unicode-width", "unicode-width",
] ]
@ -1798,6 +1782,15 @@ dependencies = [
"windows_x86_64_msvc", "windows_x86_64_msvc",
] ]
[[package]]
name = "windows"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25"
dependencies = [
"windows-targets",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.45.0" version = "0.45.0"
@ -1866,13 +1859,13 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
[[package]] [[package]]
name = "xplr" name = "xplr"
version = "0.21.0" version = "0.21.1"
dependencies = [ dependencies = [
"ansi-to-tui-forked", "ansi-to-tui",
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",
"criterion", "criterion",
"crossterm 0.26.1", "crossterm",
"dirs", "dirs",
"gethostname", "gethostname",
"humansize", "humansize",

View File

@ -8,7 +8,7 @@ path = './benches/criterion.rs'
[package] [package]
name = 'xplr' name = 'xplr'
version = '0.21.0' version = '0.21.1'
authors = ['Arijit Basu <hi@arijitbasu.in>'] authors = ['Arijit Basu <hi@arijitbasu.in>']
edition = '2021' edition = '2021'
description = 'A hackable, minimal, fast TUI file explorer' description = 'A hackable, minimal, fast TUI file explorer'
@ -29,8 +29,8 @@ anyhow = "1.0.70"
serde_yaml = "0.9.19" serde_yaml = "0.9.19"
crossterm = "0.26.1" crossterm = "0.26.1"
dirs = "5.0.0" dirs = "5.0.0"
ansi-to-tui-forked = "3.0.0-ratatui" ansi-to-tui = "3.0.0"
regex = "1.7.1" regex = "1.7.3"
gethostname = "0.4.1" gethostname = "0.4.1"
serde_json = "1.0.94" serde_json = "1.0.94"
path-absolutize = "3.0.14" path-absolutize = "3.0.14"
@ -55,17 +55,17 @@ version = "2.0.4"
features = ["rev-mappings"] features = ["rev-mappings"]
[dependencies.tui] [dependencies.tui]
version = "0.20.0" version = "0.20.1"
default-features = false default-features = false
features = ['crossterm', 'serde'] features = ['crossterm', 'serde']
package = 'ratatui' package = 'ratatui'
[dependencies.serde] [dependencies.serde]
version = "1.0.157" version = "1.0.158"
features = ['derive'] features = ['derive']
[dependencies.indexmap] [dependencies.indexmap]
version = "1.9.2" version = "1.9.3"
features = ['serde'] features = ['serde']
[dependencies.mlua] [dependencies.mlua]
@ -73,7 +73,7 @@ version = "0.8.8"
features = ['luajit', 'vendored', 'serialize', 'send'] features = ['luajit', 'vendored', 'serialize', 'send']
[dependencies.tui-input] [dependencies.tui-input]
version = "0.6.1" version = "0.7.0"
features = ['serde'] features = ['serde']
[dev-dependencies] [dev-dependencies]

View File

@ -45,7 +45,7 @@ compatibility.
### Instructions ### Instructions
#### [v0.20.2][48] -> [v0.21.0][49] #### [v0.20.2][48] -> [v0.21.1][49]
- Some plugins might stop rendering colors. Wait for them to update. - Some plugins might stop rendering colors. Wait for them to update.
- Rename `xplr.config.general.sort_and_filter_ui.search_identifier` to - Rename `xplr.config.general.sort_and_filter_ui.search_identifier` to
@ -516,5 +516,5 @@ Else do the following:
[46]: https://github.com/sayanarijit/xplr/releases/tag/v0.18.0 [46]: https://github.com/sayanarijit/xplr/releases/tag/v0.18.0
[47]: https://github.com/sayanarijit/xplr/releases/tag/v0.19.4 [47]: https://github.com/sayanarijit/xplr/releases/tag/v0.19.4
[48]: https://github.com/sayanarijit/xplr/releases/tag/v0.20.2 [48]: https://github.com/sayanarijit/xplr/releases/tag/v0.20.2
[49]: https://github.com/sayanarijit/xplr/releases/tag/v0.21.0 [49]: https://github.com/sayanarijit/xplr/releases/tag/v0.21.1
[50]: https://github.com/lotabout/skim#search-syntax [50]: https://github.com/lotabout/skim#search-syntax

View File

@ -160,24 +160,24 @@ mod tests {
assert!(check_version(VERSION, "foo path").is_ok()); assert!(check_version(VERSION, "foo path").is_ok());
// Current release if OK // Current release if OK
assert!(check_version("0.21.0", "foo path").is_ok()); assert!(check_version("0.21.1", "foo path").is_ok());
// Prev major release is ERR // Prev major release is ERR
// - Not yet // - Not yet
// Prev minor release is ERR (Change when we get to v1) // Prev minor release is ERR (Change when we get to v1)
assert!(check_version("0.20.0", "foo path").is_err()); assert!(check_version("0.20.1", "foo path").is_err());
// Prev bugfix release is OK // Prev bugfix release is OK
// assert!(check_version("0.21.-1", "foo path").is_ok()); assert!(check_version("0.21.0", "foo path").is_ok());
// Next major release is ERR // Next major release is ERR
assert!(check_version("1.20.0", "foo path").is_err()); assert!(check_version("1.20.1", "foo path").is_err());
// Next minor release is ERR // Next minor release is ERR
assert!(check_version("0.22.0", "foo path").is_err()); assert!(check_version("0.22.1", "foo path").is_err());
// Next bugfix release is ERR (Change when we get to v1) // Next bugfix release is ERR (Change when we get to v1)
assert!(check_version("0.21.1", "foo path").is_err()); assert!(check_version("0.21.2", "foo path").is_err());
} }
} }

View File

@ -5,7 +5,7 @@ use crate::config::PanelUiConfig;
use crate::lua; use crate::lua;
use crate::permissions::Permissions; use crate::permissions::Permissions;
use crate::{app, path}; use crate::{app, path};
use ansi_to_tui_forked::IntoText; use ansi_to_tui::IntoText;
use indexmap::IndexSet; use indexmap::IndexSet;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use lscolors::{Color as LsColorsColor, Style as LsColorsStyle}; use lscolors::{Color as LsColorsColor, Style as LsColorsStyle};
@ -258,7 +258,7 @@ pub enum Modifier {
} }
impl Modifier { impl Modifier {
pub fn bits(self) -> u8 { pub fn bits(self) -> u16 {
match self { match self {
Self::Bold => TuiModifier::BOLD.bits(), Self::Bold => TuiModifier::BOLD.bits(),
Self::Dim => TuiModifier::DIM.bits(), Self::Dim => TuiModifier::DIM.bits(),
@ -315,7 +315,7 @@ impl Style {
impl Into<TuiStyle> for Style { impl Into<TuiStyle> for Style {
fn into(self) -> TuiStyle { fn into(self) -> TuiStyle {
fn xor(modifiers: Option<IndexSet<Modifier>>) -> u8 { fn xor(modifiers: Option<IndexSet<Modifier>>) -> u16 {
modifiers modifiers
.unwrap_or_default() .unwrap_or_default()
.into_iter() .into_iter()