Commit graph

6262 commits

Author SHA1 Message Date
Daniel Eklöf
19bf558e6c
render: underlines: improve the appearance of the 'dotted' style
Try to make the 'dotted' style appear more even, and less like each
cell is rendered separately (even though they are).

Algorithm:

Each dot is a square; it's sides are that of the font's line
thickness.

The spacing (gaps) between the dots is initially the same width as the
dots themselves.

This means the number of dots per cell is the cell width divided by
the dots' length/width, divided by two.

At this point, there may be "left-over" pixels.I.e. the widths of the
dots and the gaps between them may not add up to the width of the
cell.

These pixels are evenly (as possible) across the gaps.

There are still visual inaccuracies at small font sizes. This is
impossible to fix without changing the way underlines are rendered, to
render an entire line in one go. This is not something we want to do,
since it'll make styled underlines, for a specific cell/character,
look differently, depending on the surrounding context.
2024-06-27 18:36:17 +02:00
Daniel Eklöf
0d3f2f27e3
grid: refactor: replace {uri,curly}_range_append() with range_append()
Also add range_append_by_ref(), with replaces
uri_range_append_no_strdup().
2024-06-26 19:01:54 +02:00
Daniel Eklöf
cb4a74e10b
grid: row_range_put(): use correct type in call to range_delete() 2024-06-26 18:39:24 +02:00
Daniel Eklöf
45f4eb48fb
grid: refactor: remove union range_data_for_insertion
This union is identical to row_range_data, except the URI char pointer
is const. Let's ignore that, and re-use row_range_data, casting the
URI pointer when necessary.

Also remove uri_range_insert() and curly_range_insert(), and use the
generic version of range_insert() everywhere.
2024-06-26 18:39:24 +02:00
Daniel Eklöf
6a0110446c
grid: grid_row_{uri,curly}_range_put(): share code
grid_row_uri_range_put() and grid_row_curly_range_put() now share the
same base logic.

Range specific data is passed through a union, and range specific
checks are done through switched functions.
2024-06-26 18:39:24 +02:00
Daniel Eklöf
8e4ca90680
foot.info: add 'Setulc' (set underline color) capability 2024-06-26 18:39:24 +02:00
Daniel Eklöf
1297b13cd2
foot.info: add 'Su' (Styled Underlines) boolean capability 2024-06-26 18:39:24 +02:00
Daniel Eklöf
5e046e6a84
csi: sgr_reset(): avoid using memset()
This _should_ be what the compiler does anyway (i.e. it _should_
replace the memset() with inline MOVs). But let's be sure.
2024-06-26 18:39:24 +02:00
Daniel Eklöf
08138e9546
render: underlines: minor perf-tweak: early break out
When looking up the extender underline range, break out early if we
see that there can't possibly be any ranges matching the current column.
2024-06-26 18:39:24 +02:00
Daniel Eklöf
0759caec6e
changelog: styled + colored underlines 2024-06-26 18:39:24 +02:00
Daniel Eklöf
a33954a8f4
doc: foot-ctlseq: add 58/59 (styled + colored underlines) 2024-06-26 18:39:24 +02:00
Daniel Eklöf
48cf57818d
term: performance: use a bitfield to track which ascii printer to use
The things affecting which ASCII printer we use have grown...

Instead of checking everything inside term_update_ascii_printer(), use
a bitfield.

Anything affecting the printer used, must now set a bit in this
bitfield. This makes term_update_ascii_printer() much faster, since
all it needs to do is check if the bitfield is zero or not.
2024-06-26 18:39:24 +02:00
Daniel Eklöf
22302d8bcc
term: term_fill(): only set OSC-8 + styled hyperlinks when use_sgr_attrs is set 2024-06-26 18:39:24 +02:00
Daniel Eklöf
3b738c6e68
terminal: term_fill(): fix osc8 erase bug + handle styled underlines
Only clear OSC-8 hyperlinks at the target columns if we don't have an
active OSC-8 URI. This corresponds to normal VT attributes; the
currently active attributes are set, and all others are cleared.

Handle styled underlines in the same way
2024-06-26 18:39:24 +02:00
Daniel Eklöf
963ce45f3f
render: resize: copy styled underlines to temporary grid
When doing an interactive resize, we create a small grid copy of the
current viewport, and then do a non-reflow resize.

When the interactive resize is done, we do a proper reflow. This is
for performance reasons.

When creating the viewport copy, we also need to copy the styled
underlines. Otherwise, styled underlines will be rendered as plain
underlines *while resizing*.
2024-06-26 18:39:23 +02:00
Daniel Eklöf
b20302c2a7
grid: reflow: handle styled underlines 2024-06-26 18:39:23 +02:00
Daniel Eklöf
8e2402605e
render: styled underlines
This was originally contributed by @kraftwerk28 in
https://codeberg.org/dnkl/foot/pulls/1099

Here, we re-use the rendering logic only, as attribute tracking has
been completely rewritten.
2024-06-26 18:39:23 +02:00
Daniel Eklöf
a45ccfaed0
csi: remove debug log 2024-06-26 18:39:23 +02:00
Daniel Eklöf
05f9774416
foot.info: add smulx (styled underlines) 2024-06-26 18:39:23 +02:00
Daniel Eklöf
32effc6657
csi: wip: styled underlines
This is work in progress, and fairly untested.

This adds initial tracking of styled underlines. Setting attributes
seems to work (both color and underline style). Grid reflow has *not*
been tested.

When rendering, style is currently ignored (all styles are rendered as
a plain, legacy underline).

Color however, *is* applied.
2024-06-26 18:39:23 +02:00
Daniel Eklöf
20923bb2e8
grid: refactor: first step towards a more generic range handling 2024-06-26 18:39:23 +02:00
Daniel Eklöf
cbe399ecd9
Merge branch 'vs15-16'
Closes #1742
2024-06-26 18:38:47 +02:00
Daniel Eklöf
085c60a334
scripts: generate-emoji-variation-sequences: don't assume single codepoint sequences
Right now (Unicode 15.1), all valid variation sequences consist of a
single Unicode codepoint (followed by either VS-15 or VS-16).

Don't assume this is the case.

We don't actually handle longer sequences. But now we at least catch
such escapes, and error out.
2024-06-26 18:33:23 +02:00
Daniel Eklöf
aed9c392eb
scripts: generate-emoji-variation-sequences: compact the C struct
Lookups in this table is not performance critical at all.

Thus, let's compact it to bring down the binary size of foot.

This brings the size of each entry down from 9 bytes to 6, bringing
the size of the whole thing down from 1647 bytes to 1098 bytes, saving
us 549 bytes.
2024-06-26 18:32:10 +02:00
Daniel Eklöf
7378ecf9a7
vt: unittest: verify emoji_vs list is sorted 2024-06-25 08:23:40 +02:00
Daniel Eklöf
ecb1ca61af
scripts: generate-emoji-variation-sequences: don't assume input is sorted 2024-06-25 08:23:27 +02:00
Daniel Eklöf
9665661445
vt: only apply VS-15/16 to valid sequences
At compile time, build a lookup table from the Unicode data file
'emoji-variation-sequences.txt'.

At run-time, when we detect a VS-15/16 sequence, do a lookup in this
table, and enforce the variation selector iff the sequence is valid.

Closes #1742
2024-06-25 08:20:21 +02:00
Daniel Eklöf
94583703e1
vt: don't ignore VS-15 (text presentation)
When we encounter either VS-15 or VS-16, set the grapheme width to 1
or 2 explicitly.
2024-06-25 08:20:20 +02:00
Daniel Eklöf
519e9b8b5e
doc: foot.ini: fix typos 2024-06-25 08:20:03 +02:00
Daniel Eklöf
911af53c5c
doc: foot.ini: document issues with fractional scaling and initial-window-size-*
Since most compositors don't report the correct scaling factor
until *after* the window has been mapped, these options often do not
work.
2024-06-25 08:12:40 +02:00
Daniel Eklöf
795e39de1a
shm: discard shm buffers with mis-matching alpha-setting 2024-06-24 20:09:37 +02:00
Daniel Eklöf
c45231ef89
input: don't reset the XKB compose state in keymap()
When the compositor sends a new keymap, don't reset the XKB compose
state.

This is done by initializing the XKB context, along with the compose
state, when binding the seat, instead of in keymap().

Then, in keymap(), simply stop destroying the old xkb state. Only
destroy, and re-create the keymap state.

Closes #1744
2024-06-22 08:00:13 +02:00
Daniel Eklöf
aea16ba5d2
input: implement wl_pointer::axis_value120()
This implements high resolution mouse wheel scroll events. A "normal"
scroll step corresponds to the value 120. Anything less than that is a
partial scroll step.

This event replaces axis_discrete(), when we bind wl_seat v8 (which we
now do, when available).

We calculate the number of degrees that is required to scroll a single
line, based off of the scrollback.multiplier value.

Each high-res event accumulates, until we have at least the number of
degress required to scroll one, or more lines.

The remaining degrees are kept, and added to in the next scroll event.

Closes #1738
2024-06-18 14:09:03 +02:00
Daniel Eklöf
f3d848da01
osc: 52: treat OSC-52 replies as paste data (after all, they are)
This fixes an issue where other data (such as replies to other
requests) being interleaved with the OSC-52 reply.

The patch piggy backs on the already existing mechanism for handling
regular pastes, where other data is queued up until the paste is done.

There's one corner case that won't work; if the user *just* did a
normal paste (i.e. at virtually the same time the application
requested OSC-52 data), the OSC-52 request will return an empty reply.

Likewise, if there are multiple OSC-52 requests at the same time, only
the first will return data.

Closes #1734
2024-06-09 10:14:57 +02:00
Daniel Eklöf
4bb68282be
foot.ini: add missing option resize-by-cells
Closes #1731
2024-06-08 08:54:12 +02:00
Daniel Eklöf
0755aa7e83
config: codespell: varios -> various 2024-06-08 08:49:43 +02:00
Daniel Eklöf
ba424e8494
ime: codespell: surroundin -> surrounding 2024-06-08 08:49:33 +02:00
Daniel Eklöf
1b4f97d263
issue-template: let's see if we can disable the default template 2024-06-08 08:21:55 +02:00
Jan Beich
f67449700b
meson: auto-detect execvpe on FreeBSD
0667d0e0e3
2024-06-07 16:31:11 +02:00
Daniel Eklöf
bb2e0d64e1
doc: foot.ini: document pixelsize
People are apparently too lazy to read fontconfig's documentation, and
don't understand how to configure font sizes in foot.
2024-06-07 16:18:28 +02:00
Daniel Eklöf
0bf5a7e902
sixel: comment: document the P1 parameter
(and no, it's no longer unimplemented)
2024-05-22 14:56:10 +02:00
Daniel Eklöf
91561d7ba7
issue-template: link "debug build", not just "build" 2024-05-22 14:47:57 +02:00
Daniel Eklöf
5a4af31d18
issue-template: formatting; hopefully makes it easier to read 2024-05-22 14:47:07 +02:00
Daniel Eklöf
585fac7af0
issue-template: ask user to provide info on tmux, zellij, IMEs etc 2024-05-22 14:44:16 +02:00
Daniel Eklöf
713d8d59fb
issue-template: add input-field for TERM 2024-05-22 14:43:51 +02:00
Daniel Eklöf
f64cc04fe6
shm: minor optimization
Don't retry memfd_create() without MFD_NOEXEC_SEAL is 0.

The overall logic is this:

* Try memfd_create() with MFD_NOEXEC_SEAL
* If that fails (which it does, on older kernels), try without the flag

If compiling against an older kernel, or on a system that doesn't
support the noexec seal, MFD_NOEXEC_SEAL is 0.

In this case, there's little point in retrying memfd_create a second
time, with the exact same set of flags.
2024-05-22 14:06:15 +02:00
Daniel Eklöf
fb2ad83d79
changelog: wp-single-pixel-buffer-v1 2024-05-22 13:48:47 +02:00
Daniel Eklöf
708ca3d650
render: single-pixel: minor optimization
Don't re-create the single-pixel buffer, unless necessary.

The buffer itself doesn't have a size. That means we can re-use the
buffer if the last frame's overlay style matches the current frame's
style.

What we *do not* know is whether the current frame's size is the same
as the last frame's.

This means we still have to set the viewport destination, and commit
the surface.
2024-05-22 13:48:46 +02:00
Daniel Eklöf
3c96d0b68e
render: use single-pixel buffers for overlays, when possible
The unicode-mode, and flash overlays are single color buffers. This
means we can use the single-pixel buffer protocol.

It's undefined whether the compositor will release the buffer or not;
to make things easier, simply destroy the buffer as soon as we've
committed it.

Note that since compositors don't necessarily release single-pixel
buffers, we can't plug them into our own buffer interface. This means
we can't use buffer pointers to check if we can re-use the previous
buffer (i.e. we can skip comitting a new buffer), or if we have to
create a new one.

It's _almost_ enough to just check if the last overlay style is the
same as the current one. Except that that doesn't take window resizes
into account...
2024-05-22 13:48:46 +02:00
Craig Barnes
6944d5f901 issue-template: fix typo 2024-05-21 17:48:04 +01:00