From eba93321df5396458435fafdb6d219a35b2b8db5 Mon Sep 17 00:00:00 2001 From: Spencer Gouw Date: Sun, 8 Oct 2023 03:59:25 -0500 Subject: [PATCH] fix: stop trimming LHS, instead split by div\n --- main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index 6e9faf4..97981a5 100644 --- a/main.ts +++ b/main.ts @@ -127,10 +127,11 @@ export default class JellySnippets extends Plugin { parseSnippets(): void { // If they specified newline control character, split snippets by newline. + // TODO: Can we make it so that leaving the setting blank is newline separation? let snippetDivider = this.settings.snippetDivider == "\\n" ? "\n" - : this.settings.snippetDivider; + : this.settings.snippetDivider + "\n"; // go through the snippets file, split by the snippet divider, split by the part divider, put in map let snippetLines = this.settings.snippetsFile.split(snippetDivider); @@ -138,7 +139,7 @@ export default class JellySnippets extends Plugin { // Trim newlines. Instead, use symbols to let people insert whitespace. // This split means only the first division of the part divider is the LHS. let snippetParts = snippet - .trim() + .trimEnd() .split(this.settings.snippetPartDivider); if (snippetParts.length !== 2) { // probably an incomplete snippet