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