From 04a994a7d100c9b8d4d9bc582583e03cde294e15 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 13 Dec 2018 02:50:15 -0500 Subject: [PATCH] Fixes possible extra space in compact view --- src/git/models/status.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/git/models/status.ts b/src/git/models/status.ts index c5cc690..ce6e3a1 100644 --- a/src/git/models/status.ts +++ b/src/git/models/status.ts @@ -90,9 +90,23 @@ export class GitStatus { return `${prefix}${status}${suffix}`; } - return `${prefix}${compact && added === 0 ? '' : `+${added}${separator}`}${ - compact && changed === 0 ? '' : `~${changed}${separator}` - }${compact && deleted === 0 ? '' : `-${deleted}`}${suffix}`; + let status = ''; + if (compact) { + if (added !== 0) { + status += `+${added}`; + } + if (changed !== 0) { + status += `${status.length === 0 ? '' : separator}~${changed}`; + } + if (deleted !== 0) { + status += `${status.length === 0 ? '' : separator}-${deleted}`; + } + } + else { + status += `+${added}${separator}~${changed}${separator}-${deleted}`; + } + + return `${prefix}${status}${suffix}`; } getUpstreamStatus(options: {