Daniel Eklöf
4006fc86e4
sixel: overwrite: pass 'width' to sixel_overwrite_at_cursor()
...
This is necessary to handle multi-column characters correctly.
2020-06-28 11:01:19 +02:00
Daniel Eklöf
0483466f68
sixel: insert: calculate end rows in a single statement
2020-06-28 10:45:05 +02:00
Daniel Eklöf
4a0042ba15
sixel: insert: sort sixels such that those furthest up in the scrollback is at the back
2020-06-28 09:16:43 +02:00
Daniel Eklöf
247e0c42d3
sixel: add local function sixel_insert()
...
Replace all tll_push_*() calls with calls to this function.
2020-06-28 08:37:25 +02:00
Daniel Eklöf
186a07c364
sixel: split -> overwrite
2020-06-27 15:29:47 +02:00
Daniel Eklöf
ae727e372a
term: erasing characters now splits sixels instead of deleting them
2020-06-27 15:22:31 +02:00
Daniel Eklöf
0953ffd2d3
sixel: delete/split: early(ier) exit when there aren't in sixel images
...
Avoid unnecessary wrap checks if the sixel image list is empty.
2020-06-27 14:43:29 +02:00
Daniel Eklöf
8cdfd03c4b
sixel: split: make pixman instantiation generic
2020-06-27 14:26:13 +02:00
Daniel Eklöf
cc65002539
sixel: never generate scrollback wrapping sixel images
...
Instead, split them up into two (or more...).
This makes the intersection detection logic *much* simpler.
2020-06-27 14:19:08 +02:00
Daniel Eklöf
e896c2fa55
sixel: refactor handling of wrap-around delete- and split regions
...
Handle these on a higher abstraction level. The low level functions
that detect sixel intersections now assume the specified rectangle (or
line region) does *not* cross the wrap-around.
This is ensured by detecting a wrap-around region before hand, and
splitting it up into two, non wrapping regions.
2020-06-27 13:56:13 +02:00
Daniel Eklöf
3715a37be9
sixel: split_by_rectangle: bug: typo in boundary check
2020-06-27 13:19:19 +02:00
Daniel Eklöf
37ceb65729
sixel: split: make sure relative row/column values are bounded
2020-06-27 13:18:54 +02:00
Daniel Eklöf
d9b7a85722
sixel: split: push front instead of back
...
This reduces the burden on sixel_split_by_rectangle(), which would
otherwise consider the newly added/splitted sixels. Since we already
know they aren't covered by the specified rectangle, we can skip that.
2020-06-27 12:50:39 +02:00
Daniel Eklöf
dfc205e706
sixel: add sixel_split_by_rectangle()
...
This function splits a sixel image into up to four pieces. The four
pieces correspond to the relative complement (set difference) of the
sixel image and the specified rectangle.
Use this function when (possibly) overwriting existing sixel images
when generating a new one, i.e. in sixel_unhook().
2020-06-27 12:45:22 +02:00
Daniel Eklöf
f4fcdbf38b
sixel: hopefully fix erasing of scrollback wrap-around sixels
...
If a sixel image crossed the scrollback wrap around, the logic that
detected whether a row, or a row range, intersected with the sixel was
incorrect.
2020-06-27 11:00:28 +02:00
Daniel Eklöf
bc82d4ee28
sixel: wip: split up image being overwritten, rather than erasing it
...
Instead of completely erasing a sixel image when it is being
"overwritten" (text is printed somewhere within the image, or another
sixel image is emitted within the first image), split it up into up to
four pieces: 'above', 'below', 'to-the-left' and 'to-the-right'.
This is currently very un-optimized, but seems to produce correct
results.
2020-06-23 21:07:12 +02:00
Daniel Eklöf
dec796f525
sixel: if the client has specified a size, do not change that
...
We used to auto-resize images to always be a multiple of 6.
This is incorrect. The client may, for example, have specified a size
to align the image to a cell boundary, which may not be a multiple of
6.
Furthermore, in e.g. Jexer, which splits up an image into stripes,
that the next image would "overwrite" the previous one. Since the next
image was started on a cell row that the previous image had overflowed
into.
2020-06-11 18:40:52 +02:00
Daniel Eklöf
6454e897ab
sixel: only use configured alpha when color matches the default bg
2020-06-10 18:52:53 +02:00
Daniel Eklöf
e0dc01f2ee
sixel: don't erase if cursor is *before* the image
2020-06-10 18:43:42 +02:00
Daniel Eklöf
cc5dedc259
sixel: do not reset palette after each image
...
A client can re-use the palette between images. Resetting the palette
breaks this.
Now we initialize the palette on demand, and resets it when the
palette size is changed (by the client).
2020-06-10 18:38:46 +02:00
Daniel Eklöf
12fda70402
sixel: log message: fix spelling
2020-06-09 17:34:04 +02:00
Daniel Eklöf
21e9031420
sixel: don't erase image when printing text *next* to it.
2020-06-06 13:59:46 +02:00
Daniel Eklöf
a08e7f358f
sixel: fix asan runtime warning: left shift of 255 by 24 cannot...
...
be represented in type 'int'
2020-06-06 13:52:09 +02:00
Daniel Eklöf
69c3e74498
util.h: new header file defining commonly used macros
2020-05-01 11:46:24 +02:00
Daniel Eklöf
89559d5466
grid: move 'cursor' state from terminal to grid
...
This way, the 'normal' and 'alt' grids have their own cursor state,
and we don't need to switch between them.
2020-04-16 18:51:14 +02:00
Daniel Eklöf
d482bf0a30
sixel: improve handling of images when reflowing the grids
...
Update the sixels' 'row' attribute when re-flowing a grid, to ensure
it is rendered at the correct place.
This should work in most cases, but will break when the cell size has
changed (e.g. font size increase/decrease, or a DPI change).
This patch also moves the sixel image list from the terminal struct
into the grid struct. The sixels are per-grid after all.
2020-03-13 18:47:16 +01:00
Daniel Eklöf
0dddb5d119
sixel: don't try to dirty an un-allocated row
...
This may happen e.g. when resizing a grid
2020-03-06 19:11:57 +01:00
Daniel Eklöf
0c247de4ae
sixel: CSI setters also write a reply to the client
2020-02-24 18:42:52 +01:00
Daniel Eklöf
4c6f2ea340
term: term_erase(): call sixel_delete_*()
...
This ensures sixel images are removed, regardless of _how_ the screen
was erased.
2020-02-24 18:42:46 +01:00
Daniel Eklöf
afa9ac0cfc
sixel: ensure 'start' row is not outside the grid row range
2020-02-24 18:42:46 +01:00
Daniel Eklöf
95f7c5586c
sixel: add sixel_delete_at_row and sixel_delete_in_range
...
These are utility functions to erase sixel images that are at the
specified row, or in a row range.
2020-02-24 18:42:32 +01:00
Daniel Eklöf
2c7d98f2ee
sixel: destroy_at_cursor(): skip images on 'other' grid
2020-02-23 00:40:53 +01:00
Daniel Eklöf
a2b4bcbd4f
sixel: track which grid image was created on
2020-02-23 00:40:30 +01:00
Daniel Eklöf
86d640ef71
sixel: rename: purge_at_cursor() -> delete_at_cursor()
2020-02-22 23:06:11 +01:00
Daniel Eklöf
270b7cc6f4
sixel: purge images in unhook, rather than in init
...
This fixes an issue where the cursor was seen blinking in animated
GIFs.
2020-02-22 21:55:10 +01:00
Daniel Eklöf
80361ca04e
sixel: purge images at current cursor row
...
When printing a character, or starting a new sixel image, purge all
images that cover the cursor's current row.
2020-02-22 21:35:45 +01:00
Daniel Eklöf
462229af70
sixel: oops
2020-02-22 21:24:21 +01:00
Daniel Eklöf
05ff2a8a15
sixel: don't ever shrink the image
2020-02-22 21:20:22 +01:00
Daniel Eklöf
f96eb5ff07
sixel: add HLS color format support
2020-02-22 21:18:55 +01:00
Daniel Eklöf
7985cefd65
sixel: add comments to max_width()/max_height()
2020-02-22 21:04:24 +01:00
Daniel Eklöf
25b09b909c
sixel: application configurable image max width/height
2020-02-22 21:03:24 +01:00
Daniel Eklöf
8e37a18083
sixel: application configurable palette size (color count)
...
This implements the CSI escapes for retrieving and (re)setting the
palette size.
2020-02-22 14:02:00 +01:00
Daniel Eklöf
5e65db3b07
sixel: use terminal's background color, not palette[0]
2020-02-22 14:01:20 +01:00
Daniel Eklöf
23d39e6f90
sixel: finalize: use width/height from image, not row/col pos
2020-02-22 11:52:48 +01:00
Daniel Eklöf
a8dc61d0ff
sixel: resize: initialize new rows/columns with the background color
2020-02-22 11:52:22 +01:00
Daniel Eklöf
a418521ced
sixel: mention why we add one
2020-02-22 11:37:25 +01:00
Daniel Eklöf
7625264851
sixel: clean up state machine
...
Use proper state names, and implement the state machine using switch
statements.
2020-02-22 11:30:30 +01:00
Daniel Eklöf
f193695960
sixel: use a struct coord for current sixel position
2020-02-22 10:54:52 +01:00
Daniel Eklöf
1b728dcac8
sixel: rename state SIXEL_SIXEL -> SIXEL_GROUND
2020-02-22 10:50:05 +01:00
Daniel Eklöf
87193ff339
sixel: raster: only resize image buffer if necessary
2020-02-22 10:49:00 +01:00