This is a function that's completely related to character
and has nothing to do with painting, so the correct place
for it is on the Character class.
This will make testing easier, too.
The recent change of blending the background/foreground colours for text
selection doesn't work everywhere, users with vision impairment or
colour-blindness would probably find it hard to distinguish text selection
colours; and the current code can't possibly cover all variations of colour
schemes out there. The same goes with certain displays and viewing angles,
some display types are notoriously awful when viewed at an angle.
BUG: 435309
FIXED-IN: 21.08
While DECHDL sequences should be used in pairs on adjacent lines, the
first line drawing the top half, and the second line drawing the bottom
half, apparently real VTxxx (or at least the VT220) terminals did draw
only the top or bottom of characters when confronted with an isolated
DECDHL line (https://retrocomputing.stackexchange.com/questions/18023/).
xterm has that same behavior. So behave likewise.
When there were several runs of double width/double height runs with
differing color/rendition/line draw/..., the second and subsequent runs
were positioned wrong. Fix the calculation of the starting x position to
account for double width, and fix a bug were the y position was
incremented for every run instead of for every line.
Can be tested with:
perl -E '$s="\e[0mTEST\e[32mTEST\e[0m"; say "\e#3$s\n\e#4$s"'
This code did a frequent amount of resizing on the `univec` vector, and
the usage of the `disstrU` variable was kind of obscure (and
unnecessary). I also removed an unused include.