mirror of
https://github.com/gitui-org/gitui
synced 2026-05-22 16:38:28 +00:00
tui -> ratatui
tui is not maintained anymore and it seems that ratatui is the successor: https://github.com/fdehau/tui-rs/issues/654
This commit is contained in:
parent
19b820bb35
commit
904885e001
57 changed files with 161 additions and 156 deletions
34
Cargo.lock
generated
34
Cargo.lock
generated
|
|
@ -331,9 +331,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.25.0"
|
||||
version = "0.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
|
||||
checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crossterm_winapi",
|
||||
|
|
@ -785,6 +785,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"pprof",
|
||||
"pretty_assertions",
|
||||
"ratatui",
|
||||
"rayon-core",
|
||||
"ron",
|
||||
"scopeguard",
|
||||
|
|
@ -795,7 +796,6 @@ dependencies = [
|
|||
"syntect",
|
||||
"tempfile",
|
||||
"textwrap",
|
||||
"tui",
|
||||
"unicode-segmentation",
|
||||
"unicode-truncate",
|
||||
"unicode-width",
|
||||
|
|
@ -1450,6 +1450,20 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.20.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcc0d032bccba900ee32151ec0265667535c230169f5a011154cdcd984e16829"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
"crossterm",
|
||||
"serde",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.11.0"
|
||||
|
|
@ -1926,20 +1940,6 @@ version = "0.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tui"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cassowary",
|
||||
"crossterm",
|
||||
"serde",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.10"
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ bytesize = { version = "1.2", default-features = false }
|
|||
chrono = { version = "0.4", default-features = false, features = [ "clock" ] }
|
||||
clap = { version = "4.1", features = [ "env", "cargo" ] }
|
||||
crossbeam-channel = "0.5"
|
||||
crossterm = { version = "0.25", features = [ "serde" ] }
|
||||
crossterm = { version = "0.26.1", features = [ "serde" ] }
|
||||
dirs-next = "2.0"
|
||||
easy-cast = "0.5"
|
||||
filetreelist = { path = "./filetreelist", version = "0.5" }
|
||||
|
|
@ -40,6 +40,7 @@ log = "0.4"
|
|||
notify = "5.1"
|
||||
notify-debouncer-mini = "0.2"
|
||||
once_cell = "1"
|
||||
ratatui = { version = "0.20", default-features = false, features = ['crossterm', 'serde'] }
|
||||
rayon-core = "1.11"
|
||||
ron = "0.8"
|
||||
scopeguard = "1.1"
|
||||
|
|
@ -49,7 +50,6 @@ simplelog = { version = "0.12", default-features = false }
|
|||
struct-patch = "0.2"
|
||||
syntect = { version = "5.0", default-features = false, features = ["parsing", "default-syntaxes", "default-themes", "html"] }
|
||||
textwrap = "0.16"
|
||||
tui = { version = "0.19", default-features = false, features = ['crossterm', 'serde'] }
|
||||
unicode-segmentation = "1.10"
|
||||
unicode-truncate = "0.2"
|
||||
unicode-width = "0.1"
|
||||
|
|
|
|||
12
src/app.rs
12
src/app.rs
|
|
@ -34,12 +34,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::{Event, KeyEvent};
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
path::Path,
|
||||
rc::Rc,
|
||||
};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{
|
||||
Alignment, Constraint, Direction, Layout, Margin, Rect,
|
||||
|
|
@ -48,6 +43,11 @@ use tui::{
|
|||
widgets::{Block, Borders, Paragraph, Tabs},
|
||||
Frame,
|
||||
};
|
||||
use std::{
|
||||
cell::{Cell, RefCell},
|
||||
path::Path,
|
||||
rc::Rc,
|
||||
};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ use crate::{
|
|||
components::CommandInfo, keys::SharedKeyConfig, strings,
|
||||
ui::style::SharedTheme,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
text::{Span, Spans},
|
||||
widgets::Paragraph,
|
||||
Frame,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
enum DrawListEntry {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use std::convert::TryInto;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Rect},
|
||||
symbols::line::VERTICAL,
|
||||
|
|
@ -27,6 +26,7 @@ use tui::{
|
|||
widgets::{Block, Borders, Cell, Clear, Row, Table, TableState},
|
||||
Frame,
|
||||
};
|
||||
use std::convert::TryInto;
|
||||
|
||||
static NO_COMMIT_ID: &str = "0000000";
|
||||
static NO_AUTHOR: &str = "<no author>";
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ use asyncgit::{
|
|||
AsyncGitNotification,
|
||||
};
|
||||
use crossterm::event::Event;
|
||||
use std::{cell::Cell, convert::TryInto};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{
|
||||
Alignment, Constraint, Direction, Layout, Margin, Rect,
|
||||
|
|
@ -36,6 +35,7 @@ use tui::{
|
|||
widgets::{Block, BorderType, Borders, Clear, Paragraph, Tabs},
|
||||
Frame,
|
||||
};
|
||||
use std::{cell::Cell, convert::TryInto};
|
||||
use ui::style::SharedTheme;
|
||||
use unicode_truncate::UnicodeTruncateStr;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ use asyncgit::{
|
|||
StatusItem, StatusItemType,
|
||||
};
|
||||
use crossterm::event::Event;
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
use std::path::Path;
|
||||
use tui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
///
|
||||
pub struct ChangesComponent {
|
||||
|
|
|
|||
|
|
@ -21,16 +21,16 @@ use asyncgit::{
|
|||
};
|
||||
use crossterm::event::Event;
|
||||
use easy_cast::Cast;
|
||||
use std::{
|
||||
fs::{read_to_string, File},
|
||||
io::{Read, Write},
|
||||
};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
widgets::Paragraph,
|
||||
Frame,
|
||||
};
|
||||
use std::{
|
||||
fs::{read_to_string, File},
|
||||
io::{Read, Write},
|
||||
};
|
||||
|
||||
enum CommitResult {
|
||||
ComitDone,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use asyncgit::sync::{self, CommitDetails, CommitId, RepoPathRef};
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
text::{Span, Spans, Text},
|
||||
|
|
|
|||
|
|
@ -15,16 +15,16 @@ use asyncgit::sync::{
|
|||
self, CommitDetails, CommitId, CommitMessage, RepoPathRef, Tag,
|
||||
};
|
||||
use crossterm::event::Event;
|
||||
use std::clone::Clone;
|
||||
use std::{borrow::Cow, cell::Cell};
|
||||
use sync::CommitTags;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
style::{Modifier, Style},
|
||||
text::{Span, Spans, Text},
|
||||
Frame,
|
||||
};
|
||||
use std::clone::Clone;
|
||||
use std::{borrow::Cow, cell::Cell};
|
||||
use sync::CommitTags;
|
||||
|
||||
use super::style::Detail;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use compare_details::CompareDetailsComponent;
|
|||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use details::DetailsComponent;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
Frame,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{strings, ui::style::SharedTheme};
|
||||
use ratatui::text::Span;
|
||||
use std::borrow::Cow;
|
||||
use tui::text::Span;
|
||||
|
||||
pub enum Detail {
|
||||
Author,
|
||||
|
|
|
|||
|
|
@ -19,17 +19,17 @@ use asyncgit::sync::{
|
|||
use chrono::{DateTime, Local};
|
||||
use crossterm::event::Event;
|
||||
use itertools::Itertools;
|
||||
use std::{
|
||||
borrow::Cow, cell::Cell, cmp, collections::BTreeMap,
|
||||
convert::TryFrom, time::Instant,
|
||||
};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
text::{Span, Spans},
|
||||
widgets::{Block, Borders, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
use std::{
|
||||
borrow::Cow, cell::Cell, cmp, collections::BTreeMap,
|
||||
convert::TryFrom, time::Instant,
|
||||
};
|
||||
|
||||
const ELEMENTS_PER_LINE: usize = 9;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
widgets::Clear,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use anyhow::Result;
|
|||
use asyncgit::sync::{self, RepoPathRef};
|
||||
use crossterm::event::Event;
|
||||
use easy_cast::Cast;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend, layout::Rect, widgets::Paragraph, Frame,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use crossterm::event::Event;
|
||||
use tui::{backend::Backend, layout::Rect, Frame};
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
use asyncgit::sync::cred::BasicAuthCredential;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,7 @@ use asyncgit::{
|
|||
};
|
||||
use bytesize::ByteSize;
|
||||
use crossterm::event::Event;
|
||||
use std::{borrow::Cow, cell::Cell, cmp, path::Path};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::Rect,
|
||||
symbols,
|
||||
|
|
@ -29,6 +28,7 @@ use tui::{
|
|||
widgets::{Block, Borders, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
use std::{borrow::Cow, cell::Cell, cmp, path::Path};
|
||||
|
||||
#[derive(Default)]
|
||||
struct Current {
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@ use crossterm::{
|
|||
terminal::{EnterAlternateScreen, LeaveAlternateScreen},
|
||||
ExecutableCommand,
|
||||
};
|
||||
use scopeguard::defer;
|
||||
use std::ffi::OsStr;
|
||||
use std::{env, io, path::Path, process::Command};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::Rect,
|
||||
text::{Span, Spans},
|
||||
widgets::{Block, BorderType, Borders, Clear, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
use scopeguard::defer;
|
||||
use std::ffi::OsStr;
|
||||
use std::{env, io, path::Path, process::Command};
|
||||
|
||||
///
|
||||
pub struct ExternalEditorComponent {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::Rect,
|
||||
text::Span,
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ use anyhow::Result;
|
|||
use asyncgit::sync::TreeFile;
|
||||
use crossterm::event::Event;
|
||||
use fuzzy_matcher::FuzzyMatcher;
|
||||
use std::borrow::Cow;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Margin, Rect},
|
||||
text::{Span, Spans},
|
||||
widgets::{Block, Borders, Clear},
|
||||
Frame,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
|
||||
pub struct FileFindPopup {
|
||||
queue: Queue,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use asyncgit::{
|
|||
use chrono::{DateTime, Local};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
text::{Span, Spans, Text},
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ use anyhow::Result;
|
|||
use asyncgit::hash;
|
||||
use crossterm::event::Event;
|
||||
use itertools::Itertools;
|
||||
use std::{borrow::Cow, cmp, convert::TryFrom};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||
style::{Modifier, Style},
|
||||
|
|
@ -20,6 +19,7 @@ use tui::{
|
|||
widgets::{Block, BorderType, Borders, Clear, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
use std::{borrow::Cow, cmp, convert::TryFrom};
|
||||
use ui::style::SharedTheme;
|
||||
|
||||
///
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
widgets::Clear,
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ pub use utils::filetree::FileTreeItemKind;
|
|||
use crate::ui::style::Theme;
|
||||
use anyhow::Result;
|
||||
use crossterm::event::Event;
|
||||
use std::convert::From;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
text::{Span, Text},
|
||||
widgets::{Block, BorderType, Borders, Paragraph, Wrap},
|
||||
Frame,
|
||||
};
|
||||
use std::convert::From;
|
||||
|
||||
/// creates accessors for a list of components
|
||||
///
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ use crate::{
|
|||
strings, ui,
|
||||
};
|
||||
use crossterm::event::Event;
|
||||
use std::convert::TryFrom;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
text::Span,
|
||||
widgets::{Block, BorderType, Borders, Clear, Paragraph, Wrap},
|
||||
Frame,
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
use ui::style::SharedTheme;
|
||||
pub struct MsgComponent {
|
||||
title: String,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use asyncgit::sync::ShowUntrackedFilesConfig;
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
style::{Modifier, Style},
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::Rect,
|
||||
text::Span,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::Rect,
|
||||
text::Span,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::Rect,
|
||||
text::Span,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use asyncgit::sync::{self, RepoPathRef};
|
||||
use crossterm::event::Event;
|
||||
use tui::{backend::Backend, layout::Rect, Frame};
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
pub struct RenameBranchComponent {
|
||||
repo: RepoPathRef,
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ use crate::{
|
|||
};
|
||||
use anyhow::Result;
|
||||
use crossterm::event::Event;
|
||||
use std::borrow::Cow;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend, layout::Rect, text::Text, widgets::Clear, Frame,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
use ui::style::SharedTheme;
|
||||
|
||||
///
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use asyncgit::{
|
|||
sync::{CommitId, RepoPath, RepoPathRef, ResetType},
|
||||
};
|
||||
use crossterm::event::Event;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
text::{Span, Spans},
|
||||
|
|
|
|||
|
|
@ -22,19 +22,19 @@ use asyncgit::{
|
|||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use filetreelist::{FileTree, FileTreeItem};
|
||||
use std::{borrow::Cow, fmt::Write};
|
||||
use std::{
|
||||
collections::BTreeSet,
|
||||
convert::From,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
text::Span,
|
||||
widgets::{Block, Borders},
|
||||
Frame,
|
||||
};
|
||||
use std::{borrow::Cow, fmt::Write};
|
||||
use std::{
|
||||
collections::BTreeSet,
|
||||
convert::From,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use unicode_truncate::UnicodeTruncateStr;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,9 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use tui::{backend::Backend, layout::Rect, widgets::Clear, Frame};
|
||||
use ratatui::{
|
||||
backend::Backend, layout::Rect, widgets::Clear, Frame,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct FileTreeOpen {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use asyncgit::sync::{self, RepoPathRef};
|
||||
use crossterm::event::Event;
|
||||
use tui::{backend::Backend, layout::Rect, Frame};
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
pub struct StashMsgComponent {
|
||||
repo: RepoPathRef,
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use asyncgit::{hash, sync::CommitId, StatusItem, StatusItemType};
|
||||
use crossterm::event::Event;
|
||||
use ratatui::{backend::Backend, layout::Rect, text::Span, Frame};
|
||||
use std::{borrow::Cow, cell::Cell, convert::From, path::Path};
|
||||
use tui::{backend::Backend, layout::Rect, text::Span, Frame};
|
||||
|
||||
//TODO: use new `filetreelist` crate
|
||||
|
||||
|
|
@ -599,8 +599,9 @@ mod tests {
|
|||
//5 c1
|
||||
|
||||
// Set up test terminal
|
||||
let test_backend = tui::backend::TestBackend::new(100, 100);
|
||||
let mut terminal = tui::Terminal::new(test_backend)
|
||||
let test_backend =
|
||||
ratatui::backend::TestBackend::new(100, 100);
|
||||
let mut terminal = ratatui::Terminal::new(test_backend)
|
||||
.expect("Unable to set up terminal");
|
||||
let mut frame = terminal.get_frame();
|
||||
|
||||
|
|
@ -640,8 +641,9 @@ mod tests {
|
|||
//5 d2
|
||||
|
||||
// Set up test terminal
|
||||
let test_backend = tui::backend::TestBackend::new(100, 100);
|
||||
let mut terminal = tui::Terminal::new(test_backend)
|
||||
let test_backend =
|
||||
ratatui::backend::TestBackend::new(100, 100);
|
||||
let mut terminal = ratatui::Terminal::new(test_backend)
|
||||
.expect("Unable to set up terminal");
|
||||
let mut frame = terminal.get_frame();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ use asyncgit::sync::{
|
|||
SubmoduleParentInfo,
|
||||
};
|
||||
use crossterm::event::Event;
|
||||
use std::{cell::Cell, convert::TryInto};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{
|
||||
Alignment, Constraint, Direction, Layout, Margin, Rect,
|
||||
|
|
@ -26,6 +25,7 @@ use tui::{
|
|||
widgets::{Block, Borders, Clear, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
use std::{cell::Cell, convert::TryInto};
|
||||
use ui::style::SharedTheme;
|
||||
use unicode_truncate::UnicodeTruncateStr;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ impl DrawableComponent for SubmodulesListComponent {
|
|||
f.render_widget(
|
||||
Block::default()
|
||||
.title(strings::POPUP_TITLE_SUBMODULES)
|
||||
.border_type(tui::widgets::BorderType::Thick)
|
||||
.border_type(ratatui::widgets::BorderType::Thick)
|
||||
.borders(Borders::ALL),
|
||||
area,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ use crossbeam_channel::Sender;
|
|||
use crossterm::event::Event;
|
||||
use filetreelist::MoveSelection;
|
||||
use itertools::Either;
|
||||
use std::{cell::Cell, convert::From, path::Path};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::Rect,
|
||||
text::Text,
|
||||
widgets::{Block, Borders, Wrap},
|
||||
Frame,
|
||||
};
|
||||
use std::{cell::Cell, convert::From, path::Path};
|
||||
|
||||
pub struct SyntaxTextComponent {
|
||||
repo: RepoPathRef,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use asyncgit::sync::{self, CommitId, RepoPathRef};
|
||||
use crossterm::event::Event;
|
||||
use tui::{backend::Backend, layout::Rect, Frame};
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
enum Mode {
|
||||
Name,
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use std::convert::TryInto;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Margin, Rect},
|
||||
text::Span,
|
||||
|
|
@ -36,6 +35,7 @@ use tui::{
|
|||
},
|
||||
Frame,
|
||||
};
|
||||
use std::convert::TryInto;
|
||||
use ui::style::SharedTheme;
|
||||
|
||||
///
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ use crate::{
|
|||
use anyhow::Result;
|
||||
use crossterm::event::{Event, KeyCode, KeyModifiers};
|
||||
use itertools::Itertools;
|
||||
use std::{cell::Cell, collections::HashMap, ops::Range};
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Alignment, Rect},
|
||||
style::Modifier,
|
||||
|
|
@ -22,6 +21,7 @@ use tui::{
|
|||
widgets::{Clear, Paragraph},
|
||||
Frame,
|
||||
};
|
||||
use std::{cell::Cell, collections::HashMap, ops::Range};
|
||||
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub enum InputType {
|
||||
|
|
@ -523,7 +523,7 @@ impl Component for TextInputComponent {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use tui::{style::Style, text::Span};
|
||||
use ratatui::{style::Style, text::Span};
|
||||
|
||||
#[test]
|
||||
fn test_smoke() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::cell::Cell;
|
||||
|
||||
use tui::{backend::Backend, layout::Rect, Frame};
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
use crate::{
|
||||
components::HorizontalScrollType,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::cell::Cell;
|
||||
|
||||
use tui::{backend::Backend, layout::Rect, Frame};
|
||||
use ratatui::{backend::Backend, layout::Rect, Frame};
|
||||
|
||||
use crate::{
|
||||
components::ScrollType,
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@ use crossterm::{
|
|||
use input::{Input, InputEvent, InputState};
|
||||
use keys::KeyConfig;
|
||||
use profiler::Profiler;
|
||||
use ratatui::{
|
||||
backend::{Backend, CrosstermBackend},
|
||||
Terminal,
|
||||
};
|
||||
use scopeguard::defer;
|
||||
use scopetime::scope_time;
|
||||
use spinner::Spinner;
|
||||
|
|
@ -76,10 +80,6 @@ use std::{
|
|||
panic, process,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use tui::{
|
||||
backend::{Backend, CrosstermBackend},
|
||||
Terminal,
|
||||
};
|
||||
use ui::style::Theme;
|
||||
use watcher::RepoWatcher;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use ratatui::{backend::Backend, Terminal};
|
||||
use std::{cell::Cell, char, io};
|
||||
use tui::{backend::Backend, Terminal};
|
||||
|
||||
// static SPINNER_CHARS: &[char] = &['◢', '◣', '◤', '◥'];
|
||||
// static SPINNER_CHARS: &[char] = &['⢹', '⢺', '⢼', '⣸', '⣇', '⡧', '⡗', '⡏'];
|
||||
|
|
@ -48,7 +48,7 @@ impl Spinner {
|
|||
if self.last_char.get() != char_to_draw {
|
||||
self.last_char.set(char_to_draw);
|
||||
|
||||
let c = tui::buffer::Cell::default()
|
||||
let c = ratatui::buffer::Cell::default()
|
||||
.set_char(char_to_draw)
|
||||
.clone();
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ impl Spinner {
|
|||
.backend_mut()
|
||||
.draw(vec![(0_u16, 0_u16, &c)].into_iter())?;
|
||||
|
||||
tui::backend::Backend::flush(terminal.backend_mut())?;
|
||||
ratatui::backend::Backend::flush(terminal.backend_mut())?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -81,10 +81,10 @@ impl FilesTab {
|
|||
}
|
||||
|
||||
impl DrawableComponent for FilesTab {
|
||||
fn draw<B: tui::backend::Backend>(
|
||||
fn draw<B: ratatui::backend::Backend>(
|
||||
&self,
|
||||
f: &mut tui::Frame<B>,
|
||||
rect: tui::layout::Rect,
|
||||
f: &mut ratatui::Frame<B>,
|
||||
rect: ratatui::layout::Rect,
|
||||
) -> Result<()> {
|
||||
if self.is_visible() {
|
||||
self.files.draw(f, rect)?;
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use std::time::Duration;
|
||||
use sync::CommitTags;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
Frame,
|
||||
};
|
||||
use std::time::Duration;
|
||||
use sync::CommitTags;
|
||||
|
||||
const SLICE_SIZE: usize = 1200;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ use asyncgit::{
|
|||
};
|
||||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use std::borrow::Cow;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
layout::{Alignment, Constraint, Direction, Layout},
|
||||
text::{Span, Spans},
|
||||
widgets::{Block, Borders, Paragraph},
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
|
||||
#[derive(Default, Clone, Copy, Debug)]
|
||||
pub struct StashingOptions {
|
||||
|
|
@ -140,10 +140,10 @@ impl Stashing {
|
|||
}
|
||||
|
||||
impl DrawableComponent for Stashing {
|
||||
fn draw<B: tui::backend::Backend>(
|
||||
fn draw<B: ratatui::backend::Backend>(
|
||||
&self,
|
||||
f: &mut tui::Frame<B>,
|
||||
rect: tui::layout::Rect,
|
||||
f: &mut ratatui::Frame<B>,
|
||||
rect: ratatui::layout::Rect,
|
||||
) -> Result<()> {
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
|
|
|
|||
|
|
@ -148,10 +148,10 @@ impl StashList {
|
|||
}
|
||||
|
||||
impl DrawableComponent for StashList {
|
||||
fn draw<B: tui::backend::Backend>(
|
||||
fn draw<B: ratatui::backend::Backend>(
|
||||
&self,
|
||||
f: &mut tui::Frame<B>,
|
||||
rect: tui::layout::Rect,
|
||||
f: &mut ratatui::Frame<B>,
|
||||
rect: ratatui::layout::Rect,
|
||||
) -> Result<()> {
|
||||
self.list.draw(f, rect)?;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ use asyncgit::{
|
|||
use crossbeam_channel::Sender;
|
||||
use crossterm::event::Event;
|
||||
use itertools::Itertools;
|
||||
use std::convert::Into;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
layout::{Alignment, Constraint, Direction, Layout},
|
||||
style::{Color, Style},
|
||||
widgets::{Block, BorderType, Borders, Paragraph},
|
||||
};
|
||||
use std::convert::Into;
|
||||
|
||||
/// what part of the screen is focused
|
||||
#[derive(PartialEq)]
|
||||
|
|
@ -82,10 +82,10 @@ pub struct Status {
|
|||
}
|
||||
|
||||
impl DrawableComponent for Status {
|
||||
fn draw<B: tui::backend::Backend>(
|
||||
fn draw<B: ratatui::backend::Backend>(
|
||||
&self,
|
||||
f: &mut tui::Frame<B>,
|
||||
rect: tui::layout::Rect,
|
||||
f: &mut ratatui::Frame<B>,
|
||||
rect: ratatui::layout::Rect,
|
||||
) -> Result<()> {
|
||||
let repo_unclean = self.repo_state_unclean();
|
||||
let rects = if repo_unclean {
|
||||
|
|
@ -97,7 +97,7 @@ impl DrawableComponent for Status {
|
|||
)
|
||||
.split(rect)
|
||||
} else {
|
||||
vec![rect]
|
||||
std::rc::Rc::new([rect])
|
||||
};
|
||||
|
||||
let chunks = Layout::default()
|
||||
|
|
@ -215,10 +215,10 @@ impl Status {
|
|||
}
|
||||
}
|
||||
|
||||
fn draw_branch_state<B: tui::backend::Backend>(
|
||||
fn draw_branch_state<B: ratatui::backend::Backend>(
|
||||
&self,
|
||||
f: &mut tui::Frame<B>,
|
||||
chunks: &[tui::layout::Rect],
|
||||
f: &mut ratatui::Frame<B>,
|
||||
chunks: &[ratatui::layout::Rect],
|
||||
) {
|
||||
if let Some(branch_name) = self.git_branch_name.last() {
|
||||
let ahead_behind = self
|
||||
|
|
@ -296,10 +296,10 @@ impl Status {
|
|||
}
|
||||
}
|
||||
|
||||
fn draw_repo_state<B: tui::backend::Backend>(
|
||||
fn draw_repo_state<B: ratatui::backend::Backend>(
|
||||
&self,
|
||||
f: &mut tui::Frame<B>,
|
||||
r: tui::layout::Rect,
|
||||
f: &mut ratatui::Frame<B>,
|
||||
r: ratatui::layout::Rect,
|
||||
) {
|
||||
if self.git_state != RepoState::Clean {
|
||||
let txt = Self::repo_state_text(
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ pub mod style;
|
|||
mod syntax_text;
|
||||
|
||||
use filetreelist::MoveSelection;
|
||||
use ratatui::layout::{Constraint, Direction, Layout, Rect};
|
||||
pub use scrollbar::{draw_scrollbar, Orientation};
|
||||
pub use scrolllist::{draw_list, draw_list_block};
|
||||
pub use stateful_paragraph::{
|
||||
ParagraphState, ScrollPos, StatefulParagraph,
|
||||
};
|
||||
pub use syntax_text::{AsyncSyntaxJob, SyntaxText};
|
||||
use tui::layout::{Constraint, Direction, Layout, Rect};
|
||||
|
||||
use crate::keys::{key_match, SharedKeyConfig};
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ pub fn common_nav(
|
|||
mod test {
|
||||
use super::{rect_inside, Size};
|
||||
use pretty_assertions::assert_eq;
|
||||
use tui::layout::Rect;
|
||||
use ratatui::layout::Rect;
|
||||
|
||||
#[test]
|
||||
fn test_small_rect_in_rect() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::string_utils::trim_offset;
|
||||
use easy_cast::Cast;
|
||||
use tui::text::StyledGrapheme;
|
||||
use ratatui::text::StyledGrapheme;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
const NBSP: &str = "\u{00a0}";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use super::style::SharedTheme;
|
||||
use easy_cast::CastFloat;
|
||||
use std::convert::TryFrom;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
buffer::Buffer,
|
||||
layout::{Margin, Rect},
|
||||
|
|
@ -13,6 +12,7 @@ use tui::{
|
|||
widgets::Widget,
|
||||
Frame,
|
||||
};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
pub enum Orientation {
|
||||
Vertical,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
use super::style::SharedTheme;
|
||||
use std::iter::Iterator;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
backend::Backend,
|
||||
buffer::Buffer,
|
||||
layout::Rect,
|
||||
|
|
@ -9,6 +8,7 @@ use tui::{
|
|||
widgets::{Block, Borders, List, ListItem, Widget},
|
||||
Frame,
|
||||
};
|
||||
use std::iter::Iterator;
|
||||
|
||||
///
|
||||
struct ScrollableList<'b, L, S>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use easy_cast::Cast;
|
||||
use std::iter;
|
||||
use tui::{
|
||||
use ratatui::{
|
||||
buffer::Buffer,
|
||||
layout::{Alignment, Rect},
|
||||
style::Style,
|
||||
text::{StyledGrapheme, Text},
|
||||
widgets::{Block, StatefulWidget, Widget, Wrap},
|
||||
};
|
||||
use std::iter;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use super::reflow::{LineComposer, LineTruncator, WordWrapper};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use asyncgit::{DiffLineType, StatusItemType};
|
||||
use ratatui::style::{Color, Modifier, Style};
|
||||
use ron::{
|
||||
de::from_bytes,
|
||||
ser::{to_string_pretty, PrettyConfig},
|
||||
|
|
@ -11,7 +12,6 @@ use std::{
|
|||
path::PathBuf,
|
||||
rc::Rc,
|
||||
};
|
||||
use tui::style::{Color, Modifier, Style};
|
||||
|
||||
pub type SharedTheme = Rc<Theme>;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use asyncgit::{
|
|||
ProgressPercent,
|
||||
};
|
||||
use once_cell::sync::Lazy;
|
||||
use ratatui::text::{Span, Spans};
|
||||
use scopetime::scope_time;
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
|
|
@ -18,7 +19,6 @@ use syntect::{
|
|||
},
|
||||
parsing::{ParseState, ScopeStack, SyntaxSet},
|
||||
};
|
||||
use tui::text::{Span, Spans};
|
||||
|
||||
use crate::{AsyncAppNotification, SyntaxHighlightProgress};
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ impl SyntaxText {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a SyntaxText> for tui::text::Text<'a> {
|
||||
impl<'a> From<&'a SyntaxText> for ratatui::text::Text<'a> {
|
||||
fn from(v: &'a SyntaxText) -> Self {
|
||||
let mut result_lines: Vec<Spans> =
|
||||
Vec::with_capacity(v.lines.len());
|
||||
|
|
@ -189,22 +189,23 @@ impl<'a> From<&'a SyntaxText> for tui::text::Text<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn syntact_style_to_tui(style: &Style) -> tui::style::Style {
|
||||
let mut res =
|
||||
tui::style::Style::default().fg(tui::style::Color::Rgb(
|
||||
fn syntact_style_to_tui(style: &Style) -> ratatui::style::Style {
|
||||
let mut res = ratatui::style::Style::default().fg(
|
||||
ratatui::style::Color::Rgb(
|
||||
style.foreground.r,
|
||||
style.foreground.g,
|
||||
style.foreground.b,
|
||||
));
|
||||
),
|
||||
);
|
||||
|
||||
if style.font_style.contains(FontStyle::BOLD) {
|
||||
res = res.add_modifier(tui::style::Modifier::BOLD);
|
||||
res = res.add_modifier(ratatui::style::Modifier::BOLD);
|
||||
}
|
||||
if style.font_style.contains(FontStyle::ITALIC) {
|
||||
res = res.add_modifier(tui::style::Modifier::ITALIC);
|
||||
res = res.add_modifier(ratatui::style::Modifier::ITALIC);
|
||||
}
|
||||
if style.font_style.contains(FontStyle::UNDERLINE) {
|
||||
res = res.add_modifier(tui::style::Modifier::UNDERLINED);
|
||||
res = res.add_modifier(ratatui::style::Modifier::UNDERLINED);
|
||||
}
|
||||
|
||||
res
|
||||
|
|
|
|||
Loading…
Reference in a new issue