fix #6
This commit is contained in:
parent
e3ba0169ea
commit
48fd5a7508
|
|
@ -66,13 +66,17 @@ impl FileBrowser {
|
||||||
dir_vec.sort_by(|a, b| {
|
dir_vec.sort_by(|a, b| {
|
||||||
let num_a = a.1.parse::<u32>().unwrap_or(u32::MAX);
|
let num_a = a.1.parse::<u32>().unwrap_or(u32::MAX);
|
||||||
let num_b = b.1.parse::<u32>().unwrap_or(u32::MAX);
|
let num_b = b.1.parse::<u32>().unwrap_or(u32::MAX);
|
||||||
num_a.cmp(&num_b).then_with(|| a.1.to_lowercase().cmp(&b.1.to_lowercase()))
|
num_a
|
||||||
|
.cmp(&num_b)
|
||||||
|
.then_with(|| a.1.to_lowercase().cmp(&b.1.to_lowercase()))
|
||||||
});
|
});
|
||||||
|
|
||||||
file_vec.sort_by(|a, b| {
|
file_vec.sort_by(|a, b| {
|
||||||
let num_a = a.1.parse::<u32>().unwrap_or(u32::MAX);
|
let num_a = a.1.parse::<u32>().unwrap_or(u32::MAX);
|
||||||
let num_b = b.1.parse::<u32>().unwrap_or(u32::MAX);
|
let num_b = b.1.parse::<u32>().unwrap_or(u32::MAX);
|
||||||
num_a.cmp(&num_b).then_with(|| a.1.to_lowercase().cmp(&b.1.to_lowercase()))
|
num_a
|
||||||
|
.cmp(&num_b)
|
||||||
|
.then_with(|| a.1.to_lowercase().cmp(&b.1.to_lowercase()))
|
||||||
});
|
});
|
||||||
|
|
||||||
dir_vec.extend(file_vec);
|
dir_vec.extend(file_vec);
|
||||||
|
|
@ -128,9 +132,11 @@ impl FileBrowser {
|
||||||
/// handles going back event
|
/// handles going back event
|
||||||
pub fn handle_go_back(&mut self, conn: &mut Connection) -> AppResult<()> {
|
pub fn handle_go_back(&mut self, conn: &mut Connection) -> AppResult<()> {
|
||||||
if self.prev_path != "." {
|
if self.prev_path != "." {
|
||||||
let r = self.path.rfind('/').unwrap();
|
let r = self.path.rfind('/');
|
||||||
self.path = self.path.as_str()[..r].to_string();
|
if let Some(r) = r {
|
||||||
self.update_directory(conn)?;
|
self.path = self.path.as_str()[..r].to_string();
|
||||||
|
self.update_directory(conn)?;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.path = self.prev_path.clone();
|
self.path = self.prev_path.clone();
|
||||||
self.update_directory(conn)?;
|
self.update_directory(conn)?;
|
||||||
|
|
|
||||||
Reference in New Issue