Fix arrow keys in gallery
This commit is contained in:
parent
081156670e
commit
f54f2efa6a
1 changed files with 146 additions and 120 deletions
30
src/tab.rs
30
src/tab.rs
|
|
@ -2288,7 +2288,13 @@ impl Tab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::ItemDown => {
|
Message::ItemDown => {
|
||||||
if let Some((row, col)) = self.select_focus_pos_opt().or(self.select_last_pos_opt())
|
if self.gallery {
|
||||||
|
for command in self.update(Message::GalleryNext, modifiers) {
|
||||||
|
commands.push(command);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if let Some((row, col)) =
|
||||||
|
self.select_focus_pos_opt().or(self.select_last_pos_opt())
|
||||||
{
|
{
|
||||||
if self.select_focus.is_none() {
|
if self.select_focus.is_none() {
|
||||||
// Select last item in current selection to focus it.
|
// Select last item in current selection to focus it.
|
||||||
|
|
@ -2316,7 +2322,13 @@ impl Tab {
|
||||||
commands.push(Command::Iced(widget::button::focus(id)));
|
commands.push(Command::Iced(widget::button::focus(id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Message::ItemLeft => {
|
Message::ItemLeft => {
|
||||||
|
if self.gallery {
|
||||||
|
for command in self.update(Message::GalleryPrevious, modifiers) {
|
||||||
|
commands.push(command);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if let Some((row, col)) =
|
if let Some((row, col)) =
|
||||||
self.select_focus_pos_opt().or(self.select_first_pos_opt())
|
self.select_focus_pos_opt().or(self.select_first_pos_opt())
|
||||||
{
|
{
|
||||||
|
|
@ -2364,8 +2376,15 @@ impl Tab {
|
||||||
commands.push(Command::Iced(widget::button::focus(id)));
|
commands.push(Command::Iced(widget::button::focus(id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Message::ItemRight => {
|
Message::ItemRight => {
|
||||||
if let Some((row, col)) = self.select_focus_pos_opt().or(self.select_last_pos_opt())
|
if self.gallery {
|
||||||
|
for command in self.update(Message::GalleryNext, modifiers) {
|
||||||
|
commands.push(command);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if let Some((row, col)) =
|
||||||
|
self.select_focus_pos_opt().or(self.select_last_pos_opt())
|
||||||
{
|
{
|
||||||
if self.select_focus.is_none() {
|
if self.select_focus.is_none() {
|
||||||
// Select last item in current selection to focus it.
|
// Select last item in current selection to focus it.
|
||||||
|
|
@ -2394,7 +2413,13 @@ impl Tab {
|
||||||
commands.push(Command::Iced(widget::button::focus(id)));
|
commands.push(Command::Iced(widget::button::focus(id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Message::ItemUp => {
|
Message::ItemUp => {
|
||||||
|
if self.gallery {
|
||||||
|
for command in self.update(Message::GalleryPrevious, modifiers) {
|
||||||
|
commands.push(command);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if let Some((row, col)) =
|
if let Some((row, col)) =
|
||||||
self.select_focus_pos_opt().or(self.select_first_pos_opt())
|
self.select_focus_pos_opt().or(self.select_first_pos_opt())
|
||||||
{
|
{
|
||||||
|
|
@ -2427,6 +2452,7 @@ impl Tab {
|
||||||
commands.push(Command::Iced(widget::button::focus(id)));
|
commands.push(Command::Iced(widget::button::focus(id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Message::Location(location) => {
|
Message::Location(location) => {
|
||||||
// Workaround to support favorited files
|
// Workaround to support favorited files
|
||||||
match &location {
|
match &location {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue