MCPcopy
hub / github.com/xtermjs/xterm.js / getWrappedLineTrimmedLength

Function getWrappedLineTrimmedLength

src/common/buffer/BufferReflow.ts:212–226  ·  view source on GitHub ↗
(lines: BufferLine[], i: number, cols: number)

Source from the content-addressed store, hash-verified

210}
211
212export 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}

Callers 3

_reflowSmallerMethod · 0.90

Calls 3

getTrimmedLengthMethod · 0.65
hasContentMethod · 0.65
getWidthMethod · 0.65

Tested by

no test coverage detected