Skip to content

Commit 5e397e0

Browse files
committed
feat(UnifiedDiffView): add user settings to diff view
Adds user settings to the UnifiedDiffView component, allowing users to customize the appearance of the diff view. This includes options for enabling/disabling ligatures, setting the tab size, wrapping text, changing the font, adjusting the contrast, and toggling inline unified diffs.
1 parent aa2b3a9 commit 5e397e0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

apps/desktop/src/components/v3/UnifiedDiffView.svelte

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
ChangeSelectionService,
99
type PartiallySelectedFile
1010
} from '$lib/selection/changeSelection.svelte';
11+
import { SETTINGS, type Settings } from '$lib/settings/userSettings';
1112
import { UiState } from '$lib/state/uiState.svelte';
12-
import { inject } from '@gitbutler/shared/context';
13+
import { getContextStoreBySymbol, inject } from '@gitbutler/shared/context';
1314
import HunkDiff from '@gitbutler/ui/HunkDiff.svelte';
1415
import type { TreeChange } from '$lib/hunks/change';
1516
import type { DiffHunk } from '$lib/hunks/hunk';
@@ -41,6 +42,8 @@
4142
4243
const lineSelection = new LineSelection(changeSelection);
4344
45+
const userSettings = getContextStoreBySymbol<Settings>(SETTINGS);
46+
4447
$effect(() => {
4548
lineSelection.setChange(change);
4649
});
@@ -164,6 +167,12 @@
164167
hunkStr={hunk.diff}
165168
{staged}
166169
{stagedLines}
170+
diffLigatures={$userSettings.diffLigatures}
171+
tabSize={$userSettings.tabSize}
172+
wrapText={$userSettings.wrapText}
173+
diffFont={$userSettings.diffFont}
174+
diffContrast={$userSettings.diffContrast}
175+
inlineUnifiedDiffs={$userSettings.inlineUnifiedDiffs}
167176
onLineClick={(p) =>
168177
lineSelection.toggleStageLines(selection, hunk, p, diff.subject.hunks)}
169178
onChangeStage={(selected) => {

0 commit comments

Comments
 (0)