diff --git a/src/Buffer.ts b/src/Buffer.ts index 3e7d61224..9d47666f4 100644 --- a/src/Buffer.ts +++ b/src/Buffer.ts @@ -217,7 +217,10 @@ export class Buffer implements IBuffer { // needed here because some chars are 0 characters long (eg. after wide // chars) and some chars are longer than 1 characters long (eg. emojis). let startIndex = startCol; - endCol = endCol || line.length; + // Only set endCol to the line length when it is null. 0 is a valid column. + if (endCol === null) { + endCol = line.length; + } let endIndex = endCol; for (let i = 0; i < line.length; i++) {