Commit graph

904 commits

Author SHA1 Message Date
Daniel Eklöf
482c8f76a9
selection: add support for pasting from clipboard 2019-07-11 17:38:02 +02:00
Daniel Eklöf
b50ec1a850
selection: initial copy-to-clipboard functionality 2019-07-11 17:38:02 +02:00
Daniel Eklöf
1f808781f4
selection: selection_finalize() ignores invalid selections 2019-07-11 17:38:02 +02:00
Daniel Eklöf
0facfa4da7
input: call selection_finalize() when BTN_LEFT is released 2019-07-11 17:38:02 +02:00
Daniel Eklöf
e7e199d6b5
selection: spell 'finalize' correctly 2019-07-11 17:38:02 +02:00
Daniel Eklöf
d0e0b6da7c
selection: invalidate *all* affected lines when updating selection 2019-07-11 17:38:02 +02:00
Daniel Eklöf
c43b49dab6
input: ignore mouse motion outside our window 2019-07-11 17:38:02 +02:00
Daniel Eklöf
18070cf286
selection: disable debug logging 2019-07-11 17:38:02 +02:00
Daniel Eklöf
84c0bb8f59
csi: cancel selection when switching between 'normal' and 'alt' grid 2019-07-11 17:38:02 +02:00
Daniel Eklöf
7dd80b08b3
render: bug: don't render cursor when hide cursor is enabled 2019-07-11 17:38:01 +02:00
Daniel Eklöf
d944274f14
selection: disable selection when client has enabled mouse tracking 2019-07-11 17:38:01 +02:00
Daniel Eklöf
bcf763d417
selection: add a selection API 2019-07-11 17:38:01 +02:00
Daniel Eklöf
1c861e5d69
selection: only left button can be used for selection 2019-07-11 17:38:01 +02:00
Daniel Eklöf
632790d5d8
selection: selections can be made, and are rendered
* Start selection on mouse button down
* Update selection on motion
* Button release cancels selection if there were no motion after start
* Renderer detects cells inside the selection and inverts their colors
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
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