Skip to content
  • Luis Javier Merino's avatar
    Do not count trailing empty cells on selections · e8f77101
    Luis Javier Merino authored and Kurt Hindenburg's avatar Kurt Hindenburg committed
    When selecting, the last line gets an added newline if the characters
    returned from copyLineToStream() are less than the cells selected on that
    last line.
    
    A weird behaviour was that after running:
    
    printf '                   v\n'
    printf '\e[KSELECT ME\n'
    printf '\e[31m\e[Kselect me\n'
    printf '\e[0m                   ^\n'
    
    selecting "SELECT ME          " would add a newline, while
    selecting "select me          " would not add a newline.
    
    This is a side-effect of clearImage() resizing lines which end with
    spaces with the default rendition, so selecting the "SELECT ME" line
    would get a count of 9 characters, which would make selecting more than
    the initial 9 characters add a newline, while the "select me" line would
    have additional spaces with isRealCharacter == false and a non-default
    rendition.
    
    Solve it but making copyLineToStream() not count and not pass to
    PlainTextDecoder trailing characters where isRealCharacter == false.
    e8f77101