Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a1aaaa5

Browse files
CopilotByron
andcommitted
refactor: remove crosstermion and tui-react dependencies
Co-authored-by: Byron <[email protected]>
1 parent 6c0203c commit a1aaaa5

16 files changed

Lines changed: 171 additions & 85 deletions

Cargo.lock

Lines changed: 1 addition & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ include = [
1919
[features]
2020
default = ["tui-crossplatform", "trash-move"]
2121
tui-crossplatform = [
22-
"crosstermion/tui-crossterm",
22+
"crossterm",
2323
"tui",
24-
"tui-react",
2524
"open",
2625
"unicode-segmentation",
2726
"unicode-width",
@@ -46,9 +45,10 @@ chrono = { version = "0.4.31", default-features = false, features = ["std"] }
4645
# 'tui' related
4746
unicode-segmentation = { version = "1.3.0", optional = true }
4847
unicode-width = { version = "0.2.0", optional = true }
49-
crosstermion = { version = "0.14.0", default-features = false, optional = true }
50-
tui = { package = "ratatui", version = "0.26.1", optional = true, default-features = false }
51-
tui-react = { version = "0.23.2", optional = true }
48+
crossterm = { version = "0.27.0", optional = true }
49+
tui = { package = "ratatui", version = "0.26.1", optional = true, default-features = false, features = [
50+
"crossterm",
51+
] }
5252
open = { version = "5.0", optional = true }
5353
wild = "2.0.4"
5454
owo-colors = "4.0.0"

src/interactive/app/eventloop.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use crate::interactive::{
77
};
88
use anyhow::Result;
99
use crossbeam::channel::Receiver;
10-
use crosstermion::crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
11-
use crosstermion::input::Event;
10+
use crossterm::event::{Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
1211
use dua::{
1312
WalkResult,
1413
traverse::{BackgroundTraversal, EntryData, Traversal, TreeIndex},
@@ -233,7 +232,7 @@ impl AppState {
233232
B: Backend,
234233
{
235234
use FocussedPane::*;
236-
use crosstermion::crossterm::event::KeyCode::*;
235+
use crossterm::event::KeyCode::*;
237236

238237
let key = match event {
239238
Event::Key(key) if key.kind != KeyEventKind::Release => {

src/interactive/app/handlers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::interactive::{
33
app::tree_view::TreeView,
44
widgets::{Column, GlobPane, HelpPane, MainWindow, MarkMode, MarkPane},
55
};
6-
use crosstermion::input::Key;
6+
use crossterm::event::KeyEvent;
77
use dua::traverse::TreeIndex;
88
use std::{fs, io, path::PathBuf};
99
use tui::{Terminal, backend::Backend};
@@ -232,7 +232,7 @@ impl AppState {
232232

233233
pub fn dispatch_to_mark_pane<B>(
234234
&mut self,
235-
key: Key,
235+
key: KeyEvent,
236236
window: &mut MainWindow,
237237
tree_view: &mut TreeView<'_>,
238238
display: DisplayOptions,

src/interactive/app/input.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crossbeam::channel::Receiver;
2-
pub use crosstermion::crossterm::event::Event;
2+
pub use crossterm::event::Event;
33

44
enum Action<T> {
55
Continue,
@@ -18,7 +18,7 @@ pub fn input_channel() -> Receiver<Event> {
1818
let (key_send, key_receive) = crossbeam::channel::bounded(0);
1919
std::thread::spawn(move || -> Result<(), std::io::Error> {
2020
loop {
21-
let event = match continue_on_interrupt(crosstermion::crossterm::event::read()) {
21+
let event = match continue_on_interrupt(crossterm::event::read()) {
2222
Action::Continue => continue,
2323
Action::Result(res) => res?,
2424
};

src/interactive/app/terminal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::path::PathBuf;
33
use crate::interactive::EntryCheck;
44
use anyhow::Result;
55
use crossbeam::channel::Receiver;
6-
use crosstermion::input::Event;
6+
use crossterm::event::Event;
77
#[cfg(test)]
88
use dua::traverse::TraversalStats;
99
use dua::{ByteFormat, WalkOptions, WalkResult, traverse::Traversal};

src/interactive/app/tests/journeys_readonly.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use anyhow::Result;
2-
use crosstermion::crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
3-
use crosstermion::input::Event;
2+
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
43
use pretty_assertions::assert_eq;
54
use std::ffi::OsString;
65

src/interactive/app/tests/journeys_with_writes.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use crate::interactive::app::tests::utils::{
22
WritableFixture, initialized_app_and_terminal_from_paths, into_codes,
33
};
44
use anyhow::Result;
5-
use crosstermion::crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
6-
use crosstermion::input::Event;
5+
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
76
use pretty_assertions::assert_eq;
87

98
#[test]

src/interactive/app/tests/utils.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use anyhow::{Context, Error, Result};
22
use crossbeam::channel::Receiver;
3-
use crosstermion::{crossterm::event::KeyCode, input::Event};
3+
use crossterm::event::{Event, KeyCode};
44
use dua::{
55
ByteFormat, TraversalSorting, WalkOptions,
66
traverse::{EntryData, Tree, TreeIndex},
@@ -31,11 +31,7 @@ pub fn into_events<'a>(events: impl IntoIterator<Item = Event> + 'a) -> Receiver
3131
}
3232

3333
pub fn into_keys<'a>(codes: impl IntoIterator<Item = KeyCode> + 'a) -> Receiver<Event> {
34-
into_events(
35-
codes
36-
.into_iter()
37-
.map(|code| crosstermion::input::Event::Key(code.into())),
38-
)
34+
into_events(codes.into_iter().map(|code| Event::Key(code.into())))
3935
}
4036

4137
pub fn into_codes(input: &str) -> Receiver<Event> {

src/interactive/widgets/entries.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
use crate::interactive::widgets::COUNT;
2+
use crate::interactive::widgets::tui_ext::util::rect::line_bound;
3+
use crate::interactive::widgets::tui_ext::{
4+
List, ListProps, draw_text_nowrap_fn,
5+
util::{block_width, rect},
6+
};
27
use crate::interactive::{
38
DisplayOptions, EntryDataBundle, SortMode,
49
widgets::{EntryMarkMap, entry_color},
@@ -16,11 +21,6 @@ use tui::{
1621
text::Span,
1722
widgets::{Block, Borders, Scrollbar, ScrollbarOrientation, ScrollbarState, StatefulWidget},
1823
};
19-
use tui_react::util::rect::line_bound;
20-
use tui_react::{
21-
List, ListProps, draw_text_nowrap_fn,
22-
util::{block_width, rect},
23-
};
2424
use unicode_segmentation::UnicodeSegmentation;
2525
use unicode_width::UnicodeWidthStr;
2626

0 commit comments

Comments
 (0)