From 0b6c21feb696280c31dd1de2d2383f9252246bbc Mon Sep 17 00:00:00 2001 From: Tom Z?hner Date: Fri, 1 Feb 2019 14:31:57 +0100 Subject: [PATCH] Don't match empty before / after selection --- src/components/locator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/locator.ts b/src/components/locator.ts index 43dbace92..98d7aa447 100644 --- a/src/components/locator.ts +++ b/src/components/locator.ts @@ -300,9 +300,9 @@ export class Locator { // columns are typically not supplied by SyncTex, this could change in the future for some engines though if (col === 0) { const line = doc.lineAt(row) - if (line.text.indexOf(data.textBeforeSelection) > -1) { + if (data.textBeforeSelection !== '' && line.text.indexOf(data.textBeforeSelection) > -1) { col = line.text.indexOf(data.textBeforeSelection) + data.textBeforeSelection.length - } else if (line.text.indexOf(data.textAfterSelection) > -1) { + } else if (data.textAfterSelection !== '' && line.text.indexOf(data.textAfterSelection) > -1) { col = line.text.indexOf(data.textAfterSelection) } }