From 39f9f5029605eb4face0fb13e8378dd4384ba848 Mon Sep 17 00:00:00 2001 From: Caleb Owens Date: Wed, 9 Oct 2024 11:21:51 +0200 Subject: [PATCH] Float unconflicted files in edit mode --- apps/desktop/src/lib/components/EditMode.svelte | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/lib/components/EditMode.svelte b/apps/desktop/src/lib/components/EditMode.svelte index 6ab01b13c..19816d123 100644 --- a/apps/desktop/src/lib/components/EditMode.svelte +++ b/apps/desktop/src/lib/components/EditMode.svelte @@ -123,7 +123,16 @@ } const files = Array.from(outputMap.values()); - files.sort((a, b) => a.path.localeCompare(b.path)); + files.sort((a, b) => { + // Float conflicted files to the top + if (a.conflicted && !b.conflicted) { + return -1; + } else if (!a.conflicted && b.conflicted) { + return 1; + } + + return a.path.localeCompare(b.path); + }); return files; });