From 7fada393922b5e025afce58d441b2d904808630e Mon Sep 17 00:00:00 2001 From: Pine Wu Date: Thu, 5 Dec 2019 16:27:35 -0800 Subject: [PATCH] Fix #86151 --- .../client/src/mirrorCursor.ts | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/extensions/html-language-features/client/src/mirrorCursor.ts b/extensions/html-language-features/client/src/mirrorCursor.ts index 8f6f3ca6db5..43ea3169c97 100644 --- a/extensions/html-language-features/client/src/mirrorCursor.ts +++ b/extensions/html-language-features/client/src/mirrorCursor.ts @@ -161,6 +161,36 @@ function isCharBeforeAndAfterPositionsRoughtlyEqual(document: TextDocument, firs const charBeforeSecondarySelection = getCharBefore(document, secondPos); const charAfterSecondarySelection = getCharAfter(document, secondPos); + /** + * Special case for exiting + * |
+ * |
+ */ + if ( + charBeforePrimarySelection === ' ' && + charBeforeSecondarySelection === ' ' && + charAfterPrimarySelection === '<' && + charAfterSecondarySelection === '<' + ) { + return false; + } + /** + * Special case for exiting + * |
+ * |
+ */ + if (charBeforePrimarySelection === '\n' && charBeforeSecondarySelection === '\n') { + return false; + } + /** + * Special case for exiting + *
| + *
| + */ + if (charAfterPrimarySelection === '\n' && charAfterSecondarySelection === '\n') { + return false; + } + // Exit mirror mode when cursor position no longer mirror // Unless it's in the case of `<|>` const charBeforeBothPositionRoughlyEqual =