Skip to content

Commit

Permalink
refact: minor fixes (#971)
Browse files Browse the repository at this point in the history
* Fix unused float handle mouse function, pub mod appstate

Fix unnecessary usage of pub mod for appstate and resolve unused float handle mouse function

* Resolve clippy warnings

Remove explicit lifetime for floatcontent impl. Use div_ceil instead of manually calculating the rows for hints
  • Loading branch information
jeevithakannan2 authored Jan 10, 2025
1 parent f67766b commit 06c9a41
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tui/src/floating_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl<'a> FloatingText<'a> {
}
}

impl<'a> FloatContent for FloatingText<'a> {
impl FloatContent for FloatingText<'_> {
fn draw(&mut self, frame: &mut Frame, area: Rect, _theme: &Theme) {
let block = Block::default()
.borders(Borders::ALL)
Expand Down
2 changes: 1 addition & 1 deletion tui/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn create_shortcut_list(
.unwrap_or(0);

let columns = (render_width as usize / (max_shortcut_width + 4)).max(1);
let rows = (shortcut_spans.len() + columns - 1) / columns;
let rows = shortcut_spans.len().div_ceil(columns);

let mut lines: Vec<Line<'static>> = Vec::with_capacity(rows);

Expand Down
2 changes: 1 addition & 1 deletion tui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod floating_text;
mod hint;
mod root;
mod running_command;
pub mod state;
mod state;
mod theme;

#[cfg(feature = "tips")]
Expand Down
2 changes: 1 addition & 1 deletion tui/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ impl AppState {
}
match &mut self.focus {
Focus::FloatingWindow(float) => {
float.content.handle_mouse_event(event);
float.handle_mouse_event(event);
}
Focus::ConfirmationPrompt(confirm) => {
confirm.content.handle_mouse_event(event);
Expand Down

0 comments on commit 06c9a41

Please sign in to comment.