mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-22 11:03:25 +03:00
update crossterm and ratatui
This commit is contained in:
parent
3a86cb5ca7
commit
b5d527bd97
70
Cargo.lock
generated
70
Cargo.lock
generated
@ -480,13 +480,14 @@ checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
||||
|
||||
[[package]]
|
||||
name = "compact_str"
|
||||
version = "0.7.1"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f"
|
||||
checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644"
|
||||
dependencies = [
|
||||
"castaway",
|
||||
"cfg-if",
|
||||
"itoa",
|
||||
"rustversion",
|
||||
"ryu",
|
||||
"serde",
|
||||
"static_assertions",
|
||||
@ -558,15 +559,15 @@ checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "crossterm"
|
||||
version = "0.27.0"
|
||||
version = "0.28.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df"
|
||||
checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"crossterm_winapi",
|
||||
"libc",
|
||||
"mio",
|
||||
"mio 1.0.2",
|
||||
"parking_lot",
|
||||
"rustix",
|
||||
"serde",
|
||||
"signal-hook",
|
||||
"signal-hook-mio",
|
||||
@ -1662,6 +1663,12 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.12.1"
|
||||
@ -1759,6 +1766,16 @@ dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instability"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b23a0c8dfe501baac4adf6ebbfa6eddf8f0c07f56b058cc1288017e32397846c"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "invalidstring"
|
||||
version = "0.1.3"
|
||||
@ -1995,6 +2012,19 @@ dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"log",
|
||||
"wasi",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "6.1.1"
|
||||
@ -2009,7 +2039,7 @@ dependencies = [
|
||||
"kqueue",
|
||||
"libc",
|
||||
"log",
|
||||
"mio",
|
||||
"mio 0.8.11",
|
||||
"walkdir",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
@ -2412,19 +2442,19 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ratatui"
|
||||
version = "0.27.0"
|
||||
version = "0.28.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d16546c5b5962abf8ce6e2881e722b4e0ae3b6f1a08a26ae3573c55853ca68d3"
|
||||
checksum = "fdef7f9be5c0122f890d58bdf4d964349ba6a6161f705907526d891efabba57d"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"cassowary",
|
||||
"compact_str",
|
||||
"crossterm",
|
||||
"instability",
|
||||
"itertools",
|
||||
"lru",
|
||||
"paste",
|
||||
"serde",
|
||||
"stability",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"unicode-segmentation",
|
||||
@ -2762,12 +2792,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-mio"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
|
||||
checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"mio",
|
||||
"mio 1.0.2",
|
||||
"signal-hook",
|
||||
]
|
||||
|
||||
@ -2888,16 +2918,6 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stability"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "static_assertions"
|
||||
version = "1.1.0"
|
||||
@ -3091,9 +3111,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tui-textarea"
|
||||
version = "0.5.3"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00524c1366ee838839dd327d1f339ff51846ad4ea85bfa1332859e79adec612c"
|
||||
checksum = "29c07084342a575cea919eea996b9658a358c800b03d435df581c1d7c60e065a"
|
||||
dependencies = [
|
||||
"crossterm",
|
||||
"ratatui",
|
||||
|
@ -25,7 +25,7 @@ bytesize = { version = "1.3", default-features = false }
|
||||
chrono = { version = "0.4", default-features = false, features = ["clock"] }
|
||||
clap = { version = "4.5", features = ["env", "cargo"] }
|
||||
crossbeam-channel = "0.5"
|
||||
crossterm = { version = "0.27", features = ["serde"] }
|
||||
crossterm = { version = "0.28", features = ["serde"] }
|
||||
dirs = "5.0"
|
||||
easy-cast = "0.5"
|
||||
filetreelist = { path = "./filetreelist", version = "0.5" }
|
||||
@ -39,7 +39,7 @@ notify-debouncer-mini = "0.4"
|
||||
once_cell = "1"
|
||||
# pin until upgrading this does not introduce a duplicte dependency
|
||||
parking_lot_core = "=0.9.9"
|
||||
ratatui = { version = "0.27", default-features = false, features = [
|
||||
ratatui = { version = "0.28", default-features = false, features = [
|
||||
'crossterm',
|
||||
'serde',
|
||||
] }
|
||||
@ -57,7 +57,7 @@ syntect = { version = "5.2", default-features = false, features = [
|
||||
"default-themes",
|
||||
"html",
|
||||
] }
|
||||
tui-textarea = "0.5"
|
||||
tui-textarea = "0.6"
|
||||
two-face = { version = "0.4.0", default-features = false }
|
||||
unicode-segmentation = "1.11"
|
||||
unicode-truncate = "1.0"
|
||||
|
@ -22,4 +22,4 @@ version = "1.0.3"
|
||||
|
||||
[bans]
|
||||
multiple-versions = "deny"
|
||||
skip-tree = [{ name = "windows-sys" }, { name = "bitflags" }]
|
||||
skip-tree = [{ name = "windows-sys" }, { name = "bitflags" }, { name = "mio" }]
|
||||
|
@ -227,7 +227,7 @@ impl App {
|
||||
|
||||
///
|
||||
pub fn draw(&self, f: &mut Frame) -> Result<()> {
|
||||
let fsize = f.size();
|
||||
let fsize = f.area();
|
||||
|
||||
self.cmdbar.borrow_mut().refresh_width(fsize.width);
|
||||
|
||||
|
@ -82,7 +82,7 @@ macro_rules! draw_popups {
|
||||
]
|
||||
.as_ref(),
|
||||
)
|
||||
.split(f.size())[0];
|
||||
.split(f.area())[0];
|
||||
|
||||
($($self.$element.draw(&mut f, size)?) , +);
|
||||
|
||||
|
@ -623,18 +623,18 @@ impl DrawableComponent for TextInputComponent {
|
||||
let area = if self.embed {
|
||||
rect
|
||||
} else if self.input_type == InputType::Multiline {
|
||||
let area = ui::centered_rect(60, 20, f.size());
|
||||
let area = ui::centered_rect(60, 20, f.area());
|
||||
ui::rect_inside(
|
||||
Size::new(10, 3),
|
||||
f.size().into(),
|
||||
f.area().into(),
|
||||
area,
|
||||
)
|
||||
} else {
|
||||
let area = ui::centered_rect(60, 1, f.size());
|
||||
let area = ui::centered_rect(60, 1, f.area());
|
||||
|
||||
ui::rect_inside(
|
||||
Size::new(10, 3),
|
||||
Size::new(f.size().width, 3),
|
||||
Size::new(f.area().width, 3),
|
||||
area,
|
||||
)
|
||||
};
|
||||
|
@ -302,7 +302,7 @@ fn shutdown_terminal() {
|
||||
|
||||
fn draw(terminal: &mut Terminal, app: &App) -> io::Result<()> {
|
||||
if app.requires_redraw() {
|
||||
terminal.resize(terminal.size()?)?;
|
||||
terminal.clear()?;
|
||||
}
|
||||
|
||||
terminal.draw(|f| {
|
||||
|
@ -64,10 +64,10 @@ impl DrawableComponent for BranchListPopup {
|
||||
let area = ui::centered_rect(
|
||||
PERCENT_SIZE.width,
|
||||
PERCENT_SIZE.height,
|
||||
f.size(),
|
||||
f.area(),
|
||||
);
|
||||
let area =
|
||||
ui::rect_inside(MIN_SIZE, f.size().into(), area);
|
||||
ui::rect_inside(MIN_SIZE, f.area().into(), area);
|
||||
let area = area.intersection(rect);
|
||||
|
||||
f.render_widget(Clear, area);
|
||||
|
@ -35,7 +35,7 @@ impl DrawableComponent for ConfirmPopup {
|
||||
self.theme.text_danger(),
|
||||
);
|
||||
|
||||
let area = ui::centered_rect(50, 20, f.size());
|
||||
let area = ui::centered_rect(50, 20, f.area());
|
||||
f.render_widget(Clear, area);
|
||||
f.render_widget(
|
||||
popup_paragraph(&title, txt, &self.theme, true, true),
|
||||
|
@ -131,7 +131,7 @@ impl DrawableComponent for ExternalEditorPopup {
|
||||
.collect::<Vec<Span>>(),
|
||||
);
|
||||
|
||||
let area = ui::centered_rect_absolute(25, 3, f.size());
|
||||
let area = ui::centered_rect_absolute(25, 3, f.area());
|
||||
f.render_widget(Clear, area);
|
||||
f.render_widget(
|
||||
Paragraph::new(txt)
|
||||
|
@ -119,7 +119,7 @@ impl DrawableComponent for FetchPopup {
|
||||
if self.visible {
|
||||
let progress = self.progress.unwrap_or_default().progress;
|
||||
|
||||
let area = ui::centered_rect_absolute(30, 3, f.size());
|
||||
let area = ui::centered_rect_absolute(30, 3, f.area());
|
||||
|
||||
f.render_widget(Clear, area);
|
||||
f.render_widget(
|
||||
|
@ -39,7 +39,7 @@ impl DrawableComponent for HelpPopup {
|
||||
self.selection.saturating_sub(scroll_threshold);
|
||||
|
||||
let area =
|
||||
ui::centered_rect_absolute(SIZE.0, SIZE.1, f.size());
|
||||
ui::centered_rect_absolute(SIZE.0, SIZE.1, f.area());
|
||||
|
||||
f.render_widget(Clear, area);
|
||||
f.render_widget(
|
||||
|
@ -38,7 +38,7 @@ impl DrawableComponent for MsgPopup {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let max_width = f.size().width.max(MINIMUM_WIDTH);
|
||||
let max_width = f.area().width.max(MINIMUM_WIDTH);
|
||||
|
||||
// determine the maximum width of text block
|
||||
let width = self
|
||||
@ -53,7 +53,7 @@ impl DrawableComponent for MsgPopup {
|
||||
.expect("can't fail because we're clamping to u16 value");
|
||||
|
||||
let area =
|
||||
ui::centered_rect_absolute(width, POPUP_HEIGHT, f.size());
|
||||
ui::centered_rect_absolute(width, POPUP_HEIGHT, f.area());
|
||||
|
||||
// Wrap lines and break words if there is not enough space
|
||||
let wrapped_msg = bwrap::wrap_maybrk!(
|
||||
@ -67,7 +67,7 @@ impl DrawableComponent for MsgPopup {
|
||||
|
||||
let height = POPUP_HEIGHT
|
||||
.saturating_sub(BORDER_WIDTH)
|
||||
.min(f.size().height.saturating_sub(BORDER_WIDTH));
|
||||
.min(f.area().height.saturating_sub(BORDER_WIDTH));
|
||||
|
||||
let top =
|
||||
self.scroll.update_no_selection(line_num, height.into());
|
||||
|
@ -205,7 +205,7 @@ impl DrawableComponent for PullPopup {
|
||||
let (state, progress) =
|
||||
PushPopup::get_progress(&self.progress);
|
||||
|
||||
let area = ui::centered_rect_absolute(30, 3, f.size());
|
||||
let area = ui::centered_rect_absolute(30, 3, f.area());
|
||||
|
||||
f.render_widget(Clear, area);
|
||||
f.render_widget(
|
||||
|
@ -234,7 +234,7 @@ impl DrawableComponent for PushPopup {
|
||||
let (state, progress) =
|
||||
Self::get_progress(&self.progress);
|
||||
|
||||
let area = ui::centered_rect_absolute(30, 3, f.size());
|
||||
let area = ui::centered_rect_absolute(30, 3, f.area());
|
||||
|
||||
f.render_widget(Clear, area);
|
||||
f.render_widget(
|
||||
|
@ -162,7 +162,7 @@ impl DrawableComponent for PushTagsPopup {
|
||||
let (state, progress) =
|
||||
Self::get_progress(&self.progress);
|
||||
|
||||
let area = ui::centered_rect_absolute(30, 3, f.size());
|
||||
let area = ui::centered_rect_absolute(30, 3, f.area());
|
||||
|
||||
f.render_widget(Clear, area);
|
||||
f.render_widget(
|
||||
|
@ -62,10 +62,10 @@ impl DrawableComponent for TagListPopup {
|
||||
let area = ui::centered_rect(
|
||||
PERCENT_SIZE.width,
|
||||
PERCENT_SIZE.height,
|
||||
f.size(),
|
||||
f.area(),
|
||||
);
|
||||
let area =
|
||||
ui::rect_inside(MIN_SIZE, f.size().into(), area);
|
||||
ui::rect_inside(MIN_SIZE, f.area().into(), area);
|
||||
let area = area.intersection(rect);
|
||||
|
||||
let tag_name_width =
|
||||
|
@ -1,7 +1,7 @@
|
||||
use easy_cast::Cast;
|
||||
use ratatui::{
|
||||
buffer::Buffer,
|
||||
layout::{Alignment, Rect},
|
||||
layout::{Alignment, Position, Rect},
|
||||
style::Style,
|
||||
text::{StyledGrapheme, Text},
|
||||
widgets::{Block, StatefulWidget, Widget, Wrap},
|
||||
@ -98,16 +98,6 @@ impl<'a> StatefulParagraph<'a> {
|
||||
self.wrap = Some(wrap);
|
||||
self
|
||||
}
|
||||
|
||||
// pub const fn style(mut self, style: Style) -> Self {
|
||||
// self.style = style;
|
||||
// self
|
||||
// }
|
||||
|
||||
// pub const fn alignment(mut self, alignment: Alignment) -> Self {
|
||||
// self.alignment = alignment;
|
||||
// self
|
||||
// }
|
||||
}
|
||||
|
||||
impl<'a> StatefulWidget for StatefulParagraph<'a> {
|
||||
@ -173,18 +163,20 @@ impl<'a> StatefulWidget for StatefulParagraph<'a> {
|
||||
self.alignment,
|
||||
);
|
||||
for StyledGrapheme { symbol, style } in current_line {
|
||||
buf.get_mut(
|
||||
buf.cell_mut(Position::new(
|
||||
text_area.left() + x,
|
||||
text_area.top() + y - state.scroll.y,
|
||||
)
|
||||
.set_symbol(if symbol.is_empty() {
|
||||
))
|
||||
.map(|cell| {
|
||||
cell.set_symbol(if symbol.is_empty() {
|
||||
// If the symbol is empty, the last char which rendered last time will
|
||||
// leave on the line. It's a quick fix.
|
||||
" "
|
||||
} else {
|
||||
symbol
|
||||
})
|
||||
.set_style(*style);
|
||||
.set_style(*style)
|
||||
});
|
||||
x += Cast::<u16>::cast(symbol.width());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user