Scroll to the top after changing location, fixes #448
This commit is contained in:
parent
6891564533
commit
5a3c63df17
1 changed files with 15 additions and 3 deletions
18
src/tab.rs
18
src/tab.rs
|
|
@ -1704,10 +1704,12 @@ impl Tab {
|
||||||
|
|
||||||
pub fn change_location(&mut self, location: &Location, history_i_opt: Option<usize>) {
|
pub fn change_location(&mut self, location: &Location, history_i_opt: Option<usize>) {
|
||||||
self.location = location.clone();
|
self.location = location.clone();
|
||||||
self.items_opt = None;
|
|
||||||
self.select_focus = None;
|
|
||||||
self.context_menu = None;
|
self.context_menu = None;
|
||||||
self.edit_location = None;
|
self.edit_location = None;
|
||||||
|
self.items_opt = None;
|
||||||
|
//TODO: remember scroll by location?
|
||||||
|
self.scroll_opt = None;
|
||||||
|
self.select_focus = None;
|
||||||
if let Some(history_i) = history_i_opt {
|
if let Some(history_i) = history_i_opt {
|
||||||
// Navigating in history
|
// Navigating in history
|
||||||
self.history_i = history_i;
|
self.history_i = history_i;
|
||||||
|
|
@ -2493,6 +2495,16 @@ impl Tab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scroll to top if needed
|
||||||
|
if self.scroll_opt.is_none() {
|
||||||
|
let offset = AbsoluteOffset { x: 0.0, y: 0.0 };
|
||||||
|
self.scroll_opt = Some(offset);
|
||||||
|
commands.push(Command::Iced(scrollable::scroll_to(
|
||||||
|
self.scrollable_id.clone(),
|
||||||
|
offset,
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
// Change directory if requested
|
// Change directory if requested
|
||||||
if let Some(location) = cd {
|
if let Some(location) = cd {
|
||||||
if matches!(self.mode, Mode::Desktop) {
|
if matches!(self.mode, Mode::Desktop) {
|
||||||
|
|
@ -4009,7 +4021,7 @@ impl Tab {
|
||||||
//TODO: configurable thumbnail size?
|
//TODO: configurable thumbnail size?
|
||||||
let thumbnail_size = (ICON_SIZE_GRID * ICON_SCALE_MAX) as u32;
|
let thumbnail_size = (ICON_SIZE_GRID * ICON_SCALE_MAX) as u32;
|
||||||
let thumbnail = ItemThumbnail::new(&path, mime, thumbnail_size);
|
let thumbnail = ItemThumbnail::new(&path, mime, thumbnail_size);
|
||||||
log::info!("thumbnailed {:?} in {:?}", path, start.elapsed());
|
log::debug!("thumbnailed {:?} in {:?}", path, start.elapsed());
|
||||||
(path, thumbnail)
|
(path, thumbnail)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue