Commit graph

93 commits

Author SHA1 Message Date
Daniel Eklöf
9f1525aef7
Rename: vt_to_slave() -> term_to_slave() 2019-11-03 00:52:24 +01:00
Daniel Eklöf
780a346071
vt: don't log ignored execute commands
cat:ing a binary file would otherwise result in us spamming syslog.
2019-09-28 13:59:11 +02:00
Daniel Eklöf
2707cf0fc4
vt: implement 'insert mode' 2019-08-30 22:08:37 +02:00
Daniel Eklöf
2e9349c4c4
vt: remove unneeded include 2019-08-30 21:43:50 +02:00
Daniel Eklöf
382bea8309
vt: tidy lazy initialization of escape parameters 2019-08-27 15:24:49 +02:00
Daniel Eklöf
936526ed5b
vt: no need to reset OSC string in CLEAR action
... as this is done when a new OSC string is started
2019-08-27 15:24:19 +02:00
Daniel Eklöf
8d65f45bf5
vt: store alt charset characters as wchars 2019-08-27 15:23:50 +02:00
Daniel Eklöf
0c5a19f950
vt: bug: fix lazy initialization of sub parameter value (off-by-one) 2019-08-24 11:39:28 +02:00
Daniel Eklöf
9b74cedb20
vt: clear CSI parameters lazily
The CLEAR action is so common, that explicitly clearing the entire
params array, which is kind of big, is too slow.

Clear it lazily instead. Meaning, we only set 'idx' (count) to 0 in
CLEAR. Then whenever we parse a parameter, clear the value and sub
parameters.
2019-08-24 11:33:13 +02:00
Daniel Eklöf
ece09cc76f
vt: remove support for urxvt 'extended' line drawing character set 2019-08-16 18:04:03 +02:00
Daniel Eklöf
8586c9cb91
vt: there is no default charset for \e0 and \eB 2019-08-16 18:01:24 +02:00
Daniel Eklöf
4d7993b36f
cell: pack more efficiently and store glyph as a wchar
The 'attributes' struct is now 8 bytes and naturally packed (used to
be 9 bytes, artificially packed).

'cell' struct is now 12 bytes, naturally packed (used to be 13 bytes,
artificially packed).

Furthermore, the glyph is stored as a wchar instead of a char*. This
makes it easier (faster) to do glyph lookup when rendering.
2019-08-02 18:19:07 +02:00
Daniel Eklöf
ab92abbd21
term: implement reset 2019-08-01 20:51:11 +02:00
Daniel Eklöf
858a0d9906
font: initial support for double-width *and* color emoji glyphs
Fonts are now loaded with FT_LOAD_COLOR and we recognize and support
the FT_PIXEL_MODE_BGRA pixel mode.

This is mapped to a CAIRO_FORMAT_ARGB32 surface, that is blitted
as-is (instead of used as a mask like we do for gray and mono glyphs).

Furthermore, since many emojis are double-width, we add initial
support for double-width glyphs.

These are assumed to always be utf8. When PRINT:ing an utf8 character,
we check its width, and add empty "spacer" cells after the cell with
the multi-column glyph.

When rendering, we render the columns in each row backwards. This
ensures the spacer cells get cleared *before* we render the glyph (so
that we don't end up erasing part of the glyph).

Finally, emoji fonts are usually bitmap fonts with *large*
glyphs. These aren't automatically scaled down. I.e. even if we
request a glyph of 13 pixels, we might end up getting a 100px glyph.

To handle this, fontconfig must be configured to scale bitmap
fonts. When it is, we can look at the 'scalable' and 'pixelsizefixup'
properties, and use these to scale the rendered glyph.
2019-07-31 18:03:35 +02:00
Daniel Eklöf
748a1f229c
vt: disable flash on bell, it's too annoying in e.g. zsh 2019-07-30 22:11:32 +02:00
Daniel Eklöf
e1f7fc459b
vt: BELL is now logged at info level, and flashes the screen 2019-07-30 22:09:07 +02:00
Daniel Eklöf
8acc3b891d
vt: remove almost all abort() calls
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.
2019-07-30 21:42:46 +02:00
Daniel Eklöf
51c1fc344a
vt: remove duplicate initialization warnings (clang) 2019-07-30 20:30:05 +02:00
Daniel Eklöf
85ef9df586
render: add a 'clean' bit to each cell; only render cells that aren't clean
This patch takes a bit from the foreground color value in a
cell (todo: split up foreground/background into bitfields with a
separate field for 'foreground/background' has been set), and only
re-renders cells that aren't marked as clean.

Note: we use a 'clean' bit rather than a 'dirty' bit to make it easy
to erase cells - we can (keep doing) do that by simply memsetting a
cell range to 0.
2019-07-30 18:03:03 +02:00
Daniel Eklöf
f5a6304850
term: make sure to update 'current row' when restoring saved cursor 2019-07-23 17:57:07 +02:00
Daniel Eklöf
2096753b52
dcs: we have no parent terminal to pass through to 2019-07-21 18:22:26 +02:00
Daniel Eklöf
1f263256a3
vt: define state_names[] table when debug logging has been enabled 2019-07-19 09:57:14 +02:00
Daniel Eklöf
24e9477174
vt: handle up to two private characters 2019-07-19 09:56:59 +02:00
Daniel Eklöf
b953326768
dcs: sort of implement DCS passthrough
We now store the passthrough characters in a buffer, and call
dcs_passthrough() on unhook.

However, dcs_passthrough() doesn't do anything.
2019-07-19 09:55:07 +02:00
Daniel Eklöf
153628a217
osc: allocate data buffer dynamically 2019-07-19 08:59:35 +02:00
Daniel Eklöf
9dafab981c
vt: implement SS2/SS3 and ST 2019-07-18 19:25:53 +02:00
Daniel Eklöf
095684a705
vt: execute: ignore unrecognized C0 commands 2019-07-18 14:54:22 +02:00
Daniel Eklöf
332f1c6a21
vt: execute: handle \0 (NUL), by ignoring it 2019-07-18 12:19:54 +02:00
Daniel Eklöf
28eef93742
vt/csi: recognize the reset sequence sent by 'reset'
However, we don't (yet) actually reset the terminal
2019-07-17 10:39:38 +02:00
Daniel Eklöf
2f6b8d232f
vt: add vt_to_slave() 2019-07-15 15:42:00 +02:00
Daniel Eklöf
470489c3a3
vt: there are NULL entries in the alternate charset 2019-07-15 13:39:53 +02:00
Daniel Eklöf
6bf75d199b
vt: \EB and \E0 have an optional "private", not param (which are CSI only) 2019-07-15 13:39:19 +02:00
Daniel Eklöf
6550285cf6
vt: handle ':'-separated sub parameters correctly 2019-07-15 12:34:51 +02:00
Daniel Eklöf
6ac115bffd
vt: implement SI/SO (shift in, shift out)
This enables switching between the G0 and G1 charsets.
2019-07-15 12:04:40 +02:00
Daniel Eklöf
b1f8dd75d6
cell: we only need 4 bytes for the longest utf8 sequence
We don't *have* to NULL-terminate the utf8 string. So don't. This
makes the cell glyph 4 bytes exactly, which is better for alignment
and cache usage.
2019-07-10 18:47:32 +02:00
Daniel Eklöf
ea1b618b6d
vt: implement \ED and \EE
'\ED' is just like '\n'; move the cursor down to the next row, or if
it's at the bottom, scroll up one row.

'\EE' is just like '\n\r'
2019-07-10 16:05:19 +02:00
Daniel Eklöf
885089d146
vt: \EM now calls term_reverse_index() instead of always scrolling one line 2019-07-10 16:05:01 +02:00
Daniel Eklöf
3bb726eb78
vt: '\n' now calls term_linefeed() 2019-07-10 16:04:46 +02:00
Daniel Eklöf
48efc50c23
vt: escape '\E' properly when logging an ESC sequence 2019-07-10 16:04:25 +02:00
Daniel Eklöf
454133033c
vt/csi: use vt_param_get() 2019-07-10 16:04:16 +02:00
Daniel Eklöf
96bd55f7c4
terminal: only support a single intermediate/private character 2019-07-10 15:03:16 +02:00
Daniel Eklöf
3dbef02dac
input: implement keypad application mode
This commit also replaces the previous (temporary) key map with a much
more complete one.
2019-07-09 14:27:26 +02:00
Daniel Eklöf
d90ea88aa2
vt: handle ESC correctly in OSC string state 2019-07-09 11:06:20 +02:00
Daniel Eklöf
fd6a99d738
vt: handle UTF-8 sequences in OSC PUT
This is strictly speaking not correct, since we're not treating a lot
of characters that should switch state as part of the OSC string.

The correct way would be to have a specific OSC UTF8 state that parses
UTF8 strings.
2019-07-09 09:59:32 +02:00
Daniel Eklöf
4e25019ba6
wip: grid is now represented as a grid, not a linear array
The grid is now represented with an array of row *pointers*. Each row
contains an array of cells (the row's columns).

The main point of having row pointers is we can now move rows around
almost for free.

This is useful when scrolling with scroll margins for example, where
we previously had to copy the lines in the margins. Now it's just a
matter of swapping two pointers.
2019-07-08 13:57:31 +02:00
Daniel Eklöf
d63629b370
performance improvements
* action() returns void - this gets rid of checks in vt_from_slave()
* split up ACTION_PRINT into ACTION_PRINT (ASCII) and ACTION_UTF8_PRINT
  ACTION_PRINT is on the hot path, and we want it streamlined.
* Remove run-time checkout for unimplemented state transitions, as we
  shouldn't have any of those left.
* Don't re-load current VT state on each iteration in vt_from_slave()
2019-07-07 16:32:18 +02:00
Daniel Eklöf
00c5b27bfa
vt: add branch hinting to PRINT action 2019-07-06 13:25:36 +02:00
Daniel Eklöf
3ba1721c0f
osc: implement change window title and icon 2019-07-05 09:50:35 +02:00
Daniel Eklöf
befb437411
vt: improve logging of invalid and unimplemented sequences 2019-07-04 19:35:01 +02:00
Daniel Eklöf
cb10d10fd8
vt: implement save/restore cursor+attributes 2019-07-04 19:23:25 +02:00