128 Commits

Author SHA1 Message Date
David Herrmann
613e7e7000 tsm: screen: move filenames to tsm_screen.[ch]
All TSM files use the "tsm_*" prefix and the object is now named "screen"
so rename the files to resemble this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 14:53:46 +02:00
David Herrmann
efb210469d console: rename prefix to tsm_screen_*
This is part of the TSM library creation. We also rename "console" to
"screen" as this layer actually manages the screen.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 14:49:20 +02:00
David Herrmann
32fec77420 tsm: unicode: remove tsm_symbol_get_u8()
This is no longer used. You should first retrieve the UCS4 string and then
use the UCS4 to U8 conversion helpers instead.

All users have already been converted so we can remove this helper safely.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 14:12:28 +02:00
David Herrmann
69259c8d64 build: make xkbcommon built-time dependency
We really need xkbcommon-keysyms.h for building kmscon/uterm/TSM/etc.
However, the recent fix was ugly and didn't really help. Instead we copy
the keysyms file into external/xkbcommon/ so we can just include the real
xkbcommon files from any source but have a fallback in external/.

Hence, you can still build kmscon without xkbcommon with this fallback,
but this will be removed the first day when xkbcommon sees a public
release.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 12:29:06 +02:00
David Herrmann
d5a0c9644c tsm: unicode: add symbol-table contexts
We should avoid any global state in shared libraries. As the TSM code is
becoming a shared library, we definitely need contexts for symbol tables.
However, we don't want to fix up all code now so we use a default table
NULL instead.

This can be fixed later but is ok for now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 11:30:38 +02:00
David Herrmann
cca90781c0 tsm: move unicode.[ch] to tsm_unicode.[ch]
All TSM related files will get the tsm_* prefix so move unicode headers
and sources.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 10:54:06 +02:00
David Herrmann
3602b736ff vte: implement Shift+F4-F20
If Shift is hold while F4 to F20 is pressed, a second parameter is added
to the sent CSI sequence. Implement this according to all other major
terminal emulators. This is no official DEC feature, though.

Thanks to "Etam" for reporting this!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 09:44:27 +02:00
David Herrmann
92a14e0964 vte: fix OSC parser to stop on BEL characters
No DEC-VT-manual seems to describe this feature, however, nearly all
terminal emulators stop parsing OSC strings when receiving a BEL
character. So add this to the normal ST character to terminate OSC
strings.

Many thanks to Ran Benita for reporting and investigating into this.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 09:20:31 +02:00
David Herrmann
8deb82f653 vte: send escape sequence when ALT key is held
XTerm's altSendsEscape resource controls whether an escape character is
prepended to any output that is generated by keyboard input. We enable it
by default now.

Keyboard handling becomes kind of ugly now in the VTE layer. We should
definitely change this into some kind of lookup table or a more
sophisticated switch() handler in vte_input.c or similar.

Thanks to Tobias Wolf, "Etam" and Ran Benita for reporting this to the
bug-tracker and figuring out how this is correctly handled.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-16 17:32:07 +02:00
David Herrmann
61e0d9d098 unicode: move kmscon_symbol* to tsm_symbol*
All the unicode helpers are move to TSM so move the symbols, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:26:43 +02:00
David Herrmann
c1075fba18 unicode: rename kmscon_utf8_* to tsm_utf8_*
All terminal-emulation code is moved into a new library called "TSM -
Terminal State Machine". So we rename everything to have a separate
namespace.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 17:18:51 +02:00
David Herrmann
55e37dde77 uterm: add uterm_keysyms.h
We need a copy of xkbcommon-keysyms.h as long as xkbcommon is not included
in all major distributions. We _need_ this build-time dependency,
otherwise, we cannot build the other keyboard backends.

However, requiring xkbcommon as build-time dependency is not a solution as
no major distribution includes it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-11 19:30:26 +02:00
David Herrmann
c3528f1a42 vte: separate color-codes from RGB values
We need to know whether a current attribute was created with a specific
RGB value or whether a vt-color-code was used. This is, because several
affects have to be applied when color-codes are used. For instance, bold
colors are always brightened to simulate "bold".

Therefore, two new fields are added which contain the color-code or -1 if
an RGB value is used. All of this is always applied internally of the VTE
layer so other layers (like the console layer) can be sure, that the RGB
value is always correct and use it.
But the VTE layer needs to keep track of the color-codes so we put them
into the attribute structure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-08 14:48:21 +02:00
David Herrmann
71b8cfe93c vte: make independent of uterm
Remove the last reference to uterm structures so we can put the vte layer
into a separate library without any dependency to rendering
infrastructure.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-08 14:20:53 +02:00
David Herrmann
4250cffd6c console: rename font_char_attr to kmscon_console_attr
This removes this legacy name and also moves the attribute structure into
the console subsystem where it belongs. This currently creates circular
dependencies between text and console layers but we can ignore that for
now and fix it later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-08 13:37:02 +02:00
David Herrmann
52c57a51b6 vte: implement bce-mode (background color erase mode)
BCE is implemented by all major terminal emulators and activated by
default. If used, then every erase/insert/scroll/delete operation will
redraw the background of the erased/new characters with the current
background color instead of the default background color.

There is currently no way to control this behavior from an application so
you cannot turn it off. However, every terminfo based application can read
whether it is activated from the terminfo database.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-08 12:56:37 +02:00
David Herrmann
681c9acb4c vte: return status in kmscon_vte_handle_keyboard()
We now return whether the key had any effect. This can be used by the
terminal handler to perform various actions on user-input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 17:01:55 +02:00
David Herrmann
227ada42a2 vte: add --palette=XY to choose color palette
This adds two more color-palettes and a mode to choose the used palette.
The "solarized" palettes are from an online project that tries to optimize
color palettes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 16:08:30 +02:00
David Herrmann
feb29d857c vte: add COLOR_FOREGROUND/BACKGROUND to palette
Instead of hard-coding these values we simply put them into the palette.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 15:52:26 +02:00
David Herrmann
d74c94360b vte: make color-palette configurable
This adds a color-palette-pointer to VTE objects so each VTE object can
have a different palette. This allows runtime configuration of terminal
colors.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-14 15:47:13 +02:00
David Herrmann
002e8fb65e text: move font_char_attr to text.h
This way we can now remove all font.h includes. We can rename the
structure later.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-08-08 11:27:19 +02:00
David Herrmann
65424fa304 vte: add CHA CSI
The CHA CSI is used to move the cursor horizontally but keep the vertical
position.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:57:47 +02:00
David Herrmann
2898851269 vte: add VPA/VPR CSIs
VPA and VPR are used to change the current line but keep the column. One
does an absolute positioning and one a relative positioning.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:57:04 +02:00
David Herrmann
1a84c938da vte: add SU/SD CSIs
SU and SD are used to scroll-up and scroll-down the visible buffer.
Margins are kept and the cursor position does not change. This is a valid
vt510 CSI.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-31 14:56:11 +02:00
David Herrmann
a6bca387da vte: fix reset_state() resetting only saved-states
reset_state() is used to reset the saved state and not to reset the actual
state. We currently get invalid character-maps as we never initialize them
correctly. This fixes all these vte_map() related bugs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 12:54:19 +02:00
David Herrmann
2551efdbac vte: implement RIS hard reset
RIS is used to "hard"-reset the terminal. We simply clear every state
known and reset to initial state.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 12:06:57 +02:00
David Herrmann
2222e316cb vte: send primary-DA on 7bit DECID
Also send the primary-DA when receiving 7bit variant of DECID.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 12:02:18 +02:00
David Herrmann
9cd05223a5 vte: send primary DA on DECID
The DECID escape should be followed by a primary-DA answer. To avoid
copying the same primary-DA sources, we put the primary-DA into a static
helper function.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 11:59:21 +02:00
David Herrmann
aa31b1297e vte: implement device status reports (DSR)
DSRs are used to query the terminal for data. This includes general status
reports but also cursor positions. We currently only implement VT220
features. DEC later introduced further modes to query more advanced
interfaces.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 11:55:51 +02:00
David Herrmann
10d72851bb vte: stop advertising UDK support
We do not support user-defined-keys (UDK) so do not advertise it in
primary-DA lines.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 11:36:35 +02:00
David Herrmann
1641241e5d vte: implement CHT, CBT and tabulators
CHT and CBT are used to move multiple tab-stops with a single call. The \t
char moves only one tab-stop forward. All are conformant to the vt510
specs.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 11:30:51 +02:00
David Herrmann
785137264b vte/console: implement protected erase
Protected erase means erasing parts of the screen but preventing protected
characters from being erase. Protecting a character is done by setting
character attributes similarly to colors and backgrounds. Both are reset
on hard erase, soft-reset or screen clearance.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 23:51:56 +02:00
David Herrmann
01527f9f55 vte: support ECH CSI
The ECH CSI is used to erase partial lines.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 20:24:10 +02:00
David Herrmann
60527b2d64 vte: extend SGR/color handling
This adds full xterm 256color support and improves SGR handling in
general.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 19:49:55 +02:00
David Herrmann
ba59f62a26 vte: fix application cursor keys
This is probably a copy/paste bug but we sent the wrong application cursor
key sequences. This is only visible in xterm-mode so nobody noticed until
now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 19:34:04 +02:00
David Herrmann
7fb5c5c454 vte: tune SGR handling
We definitely do not need to check the unset parameters so shorten the
loop so unparsed parameters are not checked.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 17:38:32 +02:00
David Herrmann
492ac8f72c console/vte: implement ICH DCH
ICH is used to insert characters into the current line. DCH is used to
delete characters from the current line. They act as described in vt220
manual.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 17:33:28 +02:00
David Herrmann
60b180a369 console: support "protect" character attribute
VT220 allows protecting attributes. That is, they are not erased by
special new erase-commands. The normal erase-commands still erase all
characters.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 16:49:35 +02:00
David Herrmann
8c42b38cd3 vte: implement TBC
Implement TBC CSI which clears the current or all tab-stops. This is
according to VT220 rules.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 16:24:08 +02:00
David Herrmann
6177d4fa69 vte: allow setting tab-stops
Allow applications to set new tab-stops according to vt220 rules.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 16:18:42 +02:00
David Herrmann
10c90c6c5d console: implement console soft-reset
On soft-reset we reset the console to the initial state but keep current
line-state. That is, scrollback and cursor position are kept but the
non-visible state is reset.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 14:12:51 +02:00
David Herrmann
2543f13630 vte: reset margins on soft-reset
Instruct console code to reset the console margins to default values (that
is, destroy the margins) on console soft-reset.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 13:43:02 +02:00
David Herrmann
0c8cb12a91 vte: implement DECSC DECRC
DECSC is used to save the current console state. DECRC can restore the
console to a previously saved state.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-14 13:39:43 +02:00
David Herrmann
6356dae1da vte/console: implement CSI 'M' (DL: delete line)
The 'M' CSI mode is used to delete lines. This implements this mode
similar to the "INSERT LINES" CSI.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 15:35:28 +02:00
David Herrmann
ff91998ad8 vte/console: implement CSI mode L (insert line: IL)
The IL CSI ('L') is used to insert a given number of lines at the current
cursor position. All lines below are moved down.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 15:30:23 +02:00
David Herrmann
37ebf53cd5 vte: set AUTO_WRAP mode on reset for console object
We reset all modes but forget to set them on the console object, too. The
AUTO_WRAP mode is the only mode that matters here, so we can ignore the
other modes.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-06-24 12:20:18 +02:00
David Herrmann
b0c19c5c42 console: rewrite console layer
This is a rewrite of the whole console layer so we can remove the
kmscon_buffer object to speed up the console.

This removes the split between the scroll region and the two margins so we
can resize margins in O(1). This also correctly merges the remaining
console modes so vte does not have to track them.

Btw. vim runs smoothly on kmscon with this console layer now (finally!).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-06-17 15:53:33 +02:00
David Herrmann
cdc7834ba4 vte: allow setting margins
Support changing margin size of the terminal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 20:49:39 +02:00
David Herrmann
3e6d31e958 vte: fix HUP/HVP positioning bug
We mixed up X/Y coordinates. HUP and HVP send them reversed as often used
in terminals. Anyway, now it works correctly.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 20:48:22 +02:00
David Herrmann
469b5c6d7c vte: more verbose SM/RM debug messages
When we receive an unknown SM/RM message, be more verbose about what
exactly was received on the log output.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-30 20:47:40 +02:00