From 125cf15a68ed50b32bd881c33a486cf0646191ea Mon Sep 17 00:00:00 2001 From: tel0065 <77864718+tel0065@users.noreply.github.com> Date: Thu, 24 Mar 2022 04:48:59 -0500 Subject: [PATCH] fixed plural output logic Fixed logic of output, was showing singular for '0' ie: '0 space' instead of '0 spaces' - This has been resolved. --- src/commands/text.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/commands/text.js b/src/commands/text.js index f9ab81e..5c18975 100644 --- a/src/commands/text.js +++ b/src/commands/text.js @@ -73,8 +73,8 @@ function getIndent() { }; let i = pl.Lexer.getIndent(textLine.text, tabFmt); - // Ternary operator to change the tense of 'indent' to 'indents' for the output if i is greater than 1 - (i > 1) ? + /* Ternary operator to change the tense of 'indent' to 'indents' for the output if i is 0 or greater than 1 */ + (i !== 1) ? vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indents`): vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${i.toString()} indent`); } @@ -120,8 +120,8 @@ function getLeadingSpaces() { pl.Lexer.getLeadingSpacesByArithmetic(textLine) : pl.Lexer.getLeadingSpacesByIndex(textLine); - /* Ternary operator to change the tense of 'space' to 'spaces' for the output if numSpaces is greater than 1 */ - (numSpaces > 1) ? + /* Ternary operator to change the tense of 'space' to 'spaces' for the output if numSpaces is 0 or greater than 1 */ + (numSpaces !== 1) ? vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} spaces`): vscode.window.showInformationMessage(`Line ${lineNum.toString()}: ${numSpaces.toString()} space`); }