mirror of
https://github.com/Dummi26/tuifile.git
synced 2025-03-10 11:43:53 +01:00
fixed bugs
1. scroll wasnt set to valid value after changing directory (i.e. after scrolling down, when switching to a directory with so few contents that scrolling is not required, it would display "[_] entries" but not show the first ones) 2. ScanFilesMode was reset on instance duplication
This commit is contained in:
parent
aee0f4fb88
commit
a2a6b9575a
@ -331,7 +331,7 @@ impl TuiFile {
|
|||||||
last_drawn_files_count: self.last_drawn_files_count,
|
last_drawn_files_count: self.last_drawn_files_count,
|
||||||
last_files_max_scroll: self.last_files_max_scroll,
|
last_files_max_scroll: self.last_files_max_scroll,
|
||||||
after_rescanning_files: vec![],
|
after_rescanning_files: vec![],
|
||||||
scan_files_mode: ScanFilesMode::default(),
|
scan_files_mode: self.scan_files_mode.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn new(current_dir: PathBuf) -> io::Result<Self> {
|
pub fn new(current_dir: PathBuf) -> io::Result<Self> {
|
||||||
|
12
src/run.rs
12
src/run.rs
@ -1,5 +1,5 @@
|
|||||||
use crossterm::event::{poll, read, Event, KeyCode, KeyModifiers};
|
use crossterm::event::{poll, read, Event, KeyCode, KeyModifiers};
|
||||||
use crossterm::style::{Attribute, Color, Stylize};
|
use crossterm::style::{Attribute, Stylize};
|
||||||
use crossterm::{cursor, queue, style, terminal, ExecutableCommand};
|
use crossterm::{cursor, queue, style, terminal, ExecutableCommand};
|
||||||
use regex::RegexBuilder;
|
use regex::RegexBuilder;
|
||||||
|
|
||||||
@ -11,7 +11,6 @@ use std::io::Write;
|
|||||||
use std::os::unix::prelude::PermissionsExt;
|
use std::os::unix::prelude::PermissionsExt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
use std::rc::Rc;
|
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::{fs, io};
|
use std::{fs, io};
|
||||||
@ -281,8 +280,13 @@ impl TuiFile {
|
|||||||
}
|
}
|
||||||
if self.updates.rescanning_files_complete() {
|
if self.updates.rescanning_files_complete() {
|
||||||
self.updates.dont_rescanning_files_complete();
|
self.updates.dont_rescanning_files_complete();
|
||||||
if self.current_index >= self.dir_content.len() {
|
if self.current_index >= self.dir_content.len()
|
||||||
self.current_index = self.dir_content.len().saturating_sub(1);
|
|| self.dir_content[self.current_index].passes_filter
|
||||||
|
{
|
||||||
|
self.set_current_index_to_visible(
|
||||||
|
self.dir_content.len().saturating_sub(1),
|
||||||
|
false,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if !self.after_rescanning_files.is_empty() {
|
if !self.after_rescanning_files.is_empty() {
|
||||||
for func in std::mem::replace(&mut self.after_rescanning_files, vec![]) {
|
for func in std::mem::replace(&mut self.after_rescanning_files, vec![]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user