Commit graph

41 commits

Author SHA1 Message Date
Daniel Eklöf
e3dc184882
term: break out 'flash' to a separate 'term' function 2019-07-30 22:06:02 +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
97350f6488
term: track current window title in terminal struct 2019-07-21 17:35:53 +02:00
Daniel Eklöf
ccc8ef9606
terminal: foreground/background in cell attributes are now uint32_t
This reduces the cell size, and thus improves the cache behavour
2019-07-16 13:17:51 +02:00
Daniel Eklöf
7f6a4f4b6b
csi: implement FocusIn/Out events 2019-07-16 10:34:08 +02:00
Daniel Eklöf
7379198f4a
Use vt_to_slave() instead of calling write(term->ptmx, ...) everywhere 2019-07-15 15:42:21 +02:00
Daniel Eklöf
bcf763d417
selection: add a selection API 2019-07-11 17:38:01 +02:00
Daniel Eklöf
decb4503bf
grid: prefetch cells in grid_row() 2019-07-10 19:52:30 +02:00
Daniel Eklöf
e4a631f7f0
terminal: scrolling: prefetch cells of scrolled in lines
Since newly scrolled in lines will be erased, we want them in the
cache.

So, allocate and prefetch new lines, then repair non-scrolling
regions (to give the prefetch time to actually fetch the
data). Finally, erase the newly scrolled in lines.

This also fixes a bug where the fixup for the non-scrolling regions
could crash on an unallocated row (we were accessing rows that would
be, but hadn't yet been, scrolled in).
2019-07-10 19:18:53 +02:00
Daniel Eklöf
1d7bf3fbca
terminal: scrolling: better debug log messages 2019-07-10 19:18:36 +02:00
Daniel Eklöf
1ff1b3a71e
grid: don't pre-allocate the entire grid (with all scrollback lines)
The row array may now contain NULL pointers. This means the
corresponding row hasn't yet been allocated and initialized.

On a resize, we explicitly allocate the visible rows.

Uninitialized rows are then allocated the first time they are
referenced.
2019-07-10 16:27:55 +02:00
Daniel Eklöf
3ab68c575b
terminal: add term_linefeed() and term_reverse_index()
linefeed moves cursor down one row (columns stays the same), or, if
the cursor is at the last row, scrolls up one row.

reverse_index does the opposite; it moves the cursor *up* one row, or,
if the cursor is at the top row, scrolls *down* one row.
2019-07-10 16:02:03 +02:00
Daniel Eklöf
8a65d52b21
terminal: add term_damage_view()
This ensures everything *visible* (i.e. maybe scrolled back content)
is re-rendered.
2019-07-10 14:32:40 +02:00
Daniel Eklöf
bcd111d203
wip: initial scroll back support
Can scroll up and down, and stops when the beginning/end of history is
reached.

However, it probably breaks when the entire scrollback buffer has been
filled - we need to detect when the view has wrapped around to the
current terminal offset.

The detection of when we've reached the bottom of the history is also
flawed, and only works when we overshoot the bottom with at least a
page.

Resizing the windows while in a view most likely doesn't work.

The view will not detect a wrapped around scrollback buffer. I.e. if
the user has scrolled back, and is stationary at a view, but there is
still output being produced. Then eventually the scrollback buffer
will wrap around. In this case, the correct thing to do is make the
view start following the beginning of the history. Right now it
doesn't, meaning once the scrollback buffer wraps around, you'll start
seeing command output...
2019-07-09 16:26:36 +02:00
Daniel Eklöf
d7bb83022d
cleanup 2019-07-09 09:18:58 +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
48528419c4
grid: grid_memset() -> grid_memclear() 2019-07-07 17:10:15 +02:00
Daniel Eklöf
c76e620d71
csi: implement URXVT style mouse event reporting 2019-07-05 19:40:52 +02:00
Daniel Eklöf
1b07015d49
term: implement MOUSE_SGR mouse event reporting style
This style is enabled with the \e[?1006h sequence, and changes how
mouse events (button presses, releases and motion events).
2019-07-05 15:29:16 +02:00
Daniel Eklöf
1610828b8c
vt: add support for mouse motion reports 2019-07-05 15:13:06 +02:00
Daniel Eklöf
e5fc266cdb
vt: add support for \E[?1000h - report mouse button events 2019-07-05 14:24:51 +02:00
Daniel Eklöf
c5fdc13ea4
term_erase(): erased cells get the currently selected background color 2019-07-05 09:09:28 +02:00
Daniel Eklöf
1373d18dbc
logging: disable debug logging by default 2019-07-03 20:21:03 +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
a7a28ff581
scrolling: initial reverse scrolling support - no scroll regions 2019-07-03 10:45:49 +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
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
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
4b824d824c
term: 'end' variable is only used in assert() 2019-07-01 21:14:31 +02:00
Daniel Eklöf
dfc9554e89
render: always render cursor 2019-07-01 21:13:24 +02:00
Daniel Eklöf
24395cf4cd
scrolling: implement partial scrolling 2019-07-01 19:20:21 +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
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