Web: Files: Hotkeys: fixed caretIndex

This commit is contained in:
Nikita Gopienko 2022-04-19 15:57:58 +03:00
parent 1527b925ed
commit 460abe43d1

View File

@ -472,7 +472,10 @@ class HotkeyStore {
get caretIndex() {
const { filesList, hotkeyCaret, selection } = this.filesStore;
const id = selection.length ? selection[0].id : hotkeyCaret?.id;
const id =
selection.length && selection.length === 1 && !hotkeyCaret
? selection[0].id
: hotkeyCaret?.id;
const caretIndex = filesList.findIndex((f) => f.id === id);
if (caretIndex !== -1) return caretIndex;
@ -522,7 +525,7 @@ class HotkeyStore {
}
get prevFile() {
const { filesList, selection, hotkeyCaret } = this.filesStore;
const { filesList } = this.filesStore;
if (this.caretIndex !== -1) {
const prevCaretIndex = this.caretIndex - 1;