Since we don't have the original palette index in already rendered
cells, we compare the color *value*. If it matches, we assume this was
the color index used, and updates the cell's color.
Note that for performance reasons, we only update the current
grid. This is of course wrong, strictly speaking.
However, it is expected that _Set Color_ is used by full-screen
applications using the alternate grid.
OSC 7 updates the terminal's view of the current working
directory. The format is OSC 7;URI ST
We decode the URI and updates the term structs 'cwd' member.
This is then used when spawning a new terminal instance.
Having them as error messages was nice when we where still missing
lots of sequences.
Now we don't anymore, and these just spam stdout as well as syslog
when e.g. cat:ing binary data.
'p' means 'primary', while 's' means 'selection'. Thus, a client can
now request 'selection' clipboard data and will receive it from the
primary selection.
This callback is *always* called, including when there has been an
error.
This is in preparation for making text_from_{clipboard,primary}
asynchronous.
We do however need access to it, so provide a pointer. The difference
is that now we can have a *single* wayland instance, but multiple
terminal instances.
That is, remove the 'regular' and 'bright' color arrays. This is
possible since the 256-color array is defined such that the first 16
colors map to the regular and bright colors.
This implements OSC 4, 10, 11 - change <color>/foreground/background,
and their corresponding 'query' variant (which was already implemented
for OSC 10/11).
It also implements OSC 104, 110, 111 - reset
<color>/foreground/background.
Set corresponding terminfo entries to signal this support to clients.
When responding to a OSC 52 clipboard request, we need to base64
encode the clipboard data.
This is done in, potentially, several calls. Since we need at least 3
bytes to be able to produce any base64 output, we may have to buffer
up to 2 bytes between the callback calls with clipboard data.
This was being done incorrectly, where both bytes were written to
index 0 in the buffer.
Replace with generic error log messages that simply says the
ESC/CSI/OSC sequence is unhandled. This can mean either invalid or
unimplemented, depending on the context.