Commit graph

2238 commits

Author SHA1 Message Date
Daniel Eklöf
6b0b3ddccc
Merge branch 'multi-column-special-spacer-value' 2020-07-15 08:20:10 +02:00
Daniel Eklöf
2fa2c9fad4
term: print: don't pad with spacers if auto-margin is disabled 2020-07-15 08:04:51 +02:00
Daniel Eklöf
b0798ad0be
grid: reflow: use macro print_spacer() to insert multi-column character spacers 2020-07-14 20:29:59 +02:00
Daniel Eklöf
f962fb236e
term: copy current VT attributes to multi-column spacer cells
And refactor: break out spacer-writing code to a function, since we do
exactly the same thing in two places.
2020-07-14 20:24:52 +02:00
Daniel Eklöf
a2af13a126
selection: no need to try to detect multi-column chars at the end of the line
This is handled by the generic foreach() functions, which now simply
skips spacer cells.
2020-07-14 17:06:04 +02:00
Daniel Eklöf
9ea42ef226
grid: reflow: handle multi column character spacers
Ignore *old* cells containing spacers.

Pad new grid with spacers if a multi-column character doesn't fit at
the end of a line.

Insert spacers after a multi-column character.
2020-07-14 17:04:59 +02:00
Daniel Eklöf
6d7aba3ea0
term: print: linewrap + insert *before* inserting SPACERS
Otherwise we end up overwriting the character in the last column
2020-07-14 17:03:20 +02:00
Daniel Eklöf
df2927e088
term: print: write special value CELL_MULT_COL_SPACER to extra cells
When printing a multi-column character, write CELL_MULT_COL_SPACER
instead of '0' to both padding cells (when character doesn't fit at
the end of the line), and to the cells following the actual character.
2020-07-14 16:49:11 +02:00
Daniel Eklöf
5c99e8013b
term: rename COMB_CHARS_LO,HI -> CELL_COMB_CHARS_LO,HI 2020-07-14 16:41:57 +02:00
Daniel Eklöf
4cf7195695
selection: recognize empty padding cells in a forced linewrap
When printing a multi-column character at the end of the line, and it
doesn't fit, we currently insert a forced line-wrap. This means the
last character(s) on the previous line will be empty, followed by a
multi-column character in the first cell on the next line.

Without special code to handle this, the selection text extraction
code will insert a hard newline, since this is normally the correct
thing to do.

Add a TODO, to consider writing a special place holder value to these
padding cells.
2020-07-14 13:17:50 +02:00
Daniel Eklöf
3bc404b5a3
selection: foreach: don't call callback for trailing multi-character cells 2020-07-14 12:59:36 +02:00
Daniel Eklöf
7d134e6b1c
changelog: 'not' -> 'now' 2020-07-14 12:48:16 +02:00
Daniel Eklöf
3fd61fa120
grid: reflow: always emit *all* cells of a multi-column character 2020-07-14 12:15:25 +02:00
Daniel Eklöf
7480c1c06b
term: remove assert, as we're already checking for this in the loop condition 2020-07-14 12:07:12 +02:00
Daniel Eklöf
b035469a7f
term: print: manually increment cursor column
We know we're within bounds, and thus we don't need the extra overhead
of term_cursor_right().
2020-07-14 12:05:24 +02:00
Daniel Eklöf
466466c19e
grid: reflow: use width=1 for invalid characters 2020-07-14 12:03:10 +02:00
Daniel Eklöf
98ebb99be3
term: line-wrap: need to update grid->cur_row when we did *not* scroll 2020-07-14 12:01:00 +02:00
Daniel Eklöf
635698722e
changelog: prefix all C0 names with 'C0::' 2020-07-14 11:33:30 +02:00
Daniel Eklöf
6ea9d1246f
term: print: also require width > 1 when checking if we need to force-wrap or not
While this might seem like it would slow down things, it should in
fact help the compiler optimize: the "normal" code path, that prints
regular ASCII characters, always call term_print() with width == 1.
2020-07-14 11:26:14 +02:00
Daniel Eklöf
b8c7dfba5c
term: line-wrap: manually set cursor row+col
line-wrap is in the hot path, and term_cursor_down/left adds
additional checks that we don't need.
2020-07-14 11:25:06 +02:00
Daniel Eklöf
803c87bb65
grid: reflow: force line-wrap if a multi-column character does not fit on current line 2020-07-14 11:03:33 +02:00
Daniel Eklöf
9dc1d18241
term: print: force line-wrap if a multi-column character does not fit on current line 2020-07-14 10:58:57 +02:00
Daniel Eklöf
bc2fc778ae
csi: DECAWM: clear LCF 2020-07-14 10:54:53 +02:00
Daniel Eklöf
7fce1720d6
csi: IND+RI now clears LCF 2020-07-14 10:52:46 +02:00
Daniel Eklöf
6faa9955ba
term: print: manually increment cursor column for multi-column chars
There's nothing wrong with using term_cursor_right(), but it is
unnecessary since we already check for the end-of-line.
2020-07-14 10:51:22 +02:00
Daniel Eklöf
ca7ec13f3b
term: insert: move assert() after checking whether insert mode is enabled or not 2020-07-14 10:50:38 +02:00
Daniel Eklöf
01c3a2635d
term: linefeed: explicitly clear LCF
LF should always clear LCF. Previously, it was done implicitly in
term_cursor_down(). I.e it was cleared as long as the cursor wasn't at
the bottom of the scrolling region
2020-07-14 10:49:44 +02:00
Daniel Eklöf
cabcc615c1
vt: change HT (horizontal tab) to *not* clear LCF
According to the specification, HT **should** clear LCF. However,
nearly all emulators do not. In particular, XTerm doesn't. So we
follow suite.
2020-07-14 10:47:17 +02:00
Daniel Eklöf
bbce760ab0
term: line-wrap: use term_cursor_{down,left} 2020-07-14 10:08:57 +02:00
Daniel Eklöf
b9719673a1
term: rename term_formfeed() -> term_carriage_return() 2020-07-14 09:29:10 +02:00
Daniel Eklöf
7f7ab00e11
vt: implement C0::FF - processed in the same way as C0::LF 2020-07-14 09:18:52 +02:00
Daniel Eklöf
4849a16f37
vt: process C0::VT the same way we process C0::LF
Previously, C0::VT was implemented as a simple 'cursor down'. I.e. it
would behave as LF **until** it reached the bottom of the screen,
where instead of scrolling, it became a no-op.

See https://vt100.net/docs/vt102-ug/chapter5.html
2020-07-14 09:15:15 +02:00
Daniel Eklöf
7357bb54eb
vt: sort C0's in the switch statement, and use escaped character possible 2020-07-14 09:11:17 +02:00
Daniel Eklöf
21674ab382
input: keyboard: keymap: close(fd) on early-return when failing to mmap 2020-07-14 08:55:20 +02:00
Daniel Eklöf
0ed02e9676
input: keyboard: keymap: use xkb_keymap_new_from_buffer() 2020-07-14 08:52:42 +02:00
Daniel Eklöf
307eead987
input: keyboard: detect failure to mmap keymap 2020-07-14 08:52:11 +02:00
Daniel Eklöf
fa75e1646a
Merge branch 'merge-wl-surface-damage'
Closes #35
2020-07-14 08:35:47 +02:00
Daniel Eklöf
18827ebe0b
changelog: mention fix for 'too many wl_surface_damage_buffer()' calls 2020-07-13 15:10:03 +02:00
Daniel Eklöf
d169e96346
wayland: configure: do a regular resize instead of a force resize
The commit log says that was needed to get tiling in GNOME
working. However, I don't know *which* extension that was.

Force resizing in a configure event means we'll trash a perfectly
valid buffer on e.g. 'activated' state changes.

So, let's revert this for now, and if this breaks GNOME, let's try to
find another solution. If worse comes to worse, we can detect if we're
running under GNOME and do a force-resize then, but not on sane
compositors.
2020-07-13 15:01:27 +02:00
Daniel Eklöf
3958d84069
term: set_fonts: describe why we force resize 2020-07-13 15:01:09 +02:00
Daniel Eklöf
3f55cf3d14
render: render_margin: don't damage margins when rendering scroll damage
When applying scroll damage, we may have to re-render the
margins.

This is because when we SHM-scroll, we actually move the entire
surface, and thus we end up overwriting the top margin area with old
window content, and scroll in uninitialized memory in the bottom
margin.

But, we don't have to tell the compositor about this - the last frame
always contains correct margins; i.e. there's no change between the
last frame and current frame being rendered.

TODO: we _could_ micro-optimize and only damage the margins after a
surface resize. We do it slightly more often now, when dealing with
state changes in screen flash or scrollback searching. But I don't
think it's worth the effort.
2020-07-13 14:19:07 +02:00
Daniel Eklöf
96f480b14d
render: doh! flush the last surface damage *outside* of the rendering loop 2020-07-13 14:18:43 +02:00
Daniel Eklöf
74c3b4be1a
main: free 'cwd' at exit
This fixes an issue where e.g. failing to initialize the Wayland
backend would leave cwd un-free:d
2020-07-13 14:17:55 +02:00
Daniel Eklöf
ed620f1854
render: render_margin: add 'damage_{top,bottom,left,right}' arguments 2020-07-13 14:06:02 +02:00
Daniel Eklöf
0336f47f05
render: render_margin(): remove top/bottom arguments
All calls to render_margin() set top=true and bottom=true anyway.
2020-07-13 14:03:58 +02:00
Daniel Eklöf
9f21799cb2
render: merge wl surface damage for consecutive dirty rows 2020-07-13 13:44:52 +02:00
Daniel Eklöf
09bdf20aa0
render: keep lock while pushing dirty rows to worker queue
Instead of locking the queue for each dirty row we append, and
signaling a condition variable, just keep the lock while going through
the visible rows.

Release the lock once done.

Since we take the lock *before* posting the 'start' semaphore, all
workers will be waiting for the lock to be released.

Then, one at a time they'll get the lock and pick a row to
render. The queue will never get empty - when all rows have been
rendered, each worker will pick a 'frame done' "job" from the queue,
and break the rendering loop.
2020-07-13 13:27:23 +02:00
Daniel Eklöf
669d36afa8
Merge branch 'renderer-dont-special-case-cursor-cell' 2020-07-13 13:22:09 +02:00
Daniel Eklöf
58f0bf5ff3
doc: foot.5: 'runtime' -> 'at runtime' 2020-07-12 20:23:54 +02:00
Daniel Eklöf
fe6c228b13
render: don't render cursor when it has been explicitly hidden 2020-07-12 13:08:19 +02:00