cargo fmt
This commit is contained in:
parent
282d41ceb4
commit
50f2645093
20
src/game.rs
20
src/game.rs
@ -1,4 +1,9 @@
|
|||||||
use std::{error::Error, fmt::{self}, fs, path::PathBuf};
|
use std::{
|
||||||
|
error::Error,
|
||||||
|
fmt::{self},
|
||||||
|
fs,
|
||||||
|
path::PathBuf,
|
||||||
|
};
|
||||||
|
|
||||||
use color_eyre::eyre::Result;
|
use color_eyre::eyre::Result;
|
||||||
use crossterm::event::{Event, KeyCode};
|
use crossterm::event::{Event, KeyCode};
|
||||||
@ -121,7 +126,11 @@ impl GameModel {
|
|||||||
entries.sort();
|
entries.sort();
|
||||||
let max_entry_length = entries
|
let max_entry_length = entries
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|entry| entry.file_name().map(|entry| entry.to_string_lossy().chars().count()))
|
.filter_map(|entry| {
|
||||||
|
entry
|
||||||
|
.file_name()
|
||||||
|
.map(|entry| entry.to_string_lossy().chars().count())
|
||||||
|
})
|
||||||
.max()
|
.max()
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
|
|
||||||
@ -168,7 +177,8 @@ impl GameModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (j, c) in entry
|
for (j, c) in entry
|
||||||
.file_name().ok_or(GameError {})?
|
.file_name()
|
||||||
|
.ok_or(GameError {})?
|
||||||
.to_string_lossy()
|
.to_string_lossy()
|
||||||
.chars()
|
.chars()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
@ -240,7 +250,9 @@ impl GameModel {
|
|||||||
GameEvent::Navigate(target) => {
|
GameEvent::Navigate(target) => {
|
||||||
let path = match target {
|
let path = match target {
|
||||||
NavigationTarget::Path(path) => path,
|
NavigationTarget::Path(path) => path,
|
||||||
NavigationTarget::Parent => self.path.parent().ok_or(GameError {})?.to_path_buf(),
|
NavigationTarget::Parent => {
|
||||||
|
self.path.parent().ok_or(GameError {})?.to_path_buf()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewModel(Self::new(path)?)
|
NewModel(Self::new(path)?)
|
||||||
|
|||||||
@ -104,4 +104,4 @@ impl<T> Grid<T> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,11 @@ mod geometry;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use color_eyre::eyre::Result;
|
use color_eyre::eyre::Result;
|
||||||
use crossterm::{event::{self, DisableMouseCapture, EnableMouseCapture}, execute, terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode}};
|
use crossterm::{
|
||||||
|
event::{self, DisableMouseCapture, EnableMouseCapture},
|
||||||
|
execute,
|
||||||
|
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
|
||||||
|
};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
Terminal,
|
Terminal,
|
||||||
prelude::{Backend, CrosstermBackend},
|
prelude::{Backend, CrosstermBackend},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user