Daniel Eklöf
1a21a5fb29
Merge branch 'cache-optimize'
2019-07-10 19:21:49 +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
379f7cf646
grid: swap_row: drop requirement that row indices be positive
2019-07-10 19:17:53 +02:00
Daniel Eklöf
4ffd93ca4c
render: reduce scrollback line count
...
More than 1000 lines and we start exhibiting bad cache behavior
2019-07-10 18:49:34 +02:00
Daniel Eklöf
74ab120101
terminal: use floats instead of double for colors
...
We don't need the full resolution a double gives us. Using floats
reduces the size of cells greatly, which improves cache usage.
2019-07-10 18:48:46 +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
cf71534768
terminal: remove 'blink' attribute from cell struct
...
This makes the other attribute bits fit in a single uint8_t, which
makes each cell smaller which improves cache usage.
2019-07-10 18:45:12 +02:00
Daniel Eklöf
5a92202a49
scrollback: in debug, verify all rows in the view are initialized
2019-07-10 16:36:10 +02:00
Daniel Eklöf
132749b1ed
grid: repair grid_row_in_view(): use 'view', not 'offset'
2019-07-10 16:35:52 +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
8f0d574dcb
grid: don't implement grid_swap_row() in the header file
2019-07-10 16:08:53 +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
9df691e1af
vt: add vt_param_get() - returns the specified parameter's value
2019-07-10 16:03:18 +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
96bd55f7c4
terminal: only support a single intermediate/private character
2019-07-10 15:03:16 +02:00
Daniel Eklöf
43e57e3546
csi: fix logging; 'CSI' was printed twice
2019-07-10 14:57:59 +02:00
Daniel Eklöf
0bc3b29b0f
Merge branch 'scrollback'
2019-07-10 14:57:26 +02:00
Daniel Eklöf
5144fcba0c
scrollback: disable debug logging
2019-07-10 14:45:00 +02:00
Daniel Eklöf
607755536f
scrollback: use term_damage_view()
2019-07-10 14:43:46 +02:00
Daniel Eklöf
a01efd07e3
scrollback: don't allow more scrolling when already at the top or bottom
2019-07-10 14:42:48 +02:00
Daniel Eklöf
e01060caf9
render: damage the *view* too, when resizing
2019-07-10 14:34:43 +02:00
Daniel Eklöf
4cef8ed2cc
render: reset 'normal' grid's view correctly
2019-07-10 14:34:32 +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
d8d4b34362
scrollback: fix scrolling outside initialized lines in new terminal
2019-07-10 14:28:20 +02:00
Daniel Eklöf
7594edb89b
input: generate BTN_BACK/BTN_FORWARD mouse down events when scrolling
2019-07-10 14:17:44 +02:00
Daniel Eklöf
94fdde3da7
main: hopefully fix logical error in delayed rendering
...
We want the timeout_ms to *not* be -1 (i.e. someone has requested
delayed rendering), while we're *not* getting client output.
2019-07-10 09:56:15 +02:00
Daniel Eklöf
18c61a9a2a
scrollback: fix off-by-one when grid size matches terminal/window size
2019-07-10 09:55:53 +02:00
Daniel Eklöf
1bb5afeb0a
render: don't render cursor if it is not in view
2019-07-10 09:55:50 +02:00
Daniel Eklöf
ed0fd2d442
scrollback: don't redraw if view doesn't change
2019-07-10 09:30:35 +02:00
Daniel Eklöf
1d338f8477
scrollback: don't scroll past scrollback history
2019-07-10 09:29:36 +02:00
Daniel Eklöf
b058e6384a
scrollback: initial support for mouse scrolling
2019-07-10 09:15:37 +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
34f9d544fd
input: fix backspace escape sequences
2019-07-09 15:09:44 +02:00
Daniel Eklöf
cb8c2cdb35
input: split up keymap
...
This makes the top level table smaller, and faster to search
through. Eventually, we could do something fancy, like b-search the
top level table.
2019-07-09 15:05:07 +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
9b5c044b29
terminal: rename and redefine cursor keys mode and keypad keys mode
2019-07-09 11:07:06 +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
b4fdf51752
input: add support for dead keys (composing)
2019-07-09 10:00:54 +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
8cf7d7f7ab
Merge branch 'no-more-linear'
2019-07-09 09:24:26 +02:00
Daniel Eklöf
0d24fcafd0
render: store frame callback pointer in terminal struct
...
This allows us to free it when exiting
2019-07-09 09:23:32 +02:00
Daniel Eklöf
d7bb83022d
cleanup
2019-07-09 09:18:58 +02:00
Daniel Eklöf
0f14b5298e
render: copy old contents to new grids when resizing
...
Eventually, we'll add text reflow here as well.
2019-07-09 09:12:41 +02:00
Daniel Eklöf
6d48f0f2a5
render: hackerman
2019-07-08 20:25:41 +02:00
Daniel Eklöf
729974492d
main: verify compositor has WL_SHM_FORMAT_ARGB8888
2019-07-08 16:12:02 +02:00