When an application sends a character to the terminal that is not part of a control sequence and is a non control character the terminal adds this character to the cell array.
TODO: zero width composing characters
If the pending-wrap state is set:
If wraparound mode is set:
If wraparound mode is not set:
If insert mode is active the current content of the cell pointed to by the cursor is moved right as if by invoking insert blanks with the width of the printed character.
If the current SGR state includes invisible the character is replaced by the same number of spaces as its original width.
Then the character is placed into the cell the cursor points to. If the width of the character is greater than 1 the cell and cells to the right are used. Then the cursor is moved right by the amount of cells corresponding to the width. If the cursor would cross the right margin in this mode the cursor is placed at the right margin and the pending wrap state is set.
If the update splits a multi cell character that character is erased by replacing it with spaces without changing its attributes.
The cells filled with the character are colored and styled according to the current SGR state.