diff --git a/.gitignore b/.gitignore index b73145d..02868b0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ __pycache__/ *.egg-info/ /cista/_version.py /cista/wwwroot/* -/cista-front/components.d.ts # Generated /dist diff --git a/cista-front/.gitignore b/cista-front/.gitignore index 356712c..36cf632 100644 --- a/cista-front/.gitignore +++ b/cista-front/.gitignore @@ -16,6 +16,7 @@ dist dist-ssr coverage *.local +components.d.ts /cypress/videos/ /cypress/screenshots/ diff --git a/cista-front/src/App.vue b/cista-front/src/App.vue index 6c52bbb..79250be 100644 --- a/cista-front/src/App.vue +++ b/cista-front/src/App.vue @@ -92,10 +92,13 @@ const globalShortcutHandler = (event: KeyboardEvent) => { } if (!timer) { // Initial move, then t0 delay until repeats at tr intervals - documentStore.fileExplorer.cursorMove(vert) + const select = event.shiftKey + documentStore.fileExplorer.cursorMove(vert, select) const t0 = 200, tr = 30 timer = setTimeout( - () => timer = setInterval(() => { documentStore.fileExplorer.cursorMove(vert) }, tr), + () => timer = setInterval(() => { + documentStore.fileExplorer.cursorMove(vert, select) + }, tr), t0 - tr ) } diff --git a/cista-front/src/components/FileExplorer.vue b/cista-front/src/components/FileExplorer.vue index ae07793..45ea629 100644 --- a/cista-front/src/components/FileExplorer.vue +++ b/cista-front/src/components/FileExplorer.vue @@ -189,7 +189,6 @@ defineExpose({ editing.value = cursor.value }, cursorSelect() { - console.log('select', documentStore.selected) const doc = cursor.value if (!doc) return if (documentStore.selected.has(doc.key)) { @@ -199,7 +198,7 @@ defineExpose({ } this.cursorMove(1) }, - cursorMove(d: number) { + cursorMove(d: number, select = false) { // Move cursor up or down (keyboard navigation) const documents = sorted(props.documents as FolderDocument[]) if (documents.length === 0) { @@ -208,10 +207,23 @@ defineExpose({ } const mod = (a: number, b: number) => ((a % b) + b) % b const index = cursor.value !== null ? documents.indexOf(cursor.value) : -1 - cursor.value = documents[mod(index + d, documents.length + 1)] ?? null + const moveto = mod(index + d, documents.length + 1) + cursor.value = documents[moveto] ?? null const tr = document.getElementById( `file-${cursor.value.key}` ) as HTMLTableRowElement | null + if (select) { + // Go forwards, possibly wrapping over the end; the last entry is not toggled + let [begin, end] = d > 0 ? [index, moveto] : [moveto, index] + for (let p = begin; p !== end; p = mod(p + 1, documents.length)) { + const doc = documents[p] + if (documentStore.selected.has(doc.key)) { + documentStore.selected.delete(doc.key) + } else { + documentStore.selected.add(doc.key) + } + } + } // @ts-ignore scrolltr = tr if (!scrolltimer) { diff --git a/cista-front/src/components/FileRenameInput.vue b/cista-front/src/components/FileRenameInput.vue index 7368778..82a74ca 100644 --- a/cista-front/src/components/FileRenameInput.vue +++ b/cista-front/src/components/FileRenameInput.vue @@ -3,6 +3,7 @@ ref="input" id="FileRenameInput" type="text" + autocorrect="off" v-model="name" @blur="exit" @keyup.esc="exit"