aboutsummaryrefslogtreecommitdiff
path: root/vt.c (follow)
Commit message (Collapse)AuthorAgeLines
* vt: add commented out cases for 8-bit C1 control charactersDaniel Eklöf2019-12-14-0/+35
| | | | | | | | | | XTerm seems to ignore these when in UTF-8 mode. Since we _only_ support UTF-8, we don't need to recognize these control characters at all. However, it may be good to have them here for reference. So add them, but commented out, along with their corresponding 7-bit versions (which we _do_ recognize and implement).
* vt: don't try to move cursor outside the terminalDaniel Eklöf2019-11-29-7/+11
| | | | | | | | | When we insert an auto-newline, we must make sure we don't try to move outside the terminal window. This can for example happen when a scrolling region have been configured, and the cursor is **outside** the scrolling region (i.e. it's in the bottom margin).
* vt: fix memory corruption: wcwidth() may return -1Daniel Eklöf2019-11-29-12/+14
| | | | | When it did, we called print_insert() with that, which in turn resulted in a too large size value passed to memmove.
* csi/vt: don't bad client data as errorsDaniel Eklöf2019-11-29-1/+1
| | | | This gets rid of spam when cat:ing binary data.
* vt: only define esc_as_string() when debug logging has been enabledDaniel Eklöf2019-11-29-0/+2
|
* vt: disable logging BELLDaniel Eklöf2019-11-29-2/+2
|
* csi/ocs/vt: log unhandled/unrecognized sequences as debug messagesDaniel Eklöf2019-11-29-1/+1
| | | | | | | | 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.
* vt: there are actually many state transitions that are no-opsDaniel Eklöf2019-11-29-1/+0
| | | | | | In most states, most 8-bit values are no-ops. This is already handled; action() recognizes ACTION_NONE as a no-op. Thus, all we need to do is remove the assertion.
* Revert "vt: replace pre_print() with term_autowrap()"Daniel Eklöf2019-11-17-2/+14
| | | | This reverts commit fd8a3992745b9ec51b6e6c1dfc39faf01369b680.
* vt: replace pre_print() with term_autowrap()Daniel Eklöf2019-11-17-14/+2
|
* csi: fix bad implementation of CBT (back tab)Daniel Eklöf2019-11-17-0/+1
| | | | | | | * 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.
* vt: bug (tab regression): don't get stuck on the same tab stopDaniel Eklöf2019-11-17-2/+2
| | | | | | | | | | | There were actually two bugs here: * When checking for a tab stop, make sure the new tab stop is at a different column. Otherwise you can't tab away from a tab stop. * When there aren't any tab stops configured, or when we're already beyond the last tab stop, then tab to the last column (at least I think that's what we're supposed to do).
* term: save/restore charsets on save/restore cursor+attributesDaniel Eklöf2019-11-17-6/+2
|
* term: move charset variables into an anonymous structDaniel Eklöf2019-11-17-7/+13
|
* term: move lcf flag into 'cursor' structDaniel Eklöf2019-11-17-2/+2
|
* term: add struct cursorDaniel Eklöf2019-11-17-21/+21
|
* term: rename: print_needs_wrap -> lcf (Last Column Flag)Daniel Eklöf2019-11-17-2/+2
|
* vt: execute: \t: use tab stops from tab stop listDaniel Eklöf2019-11-16-3/+8
| | | | | Instead of assuming hardcoded 8-width tab stops, use the tab stops from the tab stop list.
* vt: implement ESC H - set tab stop at current columnDaniel Eklöf2019-11-16-0/+11
|
* vt: remove commented out codeDaniel Eklöf2019-11-16-37/+0
|
* vt: DECALN: render at bottom of terminal, not in viewDaniel Eklöf2019-11-14-1/+1
|
* vt: implement VT - Vertical TabDaniel Eklöf2019-11-05-0/+5
| | | | Despite its name, it always moves down exactly one line.
* vt: always use hex (not octal)Daniel Eklöf2019-11-05-2/+2
|
* vt: log hex version of printed character tooDaniel Eklöf2019-11-05-1/+1
|
* vt: always disable state_names[] arrayDaniel Eklöf2019-11-05-1/+1
| | | | It isn't used anywhere, even with LOG_ENABLE_DBG
* vt: esc dispatch: implement DECALNDaniel Eklöf2019-11-05-65/+118
| | | | | | | In esc dispatch: * Switch on private first, then final * Recognize ESC #8 (DECALN), and implement it
* scan-build: fix a couple of minor warnings from a scan-build runDaniel Eklöf2019-11-05-1/+1
|
* Rename: vt_to_slave() -> term_to_slave()Daniel Eklöf2019-11-02-20/+0
|
* vt: don't log ignored execute commandsDaniel Eklöf2019-09-28-1/+0
| | | | cat:ing a binary file would otherwise result in us spamming syslog.
* vt: implement 'insert mode'Daniel Eklöf2019-08-30-18/+27
|
* vt: remove unneeded includeDaniel Eklöf2019-08-30-1/+0
|
* vt: tidy lazy initialization of escape parametersDaniel Eklöf2019-08-27-6/+6
|
* vt: no need to reset OSC string in CLEAR actionDaniel Eklöf2019-08-27-1/+0
| | | | ... as this is done when a new OSC string is started
* vt: store alt charset characters as wcharsDaniel Eklöf2019-08-27-9/+6
|
* vt: bug: fix lazy initialization of sub parameter value (off-by-one)Daniel Eklöf2019-08-24-2/+1
|
* vt: clear CSI parameters lazilyDaniel Eklöf2019-08-24-3/+11
| | | | | | | | | The CLEAR action is so common, that explicitly clearing the entire params array, which is kind of big, is too slow. Clear it lazily instead. Meaning, we only set 'idx' (count) to 0 in CLEAR. Then whenever we parse a parameter, clear the value and sub parameters.
* vt: remove support for urxvt 'extended' line drawing character setDaniel Eklöf2019-08-16-12/+7
|
* vt: there is no default charset for \e0 and \eBDaniel Eklöf2019-08-16-2/+4
|
* cell: pack more efficiently and store glyph as a wcharDaniel Eklöf2019-08-02-26/+23
| | | | | | | | | | | 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.
* term: implement resetDaniel Eklöf2019-08-01-1/+1
|
* font: initial support for double-width *and* color emoji glyphsDaniel Eklöf2019-07-31-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fonts are now loaded with FT_LOAD_COLOR and we recognize and support the FT_PIXEL_MODE_BGRA pixel mode. This is mapped to a CAIRO_FORMAT_ARGB32 surface, that is blitted as-is (instead of used as a mask like we do for gray and mono glyphs). Furthermore, since many emojis are double-width, we add initial support for double-width glyphs. These are assumed to always be utf8. When PRINT:ing an utf8 character, we check its width, and add empty "spacer" cells after the cell with the multi-column glyph. When rendering, we render the columns in each row backwards. This ensures the spacer cells get cleared *before* we render the glyph (so that we don't end up erasing part of the glyph). Finally, emoji fonts are usually bitmap fonts with *large* glyphs. These aren't automatically scaled down. I.e. even if we request a glyph of 13 pixels, we might end up getting a 100px glyph. To handle this, fontconfig must be configured to scale bitmap fonts. When it is, we can look at the 'scalable' and 'pixelsizefixup' properties, and use these to scale the rendered glyph.
* vt: disable flash on bell, it's too annoying in e.g. zshDaniel Eklöf2019-07-30-1/+1
|
* vt: BELL is now logged at info level, and flashes the screenDaniel Eklöf2019-07-30-1/+2
|
* vt: remove almost all abort() callsDaniel Eklöf2019-07-30-9/+6
| | | | | | 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.
* vt: remove duplicate initialization warnings (clang)Daniel Eklöf2019-07-30-3/+0
|
* render: add a 'clean' bit to each cell; only render cells that aren't cleanDaniel Eklöf2019-07-30-8/+2
| | | | | | | | | | | 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.
* term: make sure to update 'current row' when restoring saved cursorDaniel Eklöf2019-07-23-1/+1
|
* dcs: we have no parent terminal to pass through toDaniel Eklöf2019-07-21-13/+1
|
* vt: define state_names[] table when debug logging has been enabledDaniel Eklöf2019-07-19-1/+1
|
* vt: handle up to two private charactersDaniel Eklöf2019-07-19-8/+15
|
* dcs: sort of implement DCS passthroughDaniel Eklöf2019-07-19-4/+16
| | | | | | | We now store the passthrough characters in a buffer, and call dcs_passthrough() on unhook. However, dcs_passthrough() doesn't do anything.
* osc: allocate data buffer dynamicallyDaniel Eklöf2019-07-19-3/+6
|
* vt: implement SS2/SS3 and STDaniel Eklöf2019-07-18-3/+17
|
* vt: execute: ignore unrecognized C0 commandsDaniel Eklöf2019-07-18-2/+1
|
* vt: execute: handle \0 (NUL), by ignoring itDaniel Eklöf2019-07-18-0/+3
|
* vt/csi: recognize the reset sequence sent by 'reset'Daniel Eklöf2019-07-17-0/+4
| | | | However, we don't (yet) actually reset the terminal
* vt: add vt_to_slave()Daniel Eklöf2019-07-15-0/+21
|
* vt: there are NULL entries in the alternate charsetDaniel Eklöf2019-07-15-1/+3
|
* vt: \EB and \E0 have an optional "private", not param (which are CSI only)Daniel Eklöf2019-07-15-2/+4
|
* vt: handle ':'-separated sub parameters correctlyDaniel Eklöf2019-07-15-16/+12
|
* vt: implement SI/SO (shift in, shift out)Daniel Eklöf2019-07-15-0/+10
| | | | This enables switching between the G0 and G1 charsets.
* cell: we only need 4 bytes for the longest utf8 sequenceDaniel Eklöf2019-07-10-1/+1
| | | | | | 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.
* vt: implement \ED and \EEDaniel Eklöf2019-07-10-0/+9
| | | | | | | '\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'
* vt: \EM now calls term_reverse_index() instead of always scrolling one lineDaniel Eklöf2019-07-10-5/+4
|
* vt: '\n' now calls term_linefeed()Daniel Eklöf2019-07-10-4/+1
|
* vt: escape '\E' properly when logging an ESC sequenceDaniel Eklöf2019-07-10-1/+1
|
* vt/csi: use vt_param_get()Daniel Eklöf2019-07-10-1/+1
|
* terminal: only support a single intermediate/private characterDaniel Eklöf2019-07-10-8/+8
|
* input: implement keypad application modeDaniel Eklöf2019-07-09-4/+2
| | | | | This commit also replaces the previous (temporary) key map with a much more complete one.
* vt: handle ESC correctly in OSC string stateDaniel Eklöf2019-07-09-0/+5
|
* vt: handle UTF-8 sequences in OSC PUTDaniel Eklöf2019-07-09-2/+9
| | | | | | | | 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.
* wip: grid is now represented as a grid, not a linear arrayDaniel Eklöf2019-07-08-4/+23
| | | | | | | | | | | | The grid is now represented with an array of row *pointers*. Each row contains an array of cells (the row's columns). The main point of having row pointers is we can now move rows around almost for free. This is useful when scrolling with scroll margins for example, where we previously had to copy the lines in the margins. Now it's just a matter of swapping two pointers.
* performance improvementsDaniel Eklöf2019-07-07-98/+131
| | | | | | | | | * action() returns void - this gets rid of checks in vt_from_slave() * split up ACTION_PRINT into ACTION_PRINT (ASCII) and ACTION_UTF8_PRINT ACTION_PRINT is on the hot path, and we want it streamlined. * Remove run-time checkout for unimplemented state transitions, as we shouldn't have any of those left. * Don't re-load current VT state on each iteration in vt_from_slave()
* vt: add branch hinting to PRINT actionDaniel Eklöf2019-07-06-3/+3
|
* osc: implement change window title and iconDaniel Eklöf2019-07-05-1/+4
|
* vt: improve logging of invalid and unimplemented sequencesDaniel Eklöf2019-07-04-12/+17
|
* vt: implement save/restore cursor+attributesDaniel Eklöf2019-07-04-0/+10
|
* vt: handle graphical charset mode when printing a characterDaniel Eklöf2019-07-04-3/+20
|
* vt: track charsets G0-G3 and support either ASCII or graphical modeDaniel Eklöf2019-07-04-15/+8
|
* vt: bug fix: clear utf-8 state after printing a utf-8 characterDaniel Eklöf2019-07-04-0/+1
|
* vt: implement (untested!) smam and rmam (auto margins)Daniel Eklöf2019-07-03-1/+1
| | | | | Default is auto-margins enabled (scroll when cursor reaches right margin).
* vt: implement (untested!) insert modeDaniel Eklöf2019-07-03-0/+9
| | | | \E4l is not horizontal index, but disable INSERT mode
* logging: disable debug logging by defaultDaniel Eklöf2019-07-03-1/+1
|
* vt: recognize ESC(0 - switch character setDaniel Eklöf2019-07-03-0/+19
|
* vt: always log unimplemented as warnings, not errorsDaniel Eklöf2019-07-03-2/+3
|
* vt: fix logging of ESC intermediates and parametersDaniel Eklöf2019-07-03-1/+1
|
* term: "cache" pointer to current lineDaniel Eklöf2019-07-02-5/+1
| | | | | | | | This adds a pointer to the first cell on the current line. This pointer must be updated every time the row changes. The advantage is mainly that PRINT doesn't have to call grid_get_range(), which is fairly expensive.
* vt: simplify CLEAR action; don't memset() more than necessaryDaniel Eklöf2019-07-02-3/+3
|
* vt: no need to clear temporary utf8 buffer after printing itDaniel Eklöf2019-07-01-1/+0
|
* wip: use a sliding window instead of memmove() to scrollDaniel Eklöf2019-07-01-1/+5
| | | | | Instead of memmoving a large amount of data on every scroll, use a sliding window. That is, each time we scroll, we offset origin.
* vt: only prep logging of CSI/ESC parameters when debug logging is enabledDaniel Eklöf2019-07-01-1/+1
|
* terminal: prepare for floating gridsDaniel Eklöf2019-06-29-1/+1
|
* terminal: move print_needs_wrap from grid to terminalDaniel Eklöf2019-06-29-2/+2
|
* terminal: move cursor from grid to terminalDaniel Eklöf2019-06-29-10/+10
|
* terminal: move col/row count, cell width/height and scroll region to terminalDaniel Eklöf2019-06-29-3/+3
|
* Rename grid_* functions to term_*Daniel Eklöf2019-06-29-11/+11
|
* vt: dummy implementation of of "ESC (B" (character charset)Daniel Eklöf2019-06-29-0/+21
|
* vt: execute: implement HT - horizontal tabDaniel Eklöf2019-06-26-1/+13
|
* scroll-region: don't clear damage queue when changing scroll regionDaniel Eklöf2019-06-25-2/+2
| | | | | | | | | | | | | | | | | | | | | | Vim, for example, changes the scroll region every time you scroll a single line. Thus, resetting the damage queue is slow. This reworks the damage handling of scroll updates: * Split damage queue into two: one for scroll operations and one for update/erase operations. * Don't separate update/erase operations inside/outside the scroll region * Store the current scroll region in the scroll damage operation. This allows us to stack multiple scroll operations with different scroll regions. * When updating update/erase operations after a scroll operation, split the update/erase operations if necessary (the current scroll operation may have a scroll region different from before, thus forcing us to split existing update/erase operations. * The renderer no longer erases after a scroll. The scroll operation also adds an erase operation. This also means that erase operation are subject to adjustments by later scroll operations.
* scrolling region: wipDaniel Eklöf2019-06-23-3/+2
|