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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>