(lines: BufferLine[], i: number, cols: number)
| 210 | } |
| 211 | |
| 212 | export function getWrappedLineTrimmedLength(lines: BufferLine[], i: number, cols: number): number { |
| 213 | // If this is the last row in the wrapped line, get the actual trimmed length |
| 214 | if (i === lines.length - 1) { |
| 215 | return lines[i].getTrimmedLength(); |
| 216 | } |
| 217 | // Detect whether the following line starts with a wide character and the end of the current line |
| 218 | // is null, if so then we can be pretty sure the null character should be excluded from the line |
| 219 | // length] |
| 220 | const endsInNull = !(lines[i].hasContent(cols - 1)) && lines[i].getWidth(cols - 1) === 1; |
| 221 | const followingLineStartsWithWide = lines[i + 1].getWidth(0) === 2; |
| 222 | if (endsInNull && followingLineStartsWithWide) { |
| 223 | return cols - 1; |
| 224 | } |
| 225 | return cols; |
| 226 | } |
no test coverage detected