We didn't reset the console flags on soft reset, however, this is required
to correctly synchronize the flags between vte and console.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Reset font color to white for new cells. This allows us to draw reversed
cells that are not occupied by any value. Otherwise, these cells would be
still black if reversed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The pango backend now correctly draws colored or uncolored backgrounds.
This is needed to support drawing cursors.
We currently do not optimize this for performance. In fact, this reduces
performance a lot and we could avoid drawing backgrounds if we cleared the
background to the same color before. However, this also means we currently
could move drawing the background into the console backend again. The
transparency feature is awful, anyway and I don't see any reason
supporting it.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
In inverse screen mode we switch background and foreground colors. As our
console layer supports transparent backgrounds, we have to do this in the
terminal layer.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds a new function that allows external subsystems to retrieve the
current flags of the console.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of writing a function for each mode we now accept flags for the
console object. For now the flags are unused but other flags will be
added.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If SEND_RECEIVE_MODE is not set, we have to echo all data we send out.
That is, all escape sequences and all characters are directly interpreted
by us. To avoid recursion, we use a simply protection. However, some
escape sequences don't make sense in echo mode but we don't care here, as
this is a problem of the application/client, not us.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When reading Setmode/Resetmode parameters, we should ignore all unset
parameters instead of printing a warning.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
VT510 manual says auto-wrap is disabled by default but most applications
(including bash) expect it to be on, therefore we enable it by default.
The console layer already supported it but the vte layer wasn't hooked up.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When INSERT mode is enabled, we move all following characters to the right
and drop all characters that are moved beyond the margin.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of clearing all flags we set the default flags now. They are
defined by the VT220 to be set this way on soft-reset.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This adds dummy modes for all available DEC/ANSI modes. This does not
actually implement them but adds support for SM/RM CSI sequences.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
SM/RM - SetMode/ResetMode are used to explicitely set terminal modes. DEC
private modes and ANSI modes are separated as defined by VT220.
We currently only parse modes that we actually support. Further modes may
follow.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Both escape sequences are used to change the C1 escape character mode from
using 8bit or 7bit escape codes/sequences.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We currently do not support sending C1 controls as 8bit characters because
this doesn't make any sense with UTF-8. However, in 7bit/8bit
compatibility mode the client can request this. As nearly all clients are
backwards compatible to VT100 they also support C1 controls as 7bit
sequences, though, so there is really no time pressure to implement
FLAG_USE_C1.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This allows changing GL and GR to the values set in G0-G3. GL can also be
set temporarily, GR currently does not have such a mode.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
With ESC {int} {final} you can designate G0-G3. If no {int} is given, we
fall back to the default escape sequences that replace the C1 set.
However, the user might designate other sets manually so we ignore all
escape sequences that have intermediates set.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
All three flags are most often used with basic escape sequences and not
with CSI sequences, however, we treat them generic here to avoid more
complexity.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Temporary charsets are only used for the next graphics character that is
displayed. After that, the VTE returns to the previous charset. On
soft-reset we also reset these temporary slots.
This also adds the g0-g3 backend slots that can be set by the client and
allow mapping of arbitrary other charsets into gl/gr/glr/grt.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Instead of copying all that initialization stuff around, we simply perform
a soft reset on initialization.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Even though modern keyboard often do not include such keys, we should
handle them correctly, anyway. For the sake of backwards-compatibility.
This also comes in handy if you define these keys separately. The
functions that are implemented by many applications with these keys are
handy, indeed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We now select the 8bit/7bit modes if the client sends an DECSCL requesting
a conformance level.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Correctly select CSI flags like ?, !, > or $ and more. We actually don't
care about the position of these flags as other CSI parameters are just
digits.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This performs a soft reset of the VTE state machine. It does not affect
the console that is bound to the VTE, though.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
In 7bit and 8bit modes we treat incoming characters as single-byte
characters and map them directly to the corresponding value instead of
using the UTF8 state-machine.
This allows using old non-utf8 applications with this VT. However, default
value is still UTF8-mode and you must explicitely request a conformance
level to change that. If you selected such a mode once, you can only
return to UTF8-mode by performing a soft/hard-reset.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This dummy is supposed to hard-reset the console. As the console is far
from finished, we keep it as dummy and implement this later.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Sometimes we need to reset the UTF8 state-machine, for instance when
resetting the VTE. This function simply resets the internal state to
KMSCON_UTF8_START so we start all over on the next input character.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
We build several internal libraries and to keep the namespaces apart we
also need different debug constants. Therefore, introduce the new
KMSCON_ENABLE_DEBUG constant which is for every debug object in base
kmscon code.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Since vt100 (and extended with vt220) you can load different character
sets into GL and GR. As we use UTF-8 as base encoding, we actually do not
need them but have to support it for backwards compatibility. For further
information, see the comments in vte_charsets.c.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
DECSCL is used to select compatibility modes. We do not support the VT100
compatibility mode explicitely or the VT220 mode, however, we always send
7-bit control characters and support escape sequences from both series so
we can safely ignore DECSCL.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
When receiving SUB we now correctly write a reversed question mark into
the buffer. We still cancel the ongoing escape sequence, this worked even
without this patch.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This function is not needed at all. Instead, we should simply move one
character to the left on incoming backspace. There is no need to handle
auto-wrap on backspace.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Other emulators might ignore this. However, the easiest way to answer to
an enquiry is probably ACK.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
VTE now requires a new callback that is called when we want to send
messages to the pty etc. This is needed if we want to send messages as
responses to incoming data. Otherwise, we would have way too much overhead
assembling composed messages.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
The VT220 defines some additional shortcuts to send escape codes with
ctrl+<num>. Implement these as aliases to the same well-defined shortcuts.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
F1-F4 are mapped to the keypad keys as these keys were not available on
VT220. F5 is special mapped and F6-F20 correspond to the same keys on the
keyboards for VT220.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>