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

Method addCodepointToCell

src/common/buffer/BufferLine.ts:230–254  ·  view source on GitHub ↗

* Add a codepoint to a cell from input handler. * During input stage combining chars with a width of 0 follow and stack * onto a leading char. Since we already set the attrs * by the previous `setDataFromCodePoint` call, we can omit it here.

(index: number, codePoint: number, width: number)

Source from the content-addressed store, hash-verified

228 * by the previous `setDataFromCodePoint` call, we can omit it here.
229 */
230 public addCodepointToCell(index: number, codePoint: number, width: number): void {
231 let content = this._data[index * CELL_SIZE + Cell.CONTENT];
232 if (content & Content.IS_COMBINED_MASK) {
233 // we already have a combined string, simply add
234 this._combined[index] += stringFromCodePoint(codePoint);
235 } else {
236 if (content & Content.CODEPOINT_MASK) {
237 // normal case for combining chars:
238 // - move current leading char + new one into combined string
239 // - set combined flag
240 this._combined[index] = stringFromCodePoint(content & Content.CODEPOINT_MASK) + stringFromCodePoint(codePoint);
241 content &= ~Content.CODEPOINT_MASK; // set codepoint in buffer to 0
242 content |= Content.IS_COMBINED_MASK;
243 } else {
244 // should not happen - we actually have no data in the cell yet
245 // simply set the data in the cell buffer with a width of 1
246 content = codePoint | (1 << Content.WIDTH_SHIFT);
247 }
248 }
249 if (width) {
250 content &= ~Content.WIDTH_MASK;
251 content |= width << Content.WIDTH_SHIFT;
252 }
253 this._data[index * CELL_SIZE + Cell.CONTENT] = content;
254 }
255
256 public insertCells(pos: number, n: number, fillCellData: ICellData): void {
257 pos %= this.length;

Callers

nothing calls this directly

Calls 1

stringFromCodePointFunction · 0.90

Tested by

no test coverage detected