55 Commits

Author SHA1 Message Date
David Herrmann
a2e1ea7388 vte: support designating charsets
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>
2012-05-29 13:52:23 +02:00
David Herrmann
239e7697bb vte: collect csi flags +, ( and )
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>
2012-05-29 13:31:33 +02:00
David Herrmann
2ac1aad8c9 vte: support temporary charsets and g0-g3
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>
2012-05-29 13:23:22 +02:00
David Herrmann
52f55d50c8 vte: always perform soft reset on DECSCL
All DECSCL modes automatically perform a soft reset.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 13:18:14 +02:00
David Herrmann
d702a5ca5d vte: add support for GL/GR mappings
This allows mapping different charsets into GL/GR.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 13:09:38 +02:00
David Herrmann
2ad76e2fa7 vte: perform soft reset on initialization
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>
2012-05-29 13:06:56 +02:00
David Herrmann
536c6da6d1 vte: handle XK_Find and XK_Select
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>
2012-05-29 12:46:09 +02:00
David Herrmann
30c1c20876 vte: move long csi-handlers into separate function
Avoid making do_csi() too big. So put long csi-handlers into separate
functions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 12:43:58 +02:00
David Herrmann
2ad5600d60 vte: implement DECSTR / soft-reset
On soft-reset, all internal state is reset but the screen data is kept
alive.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 12:40:01 +02:00
David Herrmann
4587f1b803 vte: corectly implement DECSCL
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>
2012-05-29 12:37:18 +02:00
David Herrmann
4b6a7b593d vte: select CSI flags
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>
2012-05-29 12:30:17 +02:00
David Herrmann
5c67c969bf vte: add kmscon_vte_reset()
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>
2012-05-29 12:16:18 +02:00
David Herrmann
64e235bc22 vte: support 7bit and 8bit modes
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>
2012-05-29 12:01:23 +02:00
David Herrmann
6b5fb5613d vte: implement DECSCL 'p' CSI
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>
2012-05-28 18:10:59 +02:00
David Herrmann
4b656aaa11 vte: implement NEL
NEL is a shortcut for newline independent of the line-feed/new-line mode.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 17:58:46 +02:00
David Herrmann
1d6eb0dd72 vte: implement IND and RI
IND and RI both either move one row up or down and perform scroll up/down
if required.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 17:56:44 +02:00
David Herrmann
2e6bac3e67 vte: explicitely ignore DEL
Add dummy to do_execute() which explicitely ignores the DEL input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 17:51:51 +02:00
David Herrmann
b1e5d75220 vte: show reversed question mark on SUB
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>
2012-05-28 17:47:51 +02:00
David Herrmann
6b4fc364df vte: remove kmscon_console_backspace()
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>
2012-05-28 16:49:56 +02:00
David Herrmann
cd553c54ad vte: answer with ACK to an ENQ enquiry
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>
2012-05-28 16:48:08 +02:00
David Herrmann
9aa76272e9 vte: use callback for outgoing messages
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>
2012-05-28 16:38:56 +02:00
David Herrmann
c2515b2ae7 vte: add ctrl+0-9 shortcuts
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>
2012-05-28 15:39:25 +02:00
David Herrmann
1647c5fc32 vte: handle F1-F20 correctly
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>
2012-05-28 15:30:17 +02:00
David Herrmann
d6c50d9b8f vte: handle KeyPad/NumPad keys
This adds handlers for all the special keys on numpads/keypads.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 15:18:45 +02:00
David Herrmann
0986989ce7 vte: add line-feed/new-line mode
In line-feed/new-line mode the NL/.. codes generate a CR *and* a NL.
Otherwise, they only generate CRs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 15:12:10 +02:00
David Herrmann
a3d5eef70e vte: implement cursor keys
In cursor-key-mode reset we send the normal CSI sequences, again encoded
with C0 codes as C1 codes are nonsense in UTF8. In cursor-key-mode set we
use the SS3 codes instead.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 14:12:30 +02:00
David Herrmann
8157556602 vte: implement editing keys
Implement the basic editing keys that are used by several applications. We
use the 7bit CSI sequence to avoid UTF8 issues. Otherwise, we would have
to encode the C1 CSI 0x9b as UTF8 character which is also a 2 byte
sequence.

Besides INSERT, DELETE, PAGEUP and PAGEDOWN an VT220 also had SELECT and
FIND keys which we do not implement as they are not present on modern
keyboards.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 14:01:22 +02:00
David Herrmann
2396423d03 vte/font/console: support basic character attributes
This adds support for colored and bold characters. This also adds the
infrastrucure for background colors and underlined characters, however,
these are not properly implemented, yet.

The color codes are similar to xterm and optimized on black backgrounds.
So they are not too bright or shiny.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-28 12:37:12 +02:00
David Herrmann
47d7cf085c vte: send correct escape characters on ctrl+KEY input
This adds support for the ctrl+KEY inputs to send escape sequences to the
child process.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 16:45:27 +02:00
David Herrmann
ff7c065692 vte: print debug message on unknown CSI parameters
Print a debug message if the CSI-K/J parameters are unknown.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 15:21:32 +02:00
David Herrmann
2c5712685b vte: remove kmscon_vte_bind()
Bind the console at vte creation instead of dynamically during runtime.
There is no need to rebind a console so remove this complexity.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-27 14:47:11 +02:00
David Herrmann
199f4cbfa8 Replace old input subsystem with new uterm input
Use the new subsystem now throughout the whole code.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-26 14:57:08 +02:00
David Herrmann
8baea629f9 vte: fix log messages
Use LOG_SUBSYSTEM and remove trailing newlines.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-30 15:51:33 +02:00
David Herrmann
c9ea08d9b5 unicode: use static global symbol table
A symbol table should never be created twice therefore we can make it
static and global. We add locks so it is totally thread-safe, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-29 16:17:55 +02:00
David Herrmann
4b9bc46226 Fix some signed/unsigned warnings
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 17:04:42 +01:00
Ran Benita
7b7e8c950d vte: constify global tables
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 19:01:04 +01:00
David Herrmann
32cb165e40 vte: improve docs
Add parser-links to the docs and add summary comment to the vte.c source file.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 18:56:32 +01:00
David Herrmann
c343e6cef2 vte: add 8bit C1 7bit equivalents (dummy)
Many 8bit C1 codes have 7bit escape sequences as equivalents. This adds handlers
for all of them with comments what they are supposed to do. They are dummies for
now but they will be implemented later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-29 17:21:53 +01:00
David Herrmann
ea81381be5 vte: add 8-bit C1 code handlers (dummy)
Add handlers for C1 codes with a description what they are supposed to do. They
are not yet implemented and are no-ops.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-29 17:11:25 +01:00
David Herrmann
44fdd29e6c vte: new state machine implementation
This is now a fully vt500-series compliant state machine that parses escape
sequences. See vt100.net/emu for information on this state-machine. This is
written from scratch, though.

It now handles all kind of escape sequences that we every want to support. It
correctly ignores all unsupported ones right now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-29 15:25:53 +01:00
David Herrmann
06286da4ef vte: extend CSI debug message
Print the CSI command in debug messages so we can better understand what
escape commands were sent.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 16:03:13 +01:00
David Herrmann
cdb3d112a6 vte: implement backspace control
Add new helper to console subsystem which performs a backspace
operation. We must take care of auto-wrap mode so we cannot simply use
the *_move_left() function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 16:02:21 +01:00
David Herrmann
5f0d151bb7 vte: implement basic cursor movement CSI
The A, B, C and D CSIs are used to move the cursor in the scroll-region
without scrolling the buffer when reaching the margins.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 16:01:12 +01:00
David Herrmann
dcfbbc3e1d vte: implement CSI-J
The J CSI is used to erase parts of the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:56:34 +01:00
David Herrmann
a5a357e012 vte: implement CSI-K
The K CSI is used to erase parts of the current line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:52:34 +01:00
David Herrmann
9b058b1f90 vte: implement basic cursor-movement controls
This adds support for line-feed and carriage-return controls. The two
special line-feed controls which are not \n do not take care NL-mode so
they must be handled separately.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-05 15:51:10 +01:00
David Herrmann
8fa3336a6b vte: add stub CSI parser
The new parser reads CSI parameters correctly and saves them in an array
for later evaluation. We currently do not handle the CSI commands. This
needs to be added now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-01 19:33:38 +01:00
David Herrmann
0e31653eb1 vte: parse basic control codes
This adds a parser for basic control codes but does not implement their
functionality, yet. Only the newline handler is kept.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-01 17:13:22 +01:00
David Herrmann
c4683b34ef vte: first check for special keys then for ucs4 char
We should first check whether we recognize the XK_* identifier before we
rely on the converted UCS4 character.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-01 16:03:54 +01:00
David Herrmann
23b7270790 vte: implement basic key mappings
The system keys are mapped to their ASCII equivalents. We do not support
CR/NL mode nor scroll-lock yet (is this supported by any term?).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-02-01 15:59:53 +01:00