Commit graph

262 commits

Author SHA1 Message Date
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
Daniel Eklöf
aad4db29c2
vt: handle graphical charset mode when printing a character 2019-07-04 19:17:42 +02:00
Daniel Eklöf
ea6e06d689
vt: track charsets G0-G3 and support either ASCII or graphical mode 2019-07-04 19:17:18 +02:00
Daniel Eklöf
a191d98d09
vt: bug fix: clear utf-8 state after printing a utf-8 character 2019-07-04 09:26:34 +02:00
Daniel Eklöf
3c67628c57
vt: implement (untested!) smam and rmam (auto margins)
Default is auto-margins enabled (scroll when cursor reaches right
margin).
2019-07-03 21:18:06 +02:00
Daniel Eklöf
90dadfcc22
vt: implement (untested!) insert mode
\E4l is not horizontal index, but disable INSERT mode
2019-07-03 21:16:41 +02:00
Daniel Eklöf
1373d18dbc
logging: disable debug logging by default 2019-07-03 20:21:03 +02:00
Daniel Eklöf
df5be1061d
vt: recognize ESC(0 - switch character set 2019-07-03 16:21:26 +02:00
Daniel Eklöf
bf78150157
vt: always log unimplemented as warnings, not errors 2019-07-03 16:21:09 +02:00
Daniel Eklöf
cfd39c0967
vt: fix logging of ESC intermediates and parameters 2019-07-03 16:20:28 +02:00
Daniel Eklöf
9682e15deb
term: "cache" pointer to current line
This adds a pointer to the first cell on the current line. This
pointer must be updated every time the row changes.

The advantage is mainly that PRINT doesn't have to call
grid_get_range(), which is fairly expensive.
2019-07-02 22:18:25 +02:00
Daniel Eklöf
ed68eafdf0
vt: simplify CLEAR action; don't memset() more than necessary 2019-07-02 21:44:58 +02:00
Daniel Eklöf
0954ffdf22
vt: no need to clear temporary utf8 buffer after printing it 2019-07-01 21:14:07 +02:00
Daniel Eklöf
d70956da08
wip: use a sliding window instead of memmove() to scroll
Instead of memmoving a large amount of data on every scroll, use a
sliding window. That is, each time we scroll, we offset origin.
2019-07-01 12:23:38 +02:00
Daniel Eklöf
9e3b8ab3ff
vt: only prep logging of CSI/ESC parameters when debug logging is enabled 2019-07-01 12:21:25 +02:00
Daniel Eklöf
0f48b4f8f7
terminal: prepare for floating grids 2019-06-29 21:30:54 +02:00
Daniel Eklöf
8cff861f38
terminal: move print_needs_wrap from grid to terminal 2019-06-29 21:16:06 +02:00
Daniel Eklöf
a8f4cb55af
terminal: move cursor from grid to terminal 2019-06-29 21:15:32 +02:00
Daniel Eklöf
3d2ab03f62
terminal: move col/row count, cell width/height and scroll region to terminal 2019-06-29 21:08:08 +02:00
Daniel Eklöf
1ecd4a6ae1
Rename grid_* functions to term_* 2019-06-29 21:03:28 +02:00
Daniel Eklöf
ed867a78bb
vt: dummy implementation of of "ESC (B" (character charset) 2019-06-29 20:49:00 +02:00
Daniel Eklöf
dbd883935b
vt: execute: implement HT - horizontal tab 2019-06-26 19:58:37 +02:00
Daniel Eklöf
a35738d96f
scroll-region: don't clear damage queue when changing scroll region
Vim, for example, changes the scroll region every time you scroll a
single line. Thus, resetting the damage queue is slow.

This reworks the damage handling of scroll updates:

* Split damage queue into two: one for scroll operations and one for
  update/erase operations.
* Don't separate update/erase operations inside/outside the scroll
  region
* Store the current scroll region in the scroll damage operation. This
  allows us to stack multiple scroll operations with different scroll
  regions.
* When updating update/erase operations after a scroll operation,
  split the update/erase operations if necessary (the current scroll
  operation may have a scroll region different from before, thus
  forcing us to split existing update/erase operations.
* The renderer no longer erases after a scroll. The scroll operation
  also adds an erase operation. This also means that erase operation
  are subject to adjustments by later scroll operations.
2019-06-25 20:11:08 +02:00
Daniel Eklöf
2fe7145aff
scrolling region: wip 2019-06-23 21:12:32 +02:00
Daniel Eklöf
b0a2c54fe8
vt: wip: implement scrolling region
This is largely untested, but existing scrolling code has been
converted to using a terminal-global scrolling region that is defined
as start-end of the scrollable region.

This is compared to the old code where the scrolling region where
defined in terms of marginals, counted in lines from top and from
bottom.
2019-06-23 18:02:49 +02:00
Daniel Eklöf
7183b2f0fe
csi/vt: fix logging of intermediate characters 2019-06-23 17:17:47 +02:00
Daniel Eklöf
fbf0db621c
vt: implement reverse scrolling (terminfo 'ri')
This currently duplicates the code paths for DAMAGE_SCROLL; there are
many similarities between the two, but also major differences...
2019-06-23 17:16:52 +02:00
Daniel Eklöf
1ad9d118c2
vt: dummy implementation of ESC dispatch 2019-06-23 13:36:20 +02:00
Daniel Eklöf
949847a35a
vt: add all (?) missing states, actions and transitions 2019-06-23 13:28:55 +02:00
Daniel Eklöf
15b29ecb49
vt: add missing entry action for ESCAPE 2019-06-22 22:27:20 +02:00
Daniel Eklöf
308bcb0233
vt: add missing transition from state ESCAPE -> CSI DISPATCH 2019-06-22 22:26:57 +02:00
Daniel Eklöf
a50be28b9d
grid: implement DAMAGE_SCROLL 2019-06-21 14:29:15 +02:00