Skip to content

Commit 04a994a

Browse files
committed
Fixes possible extra space in compact view
1 parent 9d2fff2 commit 04a994a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/git/models/status.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,23 @@ export class GitStatus {
9090
return `${prefix}${status}${suffix}`;
9191
}
9292

93-
return `${prefix}${compact && added === 0 ? '' : `+${added}${separator}`}${
94-
compact && changed === 0 ? '' : `~${changed}${separator}`
95-
}${compact && deleted === 0 ? '' : `-${deleted}`}${suffix}`;
93+
let status = '';
94+
if (compact) {
95+
if (added !== 0) {
96+
status += `+${added}`;
97+
}
98+
if (changed !== 0) {
99+
status += `${status.length === 0 ? '' : separator}~${changed}`;
100+
}
101+
if (deleted !== 0) {
102+
status += `${status.length === 0 ? '' : separator}-${deleted}`;
103+
}
104+
}
105+
else {
106+
status += `+${added}${separator}~${changed}${separator}-${deleted}`;
107+
}
108+
109+
return `${prefix}${status}${suffix}`;
96110
}
97111

98112
getUpstreamStatus(options: {

0 commit comments

Comments
 (0)