mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-01 12:26:02 +03:00
Fix shift clicking files
This commit is contained in:
parent
a4878b234d
commit
20f253c3c5
@ -21,8 +21,6 @@
|
||||
const fileIdSelection = getContext(FileIdSelection);
|
||||
const commit = getCommitStore();
|
||||
|
||||
let sortedFiles: AnyFile[] = [];
|
||||
|
||||
function chunk<T>(arr: T[], size: number) {
|
||||
return Array.from({ length: Math.ceil(arr.length / size) }, (v, i) =>
|
||||
arr.slice(i * size, i * size + size)
|
||||
@ -78,11 +76,11 @@
|
||||
showCheckbox={showCheckboxes}
|
||||
selected={$fileIdSelection.includes(stringifyFileKey(file.id, $commit?.id))}
|
||||
on:click={(e) => {
|
||||
selectFilesInList(e, file, fileIdSelection, sortedFiles, allowMultiple, $commit);
|
||||
selectFilesInList(e, file, fileIdSelection, displayedFiles, allowMultiple, $commit);
|
||||
}}
|
||||
on:keydown={(e) => {
|
||||
e.preventDefault();
|
||||
maybeMoveSelection(e.key, file, sortedFiles, fileIdSelection);
|
||||
maybeMoveSelection(e.key, file, displayedFiles, fileIdSelection);
|
||||
}}
|
||||
/>
|
||||
{/each}
|
||||
|
@ -22,7 +22,7 @@ export function selectFilesInList(
|
||||
}
|
||||
} else if (e.shiftKey && allowMultiple) {
|
||||
const initiallySelectedIndex = sortedFiles.findIndex(
|
||||
(file) => stringifyFileKey(file.id, undefined) == selectedFileIds[0]
|
||||
(f) => f.id == fileIdSelection.only()?.fileId
|
||||
);
|
||||
|
||||
// detect the direction of the selection
|
||||
|
Loading…
Reference in New Issue
Block a user