mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 11:20:36 +08:00
Add Heartwood translation layer for file diffs
Co-authored-by: xphoniex <dj.2dixx@gmail.com> Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
co-authored by
xphoniex
parent
ca10a69ee5
commit
4bb34023c2
+15
-10
@@ -1,10 +1,10 @@
|
||||
export const lineNumberR = (line: LineDiff): string | number => {
|
||||
switch (line.type) {
|
||||
case LineDiffType.Addition: {
|
||||
return line.lineNum;
|
||||
return line.lineNo;
|
||||
}
|
||||
case LineDiffType.Context: {
|
||||
return line.lineNumNew;
|
||||
return line.lineNoNew;
|
||||
}
|
||||
case LineDiffType.Deletion: {
|
||||
return " ";
|
||||
@@ -18,10 +18,10 @@ export const lineNumberL = (line: LineDiff): string | number => {
|
||||
return " ";
|
||||
}
|
||||
case LineDiffType.Context: {
|
||||
return line.lineNumOld;
|
||||
return line.lineNoOld;
|
||||
}
|
||||
case LineDiffType.Deletion: {
|
||||
return line.lineNum;
|
||||
return line.lineNo;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -41,7 +41,7 @@ export const lineSign = (line: LineDiff): string => {
|
||||
};
|
||||
|
||||
export enum LineDiffType {
|
||||
Addition = "addition",
|
||||
Addition = "insertion",
|
||||
Context = "context",
|
||||
Deletion = "deletion",
|
||||
}
|
||||
@@ -49,20 +49,20 @@ export enum LineDiffType {
|
||||
export interface Addition {
|
||||
type: LineDiffType.Addition;
|
||||
line: string;
|
||||
lineNum: number;
|
||||
lineNo: number;
|
||||
}
|
||||
|
||||
export interface Context {
|
||||
type: LineDiffType.Context;
|
||||
line: string;
|
||||
lineNumNew: number;
|
||||
lineNumOld: number;
|
||||
lineNoNew: number;
|
||||
lineNoOld: number;
|
||||
}
|
||||
|
||||
export interface Deletion {
|
||||
type: LineDiffType.Deletion;
|
||||
line: string;
|
||||
lineNum: number;
|
||||
lineNo: number;
|
||||
}
|
||||
|
||||
export type LineDiff = Addition | Deletion | Context;
|
||||
@@ -84,13 +84,18 @@ export interface Hunk {
|
||||
}
|
||||
|
||||
export interface Diff {
|
||||
created: FileDiff[];
|
||||
added: FileDiff[];
|
||||
deleted: FileDiff[];
|
||||
moved: string[];
|
||||
copied: string[];
|
||||
modified: FileDiff[];
|
||||
}
|
||||
|
||||
export interface DiffStats {
|
||||
insertions: number;
|
||||
deletions: number;
|
||||
}
|
||||
|
||||
export enum EofNewLine {
|
||||
OldMissing = "oldMissing",
|
||||
NewMissing = "newMissing",
|
||||
|
||||
Reference in New Issue
Block a user