Commit graph

146 commits

Author SHA1 Message Date
Daniel Eklöf
15b12f45c6
scan-build: fix a couple of minor warnings from a scan-build run 2019-11-05 10:39:36 +01:00
Daniel Eklöf
5f6d230c10
csi: comment out handling of CSI ? 1042/1043 h/l
In Wayland, we neither _have_ an urgency hint to set, nor can we raise
the window(?)
2019-11-04 12:23:02 +01:00
Daniel Eklöf
42eef90268
csi: recognize CSI ? 1042/1043 h/l
1042: set 'urgency' window manager hint when receiving ctrl-g
1043: raise window when receiving ctrl-g
2019-11-04 12:00:50 +01:00
Daniel Eklöf
9f1525aef7
Rename: vt_to_slave() -> term_to_slave() 2019-11-03 00:52:24 +01:00
Daniel Eklöf
4594899114
csi: ignore invalid scrolling regions
There must be at least one scrolling row. I.e. the bottom margin must
be larger than the top margin.

Note that trying to set an invalid region really will
be *ignored*. I.e. we *don't* reset the scrolling region.

This conforms to xterm's behavior.
2019-09-29 14:58:02 +02:00
Daniel Eklöf
684624c11e
csi: don't ignore the color space identifier in SGRs
Only a color space ID of '2' means the sequence is an RGB
sequence. Update existing code to verify this, and ignore sequences
with other color space IDs.

Except color space ID '5', which is the same as a regular 38;5;<idx>
sequence, but using sub-parameters instead (38:2:5:<idx>).
2019-09-04 20:28:35 +02:00
Daniel Eklöf
f4291690ee
csi: CSI h isn't a valid sequence - it needs a parameter
And, 'insert mode' isn't activated with \e[h, but with
\e[4h.
2019-08-30 22:01:05 +02:00
Daniel Eklöf
d8fb80ea32
term: rename colors256 -> table 2019-08-21 18:50:24 +02:00
Daniel Eklöf
631e0c0870
term: use colors256 array for *all* colors
That is, remove the 'regular' and 'bright' color arrays. This is
possible since the 256-color array is defined such that the first 16
colors map to the regular and bright colors.
2019-08-21 18:47:48 +02:00
Daniel Eklöf
d7aaeaedee
csi: move 256-color table into the terminal struct 2019-08-21 17:56:21 +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
bab6f1d6bf
csi: cancel selection *before* switching grid
This fixes an occasional SIGSEGV
2019-08-08 17:57:21 +02:00
Daniel Eklöf
e2e1db8faf
csi: add 'unimplemented' warnings for things we handle but ignore 2019-08-04 18:11:59 +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
ab92abbd21
term: implement reset 2019-08-01 20:51:11 +02:00
Daniel Eklöf
8acc3b891d
vt: remove almost all abort() calls
Replace with generic error log messages that simply says the
ESC/CSI/OSC sequence is unhandled. This can mean either invalid or
unimplemented, depending on the context.
2019-07-30 21:42:46 +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
a397c64efe
csi: ignore CSI ?1036h/l (metaSendsEscape) 2019-07-23 17:57:41 +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
ba322c4eff
csi: implement \E[Z - back tab 2019-07-22 20:33:50 +02:00
Daniel Eklöf
751ac55f64
csi: *sigh* looks like e.g. neovim doesn't respect Se
I.e. it issues a \E[2 q regardless of what we've configured the
terminfo Se entry to.

So, make \E[2 q mean "the user configured cursor style" (which
defaults to 'block').
2019-07-22 20:23:29 +02:00
Daniel Eklöf
49034bb759
csi: let CSI 0 q mean "switch to user configured cursor style"
According to the specs, \E[0 q means a blinking block cursor. However,
since it also states that \E[1 q *also* is a blinking block cursor,
and that it is the default, *and* given that fact that parameter-less
CSIs typically means "reset", let's make it mean "reset to the user
configured cursor style".
2019-07-22 20:19:27 +02:00
Daniel Eklöf
ed5df194b8
render: implement cursor styles 'bar' and 'underline' 2019-07-22 20:07:34 +02:00
Daniel Eklöf
10be7c37ba
csi: prepare for alternative cursor styles 2019-07-22 19:44:21 +02:00
Daniel Eklöf
61409d40e2
flash: convert our own 'flash' from a CSI to an OSC 2019-07-22 19:10:15 +02:00
Daniel Eklöf
aa4cf1873b
csi: implement CSI 3J - erase scroll back 2019-07-22 19:05:22 +02:00
Daniel Eklöf
3a50c54e7c
csi: bug: reset mouse *reporting* on CSI 1005/1006/1015l 2019-07-21 20:27:26 +02:00
Daniel Eklöf
6f282a2903
csi: remove debug logging 2019-07-21 20:27:09 +02:00
Daniel Eklöf
07aad4a534
csi: change flash log message from warning to debug 2019-07-21 19:17:10 +02:00
Daniel Eklöf
0dd8951cb3
flash: implement 'flash'
Use our own escape sequence for the 'flash' terminfo entry.

Implemented by arming a timer FD and setting a boolean that indicates
we're currently "flashing".

The renderer draws a semi-transparent yellowish layer over the entire
window when "flashing" is active.
2019-07-21 19:14:19 +02:00
Daniel Eklöf
1ff04c5e36
csi: remove erronous final 2019-07-21 18:41:22 +02:00
Daniel Eklöf
64135ae365
csi: implement CSI 22t and CSI 23t
22;0|1|2t pushes the current window title/icon to the stack, while 23
pops it.

The second parameter, 0|1|2 has the following meaning:

0 - push/pop icon+title
1 - push/pop icon
2 - push/pop title
2019-07-21 17:48:06 +02:00
Daniel Eklöf
326808f94d
csi: remove TODO; we have our own terminfo 2019-07-21 15:38:54 +02:00
Daniel Eklöf
16979927ba
csi: pick 16 first 256-colors directly from the term struct
The 16 first entries in the 256-color array are the regular and bright
colors. However, since they can be changed (eventually) at runtime, we
can't statically initialize the 256-color array.

Instead, pick the regular+bright colors directly from the terminal
struct. I.e. the first 16 entries of the 256-color array are now
unused.
2019-07-21 11:32:35 +02:00
Daniel Eklöf
7eb6ac1aec
csi: use colors from terminal struct 2019-07-21 11:31:59 +02:00
Daniel Eklöf
4109d97263
conf: config now provides the colors (though still only hardcoded colors) 2019-07-21 11:06:28 +02:00
Daniel Eklöf
29d855d7c6
term: prepare for configurable colors; add color variables to terminal 2019-07-21 10:58:09 +02:00
Daniel Eklöf
7472e9c152
csi: recognize DECRQM (CSI ? Ps $ p)
The client sends this to request the state of DEC private modes.

We don't support any of them, so for now, reply with 'reset'.
2019-07-19 09:57:51 +02:00
Daniel Eklöf
b583e63bba
csi: tweak logging: no need to mention 'CSI' twice 2019-07-19 09:57:37 +02:00
Daniel Eklöf
24e9477174
vt: handle up to two private characters 2019-07-19 09:56:59 +02:00
Daniel Eklöf
6c1b2f3c81
csi: recognize, but ignore, modifyOtherKeys et al resource setters 2019-07-18 19:48:37 +02:00
Daniel Eklöf
ba533a4993
csi: better (more correct) reply to \e[>0c 2019-07-18 15:28:18 +02:00
Daniel Eklöf
d5157c15b0
csi: color index is an 8-bit unsigned value
This fixes an issue where a large 8-bit value was signed extended into
a large 64-bit value.
2019-07-18 14:25:15 +02:00
Daniel Eklöf
df9162450d
csi: validate param before indexing into the 256-color array 2019-07-18 14:22:19 +02:00
Daniel Eklöf
b6b92a742d
csi: fix wrong variable compared in for-loop 2019-07-18 14:13:35 +02:00
Daniel Eklöf
20684afa8c
csi: implement \E[@ (ICH - insert characters) 2019-07-17 11:19:28 +02:00
Daniel Eklöf
28eef93742
vt/csi: recognize the reset sequence sent by 'reset'
However, we don't (yet) actually reset the terminal
2019-07-17 10:39:38 +02:00
Daniel Eklöf
e944eb85ac
csi: document a couple of unimplemented CSIs 2019-07-17 10:33:15 +02:00
Daniel Eklöf
770c5e97dd
csi: move 'dim' attribute from 'vt' to cell attributes 2019-07-16 13:25:45 +02:00
Daniel Eklöf
6c6543cfeb
csi: add back 'blink' attribute 2019-07-16 13:19:17 +02:00