From 42c37d829310b7b5ffea96a484879dc87b68b685 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 4 Sep 2019 16:01:28 +0200 Subject: [PATCH] fixup: improve quote and code block newline handling --- src/editor/operations.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/editor/operations.js b/src/editor/operations.js index df3047618b..a8c9ac6d25 100644 --- a/src/editor/operations.js +++ b/src/editor/operations.js @@ -59,7 +59,7 @@ export function formatRangeAsQuote(range) { if (!rangeStartsAtBeginningOfLine(range)) { parts.unshift(partCreator.newline()); } - if (rangeEndsAtEndOfLine(range)) { + if (!rangeEndsAtEndOfLine(range)) { parts.push(partCreator.newline()); } @@ -79,15 +79,14 @@ export function formatRangeAsCode(range) { parts.push( partCreator.newline(), partCreator.plain("```")); - if (rangeEndsAtEndOfLine(range)) { + if (!rangeEndsAtEndOfLine(range)) { parts.push(partCreator.newline()); } - replaceRangeAndExpandSelection(model, range, parts); } else { parts.unshift(partCreator.plain("`")); parts.push(partCreator.plain("`")); - replaceRangeAndExpandSelection(model, range, parts); } + replaceRangeAndExpandSelection(model, range, parts); } export function formatInline(range, prefix, suffix = prefix) {