Commit graph

142 commits

Author SHA1 Message Date
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
Daniel Eklöf
3d8e140a28
render: cache glyph masks
Cache rendered glyph masks for each font combo. When rendering text,
use these when possible (standard ASCII).

For now, use the cached glyph as a mask. This allows colors to just
work. It would be faster to cache a completely pre-rendered image, but
then we would need one image for each background/foreground combo.
2019-07-02 12:22:05 +02:00
Daniel Eklöf
e6d9eb7c9e
main: log resize event as INFO 2019-07-01 21:15:06 +02:00
Daniel Eklöf
4b824d824c
term: 'end' variable is only used in assert() 2019-07-01 21:14:31 +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
dfc9554e89
render: always render cursor 2019-07-01 21:13:24 +02:00
Daniel Eklöf
7e4dd2de9a
csi: clear all existing alt damage when switch alt <--> normal 2019-07-01 19:25:04 +02:00
Daniel Eklöf
ee476a7e5a
csi: erase alt screen when enabling it 2019-07-01 19:23:31 +02:00
Daniel Eklöf
24395cf4cd
scrolling: implement partial scrolling 2019-07-01 19:20:21 +02:00
Daniel Eklöf
63e46b7b0b
render: use actual grid size when re-allocating grid buffer 2019-07-01 19:19:48 +02:00
Daniel Eklöf
c853f01027
render: re-enable drawing cursor on erase 2019-07-01 19:19:32 +02:00
Daniel Eklöf
482f56b4a2
grid: implement a memmove-sort-of function
grid_memmove() moves cell data from one index to another, taking the
grid offset into account.
2019-07-01 19:18:52 +02:00
Daniel Eklöf
b45b492f41
csi: DECSTBM: move cursor to top left corner of scrolling region 2019-07-01 19:13:45 +02:00