Track nil colors in term
Teach term the difference between an unset foreground or
background color and a color that happens to match an existing
color. This way, when we insert text after a color
reset:(e.g. from an SGR0), we insert it without :foreground or
:background (whichever we've reset) face properties, allowing
that inserted text to inherit the colors of the underlying face.
This way, if we change, e.g., the background color of a buffer,
the background color of already-inserted text from the term
child changes along with that of the buffer instead of being
"locked" to whatever the background color of the buffer was at
the time the text was inserted.
This change aligns term.el with other terminal emulators.
* lisp/term.el (term-ansi-current-color):
(term--color-as-hex): track nil fg, bg colors
(cherry picked from commit
3d609375f99cd0d4b7a441802d4616bad385e31d)