Commit graph

47 commits

Author SHA1 Message Date
Daniel Eklöf
61cabdac13
search: wip: re-direct input while searching, and build a search buffer
This adds a new state, 'is_searching'. While active, input is
re-directed, and stored in a search buffer. In the future, we'll use
this buffer and search for its content in the scrollback buffer, and
move the view and create a selection on matches.

When rendering in 'is_searching', everything is dimmed. In the future,
we'll render the current search buffer on-top of the dimmed "regular"
terminal output.
2019-08-27 17:23:28 +02:00
Daniel Eklöf
71c6f11e86
input: back out accidental commit of debug code 2019-08-19 21:18:43 +02:00
Daniel Eklöf
4168f91d40
csi: implement CSI ? 1007 h/l - alternateScroll
When enabled, mouse scrolls in the alternate screen are converted to
up/down key presses.
2019-08-19 21:16:47 +02:00
Daniel Eklöf
6f1cf8af34
input: remove debug output 2019-08-15 20:09:24 +02:00
Daniel Eklöf
44112e5591
input: handle meta modifier when modifying "other" keys
When handling keys without a specific map defined (i.e. keys
corresponding roughly to xterm's "otherKeys"), recognize the meta
modifier and report the correct modifier code.
2019-08-15 19:38:50 +02:00
Daniel Eklöf
9ca01436ee
input: track meta modifier 2019-08-15 19:38:28 +02:00
Daniel Eklöf
4b06360681
input: free previous XKB state when we get a new one 2019-08-12 21:33:24 +02:00
Daniel Eklöf
70b6d9d7d2
input: don't paste from primary if client is mouse tracking 2019-08-09 21:26:34 +02:00
Daniel Eklöf
481a1cd678
selection/input: triple click selects an entire row 2019-08-06 19:32:06 +02:00
Daniel Eklöf
a82f12dd2b
input: use a timer fd to handle keyboard key repeat
Instead of running a repeater thread that writes the key to repeat
over a pipe, use a simple timer fd.

No more locking or condition signalling. No need to track
start/stop/exist states.

We simply set up the initial timeout value to be the 'delay', and the
interval to be the repeat 'rate'.
2019-08-05 19:33:01 +02:00
Daniel Eklöf
c62ce72778
selection: mark-word using spaces only as word separator
When the user double-clicks with ctrl pressed, we now select the word
under the cursor using spaces only as word separator.
2019-08-05 19:02:27 +02:00
Daniel Eklöf
4d7993b36f
cell: pack more efficiently and store glyph as a wchar
The 'attributes' struct is now 8 bytes and naturally packed (used to
be 9 bytes, artificially packed).

'cell' struct is now 12 bytes, naturally packed (used to be 13 bytes,
artificially packed).

Furthermore, the glyph is stored as a wchar instead of a char*. This
makes it easier (faster) to do glyph lookup when rendering.
2019-08-02 18:19:07 +02:00
Daniel Eklöf
263d3bb2ba
input: fix 'comparison ... is always true' warning (clang) 2019-07-30 20:27:19 +02:00
Daniel Eklöf
f5e9b7b048
input: use keyboard enter serial only for selection serial 2019-07-30 19:29:04 +02:00
Daniel Eklöf
3e06dca12d
input: generate escape sequences for "other" keys
This corresponds to xterm's modifyOtherKeys option, though the code
needs more testing and cleanup.
2019-07-26 18:49:09 +02:00
Daniel Eklöf
e88cf4c8c8
mouse: use discrete axis event if available
This improves the scroll experience with certain devices
2019-07-26 18:48:59 +02:00
Daniel Eklöf
32f397d9b0
input: store last seen wayland input serial
We need this for clipboard data
2019-07-19 11:11:48 +02:00
Daniel Eklöf
8bd969262b
selection: implement double-click-to-select-word 2019-07-17 21:30:57 +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
0393521d79
input: cancel selection on any mouse *except* BTN_LEFT 2019-07-11 18:17:40 +02:00
Daniel Eklöf
66e067082b
selection: implement copy *to* primary 2019-07-11 17:38:03 +02:00
Daniel Eklöf
e56066feef
selection: add selection_from_primary() API (stub for now) 2019-07-11 17:38:03 +02:00
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
0facfa4da7
input: call selection_finalize() when BTN_LEFT is released 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
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
7594edb89b
input: generate BTN_BACK/BTN_FORWARD mouse down events when scrolling 2019-07-10 14:17:44 +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
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
b4fdf51752
input: add support for dead keys (composing) 2019-07-09 10:00:54 +02:00
Daniel Eklöf
a959c89b7f
input: bug: row is calculated from the cell *height*, not width 2019-07-05 15:28:39 +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
a102ff09f9
input: mouse events 2019-07-05 10:44:57 +02:00
Daniel Eklöf
1373d18dbc
logging: disable debug logging by default 2019-07-03 20:21:03 +02:00
Daniel Eklöf
35e5fa1f76
vt: implement DECCKM (cursor key sends either SS3 or CSI escapes) 2019-06-23 14:12:20 +02:00
Daniel Eklöf
4c7dbee221
input: reduce utf8 buffer size 2019-06-22 20:40:28 +02:00
Daniel Eklöf
faf60108f1
input: add a key mapping table, mapping key syms to escape sequences
At the same time, also add support for the shift modifier.
2019-06-22 20:31:53 +02:00
Daniel Eklöf
8ecd69c500
input: stop key repeater when input focus is lost 2019-06-21 18:40:53 +02:00
Daniel Eklöf
71dde121e6
wip: initial input handling 2019-06-19 10:04:47 +02:00