Skip to content
  • Christian Persch's avatar
    lib: Use branchless, streaming UTF-8 converter · 7cd68196
    Christian Persch authored
    Previously vte used to convert the whole chunk of input from
    the PTY into UTF-32 in one go, and feed that to the parser.
    Replace this with a streaming converter, which consumes the
    bytes one-by-one and feeds the result to the parser whenever
    a unicode character falls out of it.
    
    Also simplify the chunk handling by using C++ standard classes
    to manage the queue (and stack of reserve chunks) instead
    of a hand-grown list handling code.
    
    As a result of the converter change, vte currently doesn't work
    with non-UTF-8 I/O encoding. This will either be reimplemented
    or non-UTF-8 support will be dropped completely (to be discussed
    in bugzilla).
    
    The change fixes a bug in parser-cat (and potentially also in vte
    itself, haven't been able to check) where occasionally a
    character at the end (or start?) of a chunk was discarded. That can
    be observed by comparing the output of 'parser-cat --charset "UTF-8"'
    (old converter) vs just parser-cat (new converter).
    7cd68196