mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-05 08:29:30 +03:00
Merge pull request #3908 from gitbutlerapp/fix-branch-files-list
Fix shift clicking files
This commit is contained in:
commit
b7587ecafc
@ -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