Commit graph

173 commits

Author SHA1 Message Date
Daniel Eklöf
7d8327369b
csi: Send Device Attributes, Tertiary DA: require Ps == 0 2019-12-14 14:38:03 +01:00
Daniel Eklöf
9551be492c
csi/vt: don't bad client data as errors
This gets rid of spam when cat:ing binary data.
2019-11-30 00:12:30 +01:00
Daniel Eklöf
616896e2a5
csi/ocs/vt: log unhandled/unrecognized sequences as debug messages
Having them as error messages was nice when we where still missing
lots of sequences.

Now we don't anymore, and these just spam stdout as well as syslog
when e.g. cat:ing binary data.
2019-11-29 23:59:24 +01:00
Daniel Eklöf
0dd37f0a36
terminal: use the 'text' xcursor pointer whenever selection is possible 2019-11-28 19:35:47 +01:00
Daniel Eklöf
d41c4b9195
csi: implement "Send Device Attributes (Tertiary DA)" 2019-11-18 12:46:52 +01:00
Daniel Eklöf
612bf9ef4f
csi: adjust reply to primary DA
Report us as being VT220, as VT420 causes vttest to send a
DECRQSS. This is a DCS request that we don't implement (there's no DCS
handling *at all* - all DCS strings are ignored).

Should be ok as no one appears to care about this one. Other terminals
report a much lower level (urxvt for example, replies with vt100. We
used to reply with vt102, which also was fine).
2019-11-18 12:41:10 +01:00
Daniel Eklöf
2c99f692b3
csi: improve "Send Device Attributes (Primary DA)"
Pretend we're a VT420, with a couple of supported features
indicated. Note that I haven't verified we support *everything* that
each features entails - or even what exactly a feature *is* (locator
port?)
2019-11-18 12:07:17 +01:00
Daniel Eklöf
aa692d19e4
csi: document "Send Device Attributes (Secondary DA)" 2019-11-18 12:06:29 +01:00
Daniel Eklöf
0250a703e4
csi: implement 'Query Device Status'
By replying with "Device OK"
2019-11-18 11:44:03 +01:00
Daniel Eklöf
2d0c4928ee
csi: add debug logs for the various mouse reporting modes 2019-11-18 11:31:05 +01:00
Daniel Eklöf
9902a5732f
term: try to improve on a performance regression
When support was added for DECOM (absolute/relative row addressing), a
small but noticeable (~3.5%) performance regression was introduced.

Try to improve the situation by simplifying the relative-to-absolute
conversion; only the row needs to be transformed.
2019-11-17 18:52:27 +01:00
Daniel Eklöf
7f4b2c5755
csi: implement 'CHT' - Cursor Horizontal Tab 2019-11-17 12:29:52 +01:00
Daniel Eklöf
f4be84871f
csi: implement 'CPL' - Cursor Previous Line 2019-11-17 11:36:24 +01:00
Daniel Eklöf
d8708d1105
csi: implement 'CNL' - Cursor Next Line 2019-11-17 11:35:30 +01:00
Daniel Eklöf
53f4273b17
csi: implement 'HPR' - Horizontal Position Relative 2019-11-17 11:31:35 +01:00
Daniel Eklöf
616e506f2e
csi: fix bad implementation of CBT (back tab)
* It takes a parameter, that indicates the number of tab stops to move
  through
* Use the tab stops defined in the tab stops list, not hard coded mod
  8 columns.
2019-11-17 11:20:59 +01:00
Daniel Eklöf
ca58c4c621
csi: implement 'HPA' - Horizontal Position Absolute 2019-11-17 11:09:16 +01:00
Daniel Eklöf
a70fe1f5d7
term: move lcf flag into 'cursor' struct 2019-11-17 09:46:20 +01:00
Daniel Eklöf
d637b8c9ba
term: add struct cursor 2019-11-17 09:44:31 +01:00
Daniel Eklöf
c1088d77ac
term: rename: print_needs_wrap -> lcf (Last Column Flag) 2019-11-17 09:39:43 +01:00
Daniel Eklöf
f74026ba9b
csi: el/ed/dch/ich/ech: reset 'print_needs_wrap' (lcf)
This makes the result of 'wraptest', by Mattias Engdegård, match the
behavior of 'DEC' (the architectural behavior of DEC terminals).
2019-11-17 09:36:55 +01:00
Daniel Eklöf
9840291100
csi: implement CSI 0g and CSI 3g
* 0g - clear tab stop at current column
* 3g - clear all tab stops
2019-11-16 10:55:28 +01:00
Daniel Eklöf
f6d87e235b
csi: CSI ?4h enables smooth scrolling, ?4l enables jump scrolling 2019-11-05 14:37:17 +01:00
Daniel Eklöf
95eaad7ce4
csi: implement DECOM - switch cursor origin between absolute and relative
The default is absolute mode, where 0,0 is the upper left corner of
the screen.

In relative mode, the origin is relative the top scroll margin.

Internally, we always track the current cursor position in absolute
mode. Every time we the client *sets* or *queries* the cursor position
in relative mode, we translate it to absolute.
2019-11-05 13:27:37 +01:00
Daniel Eklöf
89dbc61a34
csi: DECCOLM erases screen 2019-11-05 13:21:47 +01:00
Daniel Eklöf
342d6036f9
csi: CSI ?3h enables 132 column mode, CSI ?3l 80 column mode 2019-11-05 11:10:56 +01:00
Daniel Eklöf
bf58b9ea8e
csi: implement force cursor position 2019-11-05 11:10:19 +01:00
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