Commit graph

904 commits

Author SHA1 Message Date
Daniel Eklöf
1c737fa7bd
resize: re-align grid offset 2019-07-04 19:56:27 +02:00
Daniel Eklöf
669ef1a07a
csi: implement CSI S and CSI T (scroll up/down) 2019-07-04 19:39:23 +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
dd5a3b1009
main: handle EINTR in poll() 2019-07-04 19:16:32 +02:00
Daniel Eklöf
50d455bd15
csi: ignore 'blinking cursor' private mode 2019-07-04 10:04:52 +02:00
Daniel Eklöf
0457c33418
csi: fix parsing of 256-color and 24-bit color SGRs
There may be more SGR sequences after the 256-color/24-bit
sequence. Thus, check that we have *enough* parameters to parse the
256-color/24-bit SGR. It doesn't have to be *exactly* the required
number of parameters though.

Fixes issues with sequences like: \e[38;2;1;48;2;1m
2019-07-04 09:57:02 +02:00
Daniel Eklöf
ef944933e6
flash mitigation: add a small delay before rendering after receiving client data
Simply re-trying to read client data is not enough in many
cases. Re-work the flash mitigation to instead incur a small delay
before rendering.
2019-07-04 09:54:40 +02:00
Daniel Eklöf
03ca7a04ab
main: more zenburn:ish default foreground and background colors 2019-07-04 09:27:06 +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
9f12bca21e
Merge branch 'fast-scroll' 2019-07-03 22:30:00 +02:00
Daniel Eklöf
35d5035f61
csi: fix bug: cursor horizontal absolute (<ESC> Pn G) was off-by-one 2019-07-03 22:21:44 +02:00
Daniel Eklöf
2f3f4ac56f
csi: cleanup 2019-07-03 22:21:23 +02:00
Daniel Eklöf
3d58d24963
csi: ?r and ?s are like ?h and ?l; they save/restore things
Assuming ncmpcpp is correct, ?1001s and ?1001r saves and restores the
'highlight mouse tracking' mode.
2019-07-03 21:33:23 +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
b5dccf2883
csi: add unknown private escapes 's' and 'r', seen with ncmpcpp 2019-07-03 16:04:16 +02:00
Daniel Eklöf
43045a98e2
csi: recognize ?1005 and ?1015 private CSIs 2019-07-03 16:00:06 +02:00
Daniel Eklöf
f4c3343382
csi: fix cursor positioning 2019-07-03 15:59:28 +02:00
Daniel Eklöf
66033b9b1a
csi: implement 'erase characters' (CSI X) 2019-07-03 15:58:49 +02:00
Daniel Eklöf
f87d4f856a
main: mitigate screen flashes on slow client
If a client writes to the PTY "too slow", we often end up flashing the
screen. This could for example be caused by a client first erasing a
line, then we render that frame, followed by the client updating the
just-erased line. When we render _that_ frame, it will be perceived as
a flash.

Mitigate this by trying to read client data again, after finishing
processing one batch, but before rendering.

To avoid hanging on client output (and never rendering anything),
limit this to at most 3 iterations. This may have to be tweaked.
2019-07-03 15:16:38 +02:00
Daniel Eklöf
a0602aedb5
csi: recognize 'smam', but log unimplemented 2019-07-03 14:47:34 +02:00
Daniel Eklöf
92f0d64279
csi: add untested implementation of "horizontal index" 2019-07-03 14:47:01 +02:00
Daniel Eklöf
2fad8138e1
csi: scroll region changes are now logged as debug again, rather than info 2019-07-03 14:24:46 +02:00
Daniel Eklöf
da305abdd8
scrolling: initial implementation of scrolling region when reverse scrolling 2019-07-03 14:16:01 +02:00
Daniel Eklöf
1f343527f0
scrolling: make sure we don't clear too much memory 2019-07-03 14:15:46 +02:00
Daniel Eklöf
70743fddf4
scrolling: hopefully fix bad damage update of items outside scrolling region 2019-07-03 14:15:23 +02:00
Daniel Eklöf
5e8c75aa38
csi: implement 'civis' (show/hide cursor) 2019-07-03 14:14:46 +02:00
Daniel Eklöf
a7a28ff581
scrolling: initial reverse scrolling support - no scroll regions 2019-07-03 10:45:49 +02:00
Daniel Eklöf
048f619b19
render: fix last-cursor comparison 2019-07-03 09:46:39 +02:00
Daniel Eklöf
2bca2a894e
main: add --font/-f command line option 2019-07-03 09:46:13 +02:00
Daniel Eklöf
e6c27645fa
term: optimize damage list after scroll
This optimizes the normal scrolling case; updates are done at the
bottom of the screen and then scrolled up.

In this case, the damage list will be a more or less sorted list of
updates, oldest first.

If we're scrolling a lot, the oldest updates will eventually scroll
off screen. In this case, there's no need to keep them in the damage
list.

So, when scrolling, loop the damage list and adjust/remove updates
that have scrolled off screen (either partially, or completely).

Stop looping as soon as we see an update that has *not* scrolled off
screen.

Note that this means there may be update items in the damage list
that *has* scrolled off screen. This is especially true for random
screen writes (i.e. typical to some synthetic benchmarks).
2019-07-03 09:23:42 +02:00
Daniel Eklöf
0fef48c1fd
csi: up to application to restore scroll region on alt switch? 2019-07-03 08:37:16 +02:00
Daniel Eklöf
dfaa5f5640
main: make sure cursor is inside the new row/col limits on resize 2019-07-02 22:32:25 +02:00
Daniel Eklöf
d5158b2432
render: track last cursor position in absolute values
This seems to fix an issue where we sometimes saw "ghost" cursors when
scrolling.
2019-07-02 22:31:52 +02:00
Daniel Eklöf
8ed7239458
csi: re-set cursor when switching between alt and normal screen
This forces a refresh of the "current line" pointer.
2019-07-02 22:23:54 +02:00
Daniel Eklöf
cc2931007c
csi: repair DCH (delete character)
The logic was simply broken. This fixes it, and also converts it to
use the new "current line" pointer.
2019-07-02 22:19:43 +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
dd4647e9ff
term: simplify horizontal cursor movement
Since horizontal cursor movement is clamped to the current line, we
can calculate the new linear cursor without any expensive
multiplications and/or divisions.
2019-07-02 21:43:49 +02:00
Daniel Eklöf
e17d297dca
term: if the damage list gets too long, replace with a full redraw 2019-07-02 19:45:17 +02:00
Daniel Eklöf
d04029d703
render: revert glyph caching
Instead, try to group as long sequences of glyphs as possible, as
fewer calls to cairo_show_glyphs() is *much* faster.
2019-07-02 19:44:02 +02:00
Daniel Eklöf
607df23a92
render: fix cursor not always being rendered
In case the only difference between this and the last frame was cursor
movement, the cursor was not rendered.
2019-07-02 12:51:43 +02:00
Daniel Eklöf
9392cfbbf3
render: draw pre-rendered glyph OVER background
This allows us to render the background dynamically. Note that
pre-rendered glyphs still have wrong foreground color.
2019-07-02 12:50:18 +02:00