aboutsummaryrefslogtreecommitdiff
path: root/terminal.c (follow)
Commit message (Collapse)AuthorAgeLines
* term: add term_reset_view() - make view follow end-of-output againDaniel Eklöf2019-08-28-0/+10
|
* term: remove commented out codeDaniel Eklöf2019-08-23-27/+0
|
* scrolling: optimize row access by assuming number of rows is a power of 2Daniel Eklöf2019-08-22-18/+45
| | | | | | | | | | | | | | | | | | | With this assumption, we can replace 'a % b' with 'a & (b - 1)'. In terms of instructions, this means a fast 'and' instead of a slow 'div'. Further optimize scrolling by: * not double-initializing empty rows. Previously, grid_row_alloc() called calloc(), which was then followed by a memset() when scrolling. This is of course unnecessary. * Don't loop the entire set of visible rows (this was done to ensure all visible rows had been allocated, and to prefetch the cell contents). This isn't necessary; only newly pulled in rows can be NULL. For now, don't prefetch at all.
* term: rename colors256 -> tableDaniel Eklöf2019-08-21-1/+1
|
* term: use colors256 array for *all* colorsDaniel Eklöf2019-08-21-4/+0
| | | | | | 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.
* csi: move 256-color table into the terminal structDaniel Eklöf2019-08-21-0/+2
|
* erase-cells: don't memset when keeping background colorDaniel Eklöf2019-08-20-4/+6
|
* term: don't send mouse events if shift is being pressedDaniel Eklöf2019-08-08-0/+15
|
* term: cancel selection when scrolling wrapsDaniel Eklöf2019-08-05-2/+8
| | | | | | | | | | If we scroll enough, we'll eventually end up wrapping around the entire scrollback buffer. At this point, a selection is no longer valid, so cancel it. Note: this was very obvious when scrolling in the alt screen, since its scrollback buffer is what you see on the screen (i.e. it has no scrollback).
* term: re-order switch-cases to be in X button orderDaniel Eklöf2019-08-05-3/+3
|
* term: fix mouse button mapping to X button numbersDaniel Eklöf2019-08-05-2/+2
| | | | BACK should be 4, FORWARD 5.
* term: cell erase: reset *all* attributes *except* backgroundDaniel Eklöf2019-08-03-4/+1
|
* cell: pack more efficiently and store glyph as a wcharDaniel Eklöf2019-08-02-3/+4
| | | | | | | | | | | 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-0/+82
|
* term: break out 'flash' to a separate 'term' functionDaniel Eklöf2019-07-30-0/+17
|
* render: add a 'clean' bit to each cell; only render cells that aren't cleanDaniel Eklöf2019-07-30-8/+16
| | | | | | | | | | | 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-0/+8
|
* term: track current window title in terminal structDaniel Eklöf2019-07-21-0/+9
|
* terminal: foreground/background in cell attributes are now uint32_tDaniel Eklöf2019-07-16-2/+1
| | | | This reduces the cell size, and thus improves the cache behavour
* csi: implement FocusIn/Out eventsDaniel Eklöf2019-07-16-0/+16
|
* Use vt_to_slave() instead of calling write(term->ptmx, ...) everywhereDaniel Eklöf2019-07-15-1/+2
|
* selection: add a selection APIDaniel Eklöf2019-07-11-2/+17
|
* grid: prefetch cells in grid_row()Daniel Eklöf2019-07-10-4/+4
|
* terminal: scrolling: prefetch cells of scrolled in linesDaniel Eklöf2019-07-10-17/+28
| | | | | | | | | | | | | 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).
* terminal: scrolling: better debug log messagesDaniel Eklöf2019-07-10-1/+5
|
* grid: don't pre-allocate the entire grid (with all scrollback lines)Daniel Eklöf2019-07-10-1/+0
| | | | | | | | | | 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.
* terminal: add term_linefeed() and term_reverse_index()Daniel Eklöf2019-07-10-0/+18
| | | | | | | | 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.
* terminal: add term_damage_view()Daniel Eklöf2019-07-10-0/+7
| | | | | This ensures everything *visible* (i.e. maybe scrolled back content) is re-rendered.
* wip: initial scroll back supportDaniel Eklöf2019-07-09-2/+14
| | | | | | | | | | | | | | | | | | | | | | | 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...
* cleanupDaniel Eklöf2019-07-09-264/+7
|
* wip: grid is now represented as a grid, not a linear arrayDaniel Eklöf2019-07-08-31/+111
| | | | | | | | | | | | 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.
* grid: grid_memset() -> grid_memclear()Daniel Eklöf2019-07-07-4/+3
|
* csi: implement URXVT style mouse event reportingDaniel Eklöf2019-07-05-10/+12
|
* term: implement MOUSE_SGR mouse event reporting styleDaniel Eklöf2019-07-05-5/+26
| | | | | This style is enabled with the \e[?1006h sequence, and changes how mouse events (button presses, releases and motion events).
* vt: add support for mouse motion reportsDaniel Eklöf2019-07-05-20/+72
|
* vt: add support for \E[?1000h - report mouse button eventsDaniel Eklöf2019-07-05-0/+107
|
* term_erase(): erased cells get the currently selected background colorDaniel Eklöf2019-07-05-2/+24
|
* logging: disable debug logging by defaultDaniel Eklöf2019-07-03-1/+1
|
* scrolling: initial implementation of scrolling region when reverse scrollingDaniel Eklöf2019-07-03-2/+38
|
* scrolling: make sure we don't clear too much memoryDaniel Eklöf2019-07-03-1/+3
|
* scrolling: hopefully fix bad damage update of items outside scrolling regionDaniel Eklöf2019-07-03-4/+4
|
* scrolling: initial reverse scrolling support - no scroll regionsDaniel Eklöf2019-07-03-32/+14
|
* term: optimize damage list after scrollDaniel Eklöf2019-07-03-0/+17
| | | | | | | | | | | | | | | | | | | | | | This optimizes the normal scrolling case; updates are done at the bottom of the screen and then scrolled up. In this case, the damage list will be a more or less sorted list of updates, oldest first. If we're scrolling a lot, the oldest updates will eventually scroll off screen. In this case, there's no need to keep them in the damage list. So, when scrolling, loop the damage list and adjust/remove updates that have scrolled off screen (either partially, or completely). Stop looping as soon as we see an update that has *not* scrolled off screen. Note that this means there may be update items in the damage list that *has* scrolled off screen. This is especially true for random screen writes (i.e. typical to some synthetic benchmarks).
* term: "cache" pointer to current lineDaniel Eklöf2019-07-02-0/+12
| | | | | | | | 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.
* term: simplify horizontal cursor movementDaniel Eklöf2019-07-02-2/+6
| | | | | | Since horizontal cursor movement is clamped to the current line, we can calculate the new linear cursor without any expensive multiplications and/or divisions.
* term: if the damage list gets too long, replace with a full redrawDaniel Eklöf2019-07-02-0/+8
|
* term: 'end' variable is only used in assert()Daniel Eklöf2019-07-01-1/+1
|
* render: always render cursorDaniel Eklöf2019-07-01-2/+0
|
* scrolling: implement partial scrollingDaniel Eklöf2019-07-01-23/+45
|
* wip: use a sliding window instead of memmove() to scrollDaniel Eklöf2019-07-01-79/+41
| | | | | Instead of memmoving a large amount of data on every scroll, use a sliding window. That is, each time we scroll, we offset origin.
* terminal: prepare for floating gridsDaniel Eklöf2019-06-29-22/+22
|
* terminal: move print_needs_wrap from grid to terminalDaniel Eklöf2019-06-29-1/+1
|
* terminal: move cursor from grid to terminalDaniel Eklöf2019-06-29-12/+12
|
* terminal: move col/row count, cell width/height and scroll region to terminalDaniel Eklöf2019-06-29-30/+30
|
* Rename grid_* functions to term_*Daniel Eklöf2019-06-29-0/+311