Commit graph

4454 commits

Author SHA1 Message Date
Daniel Eklöf
96ff29bbd3
render: repair parenthesis after rebase 2021-06-24 17:30:46 +02:00
Daniel Eklöf
b471fe31b1
render: ensure ‘cell_cols’ have been initialized 2021-06-24 17:30:46 +02:00
Daniel Eklöf
50be924285
render: handle fcft_glyph_rasterize() failure correctly 2021-06-24 17:30:46 +02:00
Daniel Eklöf
bd98cb6a73
render: use column count from grapheme instead of first glyph, when we have one 2021-06-24 17:30:46 +02:00
Daniel Eklöf
6c70cd9366
vt: don’t force cols=2 when we see an emoji variant selector
Fish appears to be the only shell expecting this. The rest probably
just does wcswidth(), like usual.
2021-06-24 17:30:45 +02:00
Daniel Eklöf
0a9531ac6c
vt: cache grapheme cluster width in composed struct
* Use regular wcswidth() to calculate the width
* Explicitly set to ‘2’ if we see a emoji variant selector
* Cache the result in the composed struct
2021-06-24 17:30:45 +02:00
Daniel Eklöf
b9ef703eb1
wip: grapheme shaping 2021-06-24 17:30:45 +02:00
Daniel Eklöf
c1cde66f70
Merge branch 'sixel-heap-user-after-free-after-blending' 2021-06-24 17:30:16 +02:00
Daniel Eklöf
a52d867947
sixel: fix crash when splitting up an image across the scrollback
If an image was split up across the scrollback, and the first image
chunk was resized due to it being blended with an already existing
sixel, we crashed.

The reason being the second chunk, emitted *after* the scrollback,
tried to memcpy() image data from a now-free:d image buffer.

The fix is pretty simple: create copies for *all* chunks when an image
has to be split up across the scrollback. Previously, the first chunk
re-used the source image buffer.

Closes #608
2021-06-24 17:08:33 +02:00
Daniel Eklöf
ba26d63829
Merge branch 'custom-terminfo-install-location'
Closes #569
2021-06-24 09:53:09 +02:00
Daniel Eklöf
07bb67130a
changelog: -Dterminfo-install-location meson command line option 2021-06-23 17:04:12 +02:00
Daniel Eklöf
501548080d
install: add the new ‘terminfo-install-location’ option
And flesh out the description of the ‘terminfo’ option, and how it
relates to the new ‘terminfo-install-location’.

Also add instructions on how to manually generate the terminfo files.
2021-06-23 17:04:12 +02:00
Daniel Eklöf
6268fc536b
meson: add -Dterminfo-install-location=disabled|custom-path
Add a new meson option, ‘terminfo-install-location’, that allows you
to customize _where_ the terminfo files are installed, relative to the
installation prefix.

It also recognizes the special value ‘disabled’, in which case the
terminfo files are not installed at all. The terminfo files _are_
however built (allowing us to catch build errors), and foot still
defaults to the ‘foot’ terminfo.

It defaults to $datadir/terminfo

If (the other option) ‘terminfo’ is set to disabled (or tic cannot be
found), terminfo-install-location is automatically set to ‘disabled’.
2021-06-23 16:43:36 +02:00
Daniel Eklöf
ef349bfea2
server: make sure ‘overrides’ have been initialized in all error paths 2021-06-23 15:38:29 +02:00
Daniel Eklöf
15e7e80245
client: make sure ‘fd’ is initialized in all error paths 2021-06-23 15:32:03 +02:00
Daniel Eklöf
68494956b7
Merge branch 'footclient-override'
Closes #600
2021-06-23 15:19:11 +02:00
Daniel Eklöf
5fc8275eb2
client: add and use function push_override()
We now track override data (length + malloc:ed string) in a struct,
and push this struct to our overrides linked list.

There’s a new function, push_override() that takes a string,
calculates its length, strdup() it and pushes it to the linked
list. This function also length-checks the string, to ensure we don’t
overflow.

This way, we don’t have to loop the overrides list twice; once when
calculating the total length of all overrides, and once when sending
the overrides to the server.

Now, we can update the total length as we add overrides (i.e while
parsing the command line, instead of afterwards).

This means we only have to loop the list once, and that’s when sending
it. This also means there’s no longer any need to malloc an array
holding the lengths of each override.
2021-06-23 15:12:09 +02:00
Daniel Eklöf
bac3964039
changelog: add ref to #600 (-o,--override for footclient) 2021-06-23 15:12:09 +02:00
Daniel Eklöf
5b9a000b9b
completions: add -o,--override to footclient 2021-06-23 15:12:09 +02:00
Daniel Eklöf
8640a9c99a
doc: footclient.1: document -o,--override 2021-06-23 15:12:09 +02:00
Daniel Eklöf
fcc20456cd
doc: foot.1: remove trailing space, add ‘=’ between option name and its value 2021-06-23 15:12:09 +02:00
Daniel Eklöf
63a64bdca1
client: implement -o,--override 2021-06-23 15:12:08 +02:00
Daniel Eklöf
c6b5ac9299
main: usage: add ‘=’ between --override and its value
This is how all other long options are documented in the usage.
2021-06-23 15:12:08 +02:00
Daniel Eklöf
04d42662c7
server: avoid “member access within misaligned address” ASAN warning 2021-06-23 15:12:08 +02:00
Daniel Eklöf
136d60606a
client: send overrides for everything that is publicly visible in the conf
Send a generic “overrides” list to the server, containing options in
text, on the format “section.key=value”.

This reduces the size of the base client/server protocol packet, as
well as opens up for a generic -o,--override command line option (not
yet implemented).
2021-06-23 15:12:08 +02:00
Daniel Eklöf
fa5cde6ce1
server: use config_clone() + config_override_apply()
When the connecting client overrides config options, clone the
server’s configuration, and then convert the overridden options to
config overrides, and apply them using config_override_apply().

When destroying the client, free the cloned config using the regular
config_free().
2021-06-23 15:12:07 +02:00
Daniel Eklöf
a5dd71bc7b
Merge branch 'refresh-on-csd-ssd-change' 2021-06-23 15:10:56 +02:00
Daniel Eklöf
26089e8f4d
config: clone: fix font-list cloning
Need to copy over *all* members...
2021-06-23 13:00:50 +02:00
Daniel Eklöf
4e5f5026b8
Merge branch 'config-clone' 2021-06-23 12:54:55 +02:00
Daniel Eklöf
2a83202fdd
wayland: apply CSD/SSD changes in the surface configure event
The configure event asks the client to change its decoration
    mode. The configured state should not be applied immediately.
    Clients must send an ack_configure in response to this event.
    See xdg_surface.configure and xdg_surface.ack_configure for
    details.

In particular, ”the configured state should *not* be applied
immediately”.

Instead, treat CSD/SSD changes like all other window dimension related
changes: store the to-be mode in win->configure, and apply it in the
surface configure event.

This fixes an issue where foot incorrectly resized the window when the
server switched between CSD/SSD at run-time.
2021-06-23 12:37:56 +02:00
Daniel Eklöf
f7860aec76
config: add new function config_clone() 2021-06-23 10:39:14 +02:00
Daniel Eklöf
42ec264075
tokenize: strdup() each individual argv
Instead of referencing the un-tokenized “raw” command string, strdup()
each argv. This way, the input string can be ‘const’.
2021-06-20 14:19:22 +02:00
Daniel Eklöf
7632e16e36
config: remove duplicated error logs for invalid colors 2021-06-20 13:55:12 +02:00
Daniel Eklöf
8177dbcc86
Merge branch 'csd-button-fg-color' 2021-06-20 13:53:21 +02:00
Daniel Eklöf
7334b53d83
config: add csd.button-color option
This option controls the foreground color of the
minimize/maximize/close buttons. I.e. the color used to draw the
minimize/maximize/close glyphs.

It defaults to default background color.
2021-06-20 10:44:50 +02:00
Daniel Eklöf
1a755d0da2
uri: hostname_is_localhost(): don’t crash if hostname == NULL 2021-06-19 15:56:39 +02:00
Daniel Eklöf
078f790b72
term: fix regression after merging #599
Don’t increment ‘j’ twice in each loop iteration, and fix typo in loop
condition (check ‘j’, not ‘i’).
2021-06-18 15:56:34 +02:00
Daniel Eklöf
fa06cf31ff
Merge branch 'title-update'
Closes #591
2021-06-18 15:56:06 +02:00
Daniel Eklöf
07b455e882
render: don’t create/destroy the title update timer each time
Create it once when instantiating the terminal. Add a boolean to track
whether the timer is running or not.
2021-06-18 15:53:47 +02:00
Daniel Eklöf
535c82d628
render: use a timer instead of relying on the frame callback for title update throttling
Using the frame callback works most of the time, but e.g. Sway doesn’t
call it while the window is hidden, and thus prevents us from updating
the title in e.g. stacked views.

This patch uses a timer FD instead. We store a timestamp from when the
title was last updated. When the application wants to update the
title, we first check if we already have a timer running, and if so,
does nothing.

If no timer is running, check the timestamp. If enough time has
passed, update the title immediately.

If not, instantiate a timer and wait for it to trigger.

Set the minimum time between two updates to ~8ms (twice per frame, for
a 60Hz output, and ~once per frame on a 120Hz output).

Closes #591
2021-06-18 15:36:58 +02:00
Daniel Eklöf
b77dbc341b
Merge branch 'reduce-tllist-usage' 2021-06-18 15:36:12 +02:00
Daniel Eklöf
09eb0d1bbb
config: work around clang-11.0 issue
Clang-11.0 doesn’t seem to understand that our ‘static const’ key
modifiers are compile-time constant. Clang-11.1 doesn’t appear to have
this issue.
2021-06-18 15:35:59 +02:00
Daniel Eklöf
495c730487
config: don’t use tllist where it isn’t necessary
tllists are great when dealing with dynamically changing lists. They
are also very easy to use when building lists/arrays where the final
size is unknown.

However, this ease of use comes at a price: code size. tll-macros
expand to a lot of code.

Since things in the config are static, once the config has been
loaded, using tllists for configuration data structures doesn’t make
much sense.

This patch replaces nearly all tllists used by the configuration, with
dynamically allocated arrays.
2021-06-18 15:35:57 +02:00
Daniel Eklöf
31e10c1613
Merge branch 'footclient-dont-copy-conf-unless-necessary' 2021-06-18 15:34:11 +02:00
Daniel Eklöf
26b0e3d441
Merge branch 'underline-positioning'
Closes #490
2021-06-18 15:32:51 +02:00
Daniel Eklöf
7d2770f154
server: don’t clone the config unless we’re going to modify it 2021-06-17 18:11:16 +02:00
Daniel Eklöf
cf81fff062
config: add underline-offset option
This option allows the user to configure a custom underline
offset. That is, use the user provided offset instead of the font
provided one.

Closes #490
2021-06-17 17:54:21 +02:00
Daniel Eklöf
11829931a7
search: don’t crash when we don’t have any XKB compose state 2021-06-16 17:44:14 +02:00
Daniel Eklöf
ee2b0cb21f
Merge branch 'optimize-erase-cell-range' 2021-06-15 16:28:03 +02:00
Daniel Eklöf
45a04393c4
term: erase_cell_range: early break out from URI loop
URI ranges are sorted. This means we don’t have to check any more
ranges once we’ve seen one that starts *after* the erase range.

Closes #594
2021-06-15 16:26:43 +02:00