writeChar method
Writes a single character to the _terminal. Special chatacters are not interpreted and directly added to the buffer.
See also: Terminal.writeChar
Implementation
void writeChar(int codePoint) {
codePoint = charset.translate(codePoint);
final cellWidth = unicodeV11.wcwidth(codePoint);
if (_cursorX >= _terminal.viewWidth) {
newLine();
setCursorX(0);
if (_terminal.autoWrapMode) {
currentLine.isWrapped = true;
}
}
final line = currentLine;
line.ensure(_cursorX + 1);
line.cellInitialize(
_cursorX,
content: codePoint,
width: cellWidth,
cursor: _terminal.cursor,
);
if (_cursorX < _terminal.viewWidth) {
_cursorX++;
}
if (cellWidth == 2) {
writeChar(0);
}
}