From 14c20c5f32f7076f1b369752807a403d4a3955f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 14 Sep 2018 14:19:25 +0200 Subject: [PATCH] simplify stringIndexToBufferIndex, fix docs --- src/Buffer.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Buffer.ts b/src/Buffer.ts index 383a1f90..d1028d09 100644 --- a/src/Buffer.ts +++ b/src/Buffer.ts @@ -199,7 +199,7 @@ export class Buffer implements IBuffer { * To get the correct buffer position the string must start at `startCol` 0 * (default in translateBufferLineToString). * The method also works on wrapped line strings given rows were not trimmed. - * The method operates on the CharData width attribute, there are no + * The method operates on the CharData string length, there are no * additional content or boundary checks. Therefore the string and the buffer * should not be altered in between. * TODO: respect trim flag after fixing #1685 @@ -208,9 +208,6 @@ export class Buffer implements IBuffer { * @param startCol column offset the string was retrieved from */ public stringIndexToBufferIndex(lineIndex: number, stringIndex: number): BufferIndex { - if (!stringIndex) { - return [lineIndex, 0]; - } while (stringIndex) { const line = this.lines.get(lineIndex); if (!line) {