summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Simonov <asimonov215@gmail.com>2023-07-01 19:30:41 +0300
committerGitHub <noreply@github.com>2023-07-01 12:30:41 -0400
commit09bd69e4b1094f0ed9df40ce7c890e1bf55af7f4 (patch)
tree5c8982f013a7c84d176750f8af2f229f28d61491
parent93061c472d4d735ea48bb729216bb5a61fe92a64 (diff)
Migrate termion lib from v1 to v2. Mouse feature turn on by default (#349)
* Migrate termion lib from v1 to v2 * Refactor termion with mouse support * Mouse feature is turn on by default in cargo * Refactor: simplification * Update notify to v6 stable. No problems so far * Update lib open to v5 * lib trash bump from v2 to v3 * Updated dependencies and planned migrations of 2 libs
-rw-r--r--Cargo.lock135
-rw-r--r--Cargo.toml13
-rw-r--r--src/ui/backend.rs15
3 files changed, 49 insertions, 114 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e40a29d..cc34d55 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -453,6 +453,25 @@ dependencies = [
]
[[package]]
+name = "is-docker"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
+dependencies = [
+ "once_cell",
+]
+
+[[package]]
+name = "is-wsl"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
+dependencies = [
+ "is-docker",
+ "once_cell",
+]
+
+[[package]]
name = "joshuto"
version = "0.9.4"
dependencies = [
@@ -477,7 +496,7 @@ dependencies = [
"shellexpand",
"signal-hook",
"structopt",
- "termion 1.5.6",
+ "termion",
"toml",
"trash",
"unicode-segmentation",
@@ -618,9 +637,9 @@ dependencies = [
[[package]]
name = "notify"
-version = "5.2.0"
+version = "6.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "729f63e1ca555a43fe3efa4f3efdf4801c479da85b432242a7b726f353c88486"
+checksum = "5738a2795d57ea20abec2d6d76c6081186709c0024187cd5977265eda6598b51"
dependencies = [
"bitflags",
"crossbeam-channel",
@@ -666,12 +685,13 @@ checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b"
[[package]]
name = "open"
-version = "2.1.3"
+version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2423ffbf445b82e58c3b1543655968923dd06f85432f10be2bb4f1b7122f98c"
+checksum = "cfabf1927dce4d6fdf563d63328a0a506101ced3ec780ca2135747336c98cef8"
dependencies = [
+ "is-wsl",
+ "libc",
"pathdiff",
- "windows-sys 0.36.1",
]
[[package]]
@@ -824,7 +844,7 @@ checksum = "ce841e0486e7c2412c3740168ede33adeba8e154a15107b879d8162d77c7174e"
dependencies = [
"bitflags",
"cassowary",
- "termion 2.0.1",
+ "termion",
"unicode-segmentation",
"unicode-width",
]
@@ -1060,18 +1080,6 @@ dependencies = [
[[package]]
name = "termion"
-version = "1.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e"
-dependencies = [
- "libc",
- "numtoa",
- "redox_syscall",
- "redox_termios",
-]
-
-[[package]]
-name = "termion"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "659c1f379f3408c7e5e84c7d0da6d93404e3800b6b9d063ba24436419302ec90"
@@ -1173,9 +1181,9 @@ dependencies = [
[[package]]
name = "trash"
-version = "2.1.5"
+version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe090367848cd40c4230ff3ce4e2ff6a2fd511c1e14ae047a4a4c37ef7965236"
+checksum = "1d219a2989f6a23fd3a6599d733e03b524cc3c50feed539ea3a136ae7845fe83"
dependencies = [
"chrono",
"libc",
@@ -1184,7 +1192,7 @@ dependencies = [
"once_cell",
"scopeguard",
"url",
- "windows 0.37.0",
+ "windows 0.44.0",
]
[[package]]
@@ -1410,15 +1418,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
-version = "0.37.0"
+version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647"
+checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b"
dependencies = [
- "windows_aarch64_msvc 0.37.0",
- "windows_i686_gnu 0.37.0",
- "windows_i686_msvc 0.37.0",
- "windows_x86_64_gnu 0.37.0",
- "windows_x86_64_msvc 0.37.0",
+ "windows-targets 0.42.2",
]
[[package]]
@@ -1432,19 +1436,6 @@ dependencies = [
[[package]]
name = "windows-sys"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
-dependencies = [
- "windows_aarch64_msvc 0.36.1",
- "windows_i686_gnu 0.36.1",
- "windows_i686_msvc 0.36.1",
- "windows_x86_64_gnu 0.36.1",
- "windows_x86_64_msvc 0.36.1",
-]
-
-[[package]]
-name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
@@ -1505,18 +1496,6 @@ checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.37.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a"
-
-[[package]]
-name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
@@ -1529,18 +1508,6 @@ checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[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_gnu"
-version = "0.37.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1"
-
-[[package]]
-name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
@@ -1553,18 +1520,6 @@ checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.37.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c"
-
-[[package]]
-name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
@@ -1577,18 +1532,6 @@ checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[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_gnu"
-version = "0.37.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d"
-
-[[package]]
-name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
@@ -1613,18 +1556,6 @@ checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.37.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d"
-
-[[package]]
-name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
diff --git a/Cargo.toml b/Cargo.toml
index 449db3e..5879ec4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,20 +19,23 @@ filetime = "^0"
globset = "^0"
lazy_static = "^1"
libc = "^0"
-notify = "5.0.0-pre.15"
-open = "^2"
+notify = "^6"
+open = "^5"
phf = { version = "^0", features = ["macros"], optional = true }
rand = "^0"
+# rustline latest is v12 migrate
rustyline = "^9"
serde = "^1"
serde_derive = "^1"
shell-words = "^1"
+# shellexpand latest is v3 migrate
+# shellexpand = { version = "^3", features = ["full"]}
shellexpand = "^2"
signal-hook = "^0"
structopt = "^0"
-termion = "^1"
+termion = "^2"
toml = "^0"
-trash = { version = "^2", optional = true }
+trash = { version = "^3", optional = true }
tui = { version = "0.21", default-features = false, features = [
"termion",
], package = "ratatui" }
@@ -53,4 +56,4 @@ file_mimetype = []
mouse = []
recycle_bin = ["trash"]
syntax_highlight = ["ansi-to-tui"]
-default = ["devicons", "recycle_bin", "syntax_highlight"]
+default = ["devicons", "mouse", "recycle_bin", "syntax_highlight"]
diff --git a/src/ui/backend.rs b/src/ui/backend.rs
index 8180072..e67b5e9 100644
--- a/src/ui/backend.rs
+++ b/src/ui/backend.rs
@@ -2,6 +2,7 @@ use std::io::{self, stdout, Write};
use termion::raw::{IntoRawMode, RawTerminal};
use termion::screen::AlternateScreen;
+use termion::screen::IntoAlternateScreen;
use tui::backend::TermionBackend;
use tui::widgets::Widget;
@@ -9,7 +10,7 @@ use tui::widgets::Widget;
use termion::input::MouseTerminal;
trait New {
- fn new() -> std::io::Result<Self>
+ fn new() -> io::Result<Self>
where
Self: Sized;
}
@@ -18,20 +19,20 @@ trait New {
type Screen = MouseTerminal<AlternateScreen<RawTerminal<std::io::Stdout>>>;
#[cfg(feature = "mouse")]
impl New for Screen {
- fn new() -> std::io::Result<Self> {
- let stdout = std::io::stdout().into_raw_mode()?;
- let alt_screen = MouseTerminal::from(AlternateScreen::from(stdout));
- return Ok(alt_screen);
+ // Returns alternate screen
+ fn new() -> io::Result<Self> {
+ let stdout = io::stdout().into_raw_mode()?;
+ Ok(MouseTerminal::from(stdout.into_alternate_screen().unwrap()))
}
}
#[cfg(not(feature = "mouse"))]
type Screen = AlternateScreen<RawTerminal<std::io::Stdout>>;
#[cfg(not(feature = "mouse"))]
impl New for Screen {
+ // Returns alternate screen
fn new() -> io::Result<Self> {
let stdout = std::io::stdout().into_raw_mode()?;
- let alt_screen = AlternateScreen::from(stdout);
- Ok(alt_screen)
+ Ok(stdout.into_alternate_screen().unwrap())
}
}