Commit graph

118 commits

Author SHA1 Message Date
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
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
8723098cda
terminal: move fore/background colors from grid to terminal 2019-06-29 21:09:58 +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
e2bdda8c61
render: don't try to render glyph for empty cell(s) 2019-06-29 20:50:40 +02:00
Daniel Eklöf
28f7ab5130
main: increase ptmx slave buffer size 2019-06-29 20:50:27 +02:00
Daniel Eklöf
23a133a64a
render: alignment 2019-06-29 20:50:21 +02:00
Daniel Eklöf
b59b03fd07
render: also check scroll damage list 2019-06-29 20:50:09 +02:00
Daniel Eklöf
34fb86724f
slave: remove initial debug code 2019-06-29 20:49:35 +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
63fb7a9374
log: don't syslog 2019-06-29 20:48:02 +02:00
Daniel Eklöf
1dbddd7155
colors: store as doubles, rather than uint32_t
Since cairo uses doubles, we don't want to have to convert a uin32_t
to double values every time we render a cell.
2019-06-26 20:33:32 +02:00
Daniel Eklöf
54403738bb
render: use alpha from cell colors 2019-06-26 20:09:02 +02:00
Daniel Eklöf
3349c28fce
render: avoid division 2019-06-26 20:08:49 +02:00
Daniel Eklöf
dbd883935b
vt: execute: implement HT - horizontal tab 2019-06-26 19:58:37 +02:00
Daniel Eklöf
3a97fce6d0
grid: attributes now track whether we've set a foreground/background color
This means we don't have to explicitly set the foreground/background
to the grid's default colors whenever we reset/clear a cell, and we
can instead simply memset() the entire cell to 0.

This also means the renderer has to get the default color when
rendering a cell without a foreground/background color set.
2019-06-26 19:44:31 +02:00
Daniel Eklöf
97420f13d8
scroll: let the render erase the scrolled up region
The grid scroll operation no longer inserts a DAMAGE_ERASE operation,
but instead manually clears the region. The render does the
corresponding thing.
2019-06-26 19:33:39 +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
0f76f4190a
grid: scroll reverse: hopefully done correct now 2019-06-24 20:49:37 +02:00
Daniel Eklöf
0e078f44b6
grid: scroll: fix start/end for erase region 2019-06-24 20:45:14 +02:00