Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: File navigation in commits #5599

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/desktop/src/lib/utils/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ export function updateSelection({
getFileFunc?: (files: AnyFile[], id: string) => AnyFile | undefined
) {
const file = getFileFunc?.(files, id) ?? getFile(files, id);

if (file) {
fileIdSelection.clearExcept(file.id, commitId);
fileIdSelection.set(file, commitId);
}
}

Expand All @@ -108,6 +107,7 @@ export function updateSelection({
}
}
break;
case 'k':
case KeyName.Up:
if (shiftKey && allowMultiple) {
// Handle case if only one file is selected
Expand All @@ -131,6 +131,7 @@ export function updateSelection({
}
break;

case 'j':
case KeyName.Down:
if (shiftKey && allowMultiple) {
// Handle case if only one file is selected
Expand Down
6 changes: 0 additions & 6 deletions apps/desktop/src/lib/vbranches/fileIdSelection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,6 @@ export class FileIdSelection implements Readable<string[]> {
this.selectedFile.set(undefined);
}

async clearExcept(fileId: string, commitId?: string) {
this.selection = [stringifyKey(fileId, commitId)];
await this.reloadFiles();
this.emit();
}

only(): FileKey | undefined {
if (this.selection.length === 0) return;
const fileKey = parseFileKey(this.selection[0]!);
Expand Down
Loading