Skip to content

Commit

Permalink
update crossterm and ratatui
Browse files Browse the repository at this point in the history
  • Loading branch information
extrawurst committed Sep 17, 2024
1 parent 3a86cb5 commit b5d527b
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 71 deletions.
70 changes: 45 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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',
] }
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }]
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ macro_rules! draw_popups {
]
.as_ref(),
)
.split(f.size())[0];
.split(f.area())[0];

($($self.$element.draw(&mut f, size)?) , +);

Expand Down
8 changes: 4 additions & 4 deletions src/components/textinput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
};
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
4 changes: 2 additions & 2 deletions src/popups/branchlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/popups/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/popups/externaleditor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/popups/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/popups/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions src/popups/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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!(
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion src/popups/pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/popups/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/popups/push_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/popups/taglist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Loading

0 comments on commit b5d527b

Please sign in to comment.