From cced601d686d550f4225018e5311b7433efbb5ae Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Mon, 6 Jan 2020 20:14:49 +0100 Subject: [PATCH] added hyphen lines for longer names --- .../State/Code/Renderer/FunctionRenderer.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/application/State/Code/Renderer/FunctionRenderer.ts b/src/application/State/Code/Renderer/FunctionRenderer.ts index 87f71624..8f51c2f5 100644 --- a/src/application/State/Code/Renderer/FunctionRenderer.ts +++ b/src/application/State/Code/Renderer/FunctionRenderer.ts @@ -11,15 +11,15 @@ export class FunctionRenderer extends CodeRenderer { } private renderFunctionStartComment(functionName: string): string { - if (functionName.length >= this.totalFunctionSeparatorChars) { - return this.renderComment(functionName); - } - return this.renderComment(this.trailingHyphens) + '\n' + - this.renderFunctionName(functionName) + '\n' + - this.renderComment(this.trailingHyphens); + return this.renderComment(this.trailingHyphens) + '\n' + + this.renderFunctionName(functionName) + '\n' + + this.renderComment(this.trailingHyphens); } private renderFunctionName(functionName: string) { + if (functionName.length >= this.totalFunctionSeparatorChars) { + return this.renderComment(functionName); + } const firstHyphens = '-'.repeat(Math.floor((this.totalFunctionSeparatorChars - functionName.length) / 2)); const secondHyphens = '-'.repeat(Math.ceil((this.totalFunctionSeparatorChars - functionName.length) / 2)); return `${this.renderComment()}${firstHyphens}${functionName}${secondHyphens}`;