Commit graph

4303 commits

Author SHA1 Message Date
Craig Barnes
14a55de4e7 vt: remove partial support for 8-bit C1 control chars
These are part of the "anywhere" state in Paul Flo Williams' VT parser
state diagram[1]. That means that they should be accepted *anywhere* in
a byte sequence, including in the middle of other sequences or even in
the middle of a multi-byte UTF-8 sequence. Adhering to this requirement
makes them incompatible with the use of UTF-8 as a universal encoding.

Not adhering to the aforementioned requirement by making a special case
for UTF-8 sequences may seem tempting, but it's much more at odds with
the relevant standards[2] than it appears on the surface. UTF-8 is not
an "8-bit code", at least not according to the parlance of ECMA-43, nor
does it map the C1 control range in a compatible way.

[1]: https://vt100.net/emu/dec_ansi_parser
[2]: ECMA-35, ECMA-43, ECMA-48
2021-05-25 21:37:38 +01:00
Daniel Eklöf
6761d50ba5
pkgbuild: bump fcft requirement to 2.4.0 2021-05-25 19:01:06 +02:00
Craig Barnes
3eaf6ead2c Merge branch 'ctrl-c-cancel' 2021-05-25 17:03:26 +01:00
Craig Barnes
6eb6668c3c config: bind ctrl+c to "cancel" in search/url mode by default
Closes #544
2021-05-25 16:51:07 +01:00
Daniel Eklöf
37db94078f
Merge branch 'handle-display-roundtrip-failure'
Closes #542
2021-05-25 17:50:29 +02:00
Daniel Eklöf
c3c2ff7398
wayland: fdm callback: check return value of wl_display_dispatch_pending()
Since it’s inside a while-loop, we’d better handle failures, or we
risk getting stuck.
2021-05-25 17:50:17 +02:00
Daniel Eklöf
7bdecaae3b
wayland: roundtrip: log error and abort when wl_display_roundtrip() fails
ayl_roundtrip() has the following code:

    wl_display_roundtrip(wayl->display);

    while (wl_display_prepare_read(wayl->display) != 0)
        wl_display_dispatch_pending(wayl->display);
    wayl_flush(wayl);

If the first wl_display_roundtrip() fails, for example because the
Wayland socket has been closed, we may get stuck in the while-loop.

This happens if the read queue isn’t empty, in which case
wl_display_prepare_read() will return -1 and we’ll continue trying to
dispatch the pending events forever, never succeeding since the socket
is gone.

Closes #542
2021-05-25 17:50:17 +02:00
Craig Barnes
361fb74a8f doc: foot.ini: fix default key combos for "cursor-right-word" action 2021-05-24 21:34:51 +01:00
Daniel Eklöf
05160e61c5
readme: add link to IRC logs 2021-05-24 19:07:53 +02:00
Daniel Eklöf
e335d57bc7
Merge branch 'reflow-osc8-performance' 2021-05-23 10:30:45 +02:00
Daniel Eklöf
9a849b25cc
grid: reflow: uri-ranges: avoid looping URI ranges when reflowing
Since we know the following:

* URI ranges are sorted
* URI coordinates are unique
* URI ranges don’t cross rows

We can optimize URI range reflowing by:

* Checking if the *first* URI range’s start coordinate is on the
  current column. If so, keep a pointer to it.
* Use this pointer as source when instantiating the reflowed URI range
* If we already have a non-NULL range pointer, check its end
  coordinate instead.
* If it matches, close the *last* URI range we inserted on the new
  row, and free/remove the range from the old row.
* When line breaking, we only need to check if the *last* URI range is
  unclosed.
2021-05-23 10:29:45 +02:00
Daniel Eklöf
25d43bd4c3
grid: add grid_row_uri_range_destroy() 2021-05-23 10:29:44 +02:00
Daniel Eklöf
1868fa27e4
term: osc8_close: debug: assert all URI coordinates are unique 2021-05-23 10:29:32 +02:00
Daniel Eklöf
8c67817676
Merge branch 'foot_option_correction' 2021-05-22 20:37:41 +02:00
Clayton Craft
dade079576
foot.ini: use correct name for command-focused param
This expects a hyphen, not underscore, in the option name:

err: config.c:892: /home/user/.config/foot/foot.ini:34: [bell]: command_focused: invalid key
2021-05-22 10:53:09 -07:00
Daniel Eklöf
e37a6db19c
Merge branch 'sort-osc8-ranges' 2021-05-22 18:19:53 +02:00
Daniel Eklöf
7272a5469e
grid: row_add_uri_range: ensure the URIs are sorted 2021-05-22 18:16:54 +02:00
Daniel Eklöf
32dc373f1c
Merge branch 'dont-allow-overlapping-urls' 2021-05-22 18:16:07 +02:00
Daniel Eklöf
a9e8ba0932
url-mode: codespell 2021-05-22 17:08:14 +02:00
Daniel Eklöf
5605eb9040
url-mode: remove overlapping URLs, not just duplicates
echo -e '\e]8;;https://www.foo.bar\e\\https://www.foo\e]8;;\e\\.bar'

will produce an OSC-8 URL (https://www.foo) that is slightly shorter
than the auto-detected one (https://www.foo.bar).

This produces strange results in URL mode. For example, if
url.osc8-underline=always, the OSC8 underline will be removed when
url-mode is exited.

This patch changes the behavior so that auto-detected URLs that
overlap OSC-8 URLs are removed.

Note that OSC-8 URLs cannot overlap with each other, and that
auto-detected URLs also cannot overlap with each other.
2021-05-22 16:42:43 +02:00
Daniel Eklöf
458dd66135
Merge branch 'configurable-protocols-to-match-in-url-mode'
Closes #531
2021-05-22 14:51:15 +02:00
Daniel Eklöf
121ea39942
config: url.protocols: make it comma separated, for consistency 2021-05-22 14:50:47 +02:00
Daniel Eklöf
53516aceec
config: add url.protocols
This makes the protocols recognized by auto-detected URLs
configurable.

Closes #531
2021-05-22 14:50:47 +02:00
Daniel Eklöf
0f483d65ce
config: move url-mode related options to a dedicated section, ‘url’ 2021-05-22 14:50:47 +02:00
Daniel Eklöf
28d27f49bf
Merge branch 'underline-cursor-thickness'
Closes #524
2021-05-22 14:49:42 +02:00
Daniel Eklöf
1b5c849994
config: add cursor.underline-thickness
Works in pretty much the same way as ‘beam-thickness’, except that the
default value is “the font’s underline thickness”.

This means, that when unset, the cursor underline thickness scales
with the font size.

But, when explicitly set, either to a point size value, or a pixel
size, it remains fixed at that size.

Closes #524
2021-05-22 14:49:25 +02:00
Daniel Eklöf
af428d544f
Merge branch 'fdm-always-check-for-signals'
Closes #534
2021-05-22 14:47:44 +02:00
Daniel Eklöf
890dbc49cf
fdm: always check for signals after epoll_pwait(), not only on EINTR
This fixes an issue where we, at least on FreeBSD, sometimes get stuck
in epoll_pwait() after the shell has exited.

It turned out to be because the SIGCHLD signal was delivered at the
same time FDs were made readable/writeable. I.e. epoll_pwait()
returned a non-zero value even though it should have been interrupted
by the SIGCHLD.

To avoid having to search the entire signal array *every time*
epoll_pwait() returns, add a flag that is set in the signal
handler. This tells the FDM to scan the signal array after returning
from epoll_pwait().
2021-05-21 20:00:45 +02:00
Daniel Eklöf
b75bd6507a
notifications: use \e[22m to disable bold
\e[21m was previously used to disable bold. That changed a while ago,
to align foot with the majority of other terminal emulators.

\e[22m now disables both bold and dim.

When this change was done, the user notifications were not updated,
meaning the ‘message’ part was always in bold. This was never the
intended behavior.
2021-05-20 17:51:04 +02:00
Daniel Eklöf
ebc0bc83e0
Merge branch 'irc-update' 2021-05-20 07:46:03 +02:00
Daniel Eklöf
ac33f24b02
readme: remove my name from the IRC details 2021-05-20 07:45:21 +02:00
Craig Barnes
18364fd547 readme/doc: update details for IRC channel 2021-05-19 22:30:08 +01:00
Craig Barnes
74f740c975 vt: limit maximum value of params in vt_param_get()
So that the value is clamped to the range [0, 0x7fffffff] and retains
the same value, regardless of whether it's interpreted as a signed or
unsigned integer.

Closes #522
2021-05-17 18:15:34 +01:00
Daniel Eklöf
9fe278388b
render: stop spamming “resize” INFO logs
It _may_ be acceptable in e.g. tiling WMs, where windows are seldom
resized interactively.

But in a stacking WM where the typical way of resizing windows is by
interactive resizes, this spams way too much.
2021-05-17 19:11:56 +02:00
Daniel Eklöf
09eefabf33
grid: disable timing of resize operations 2021-05-17 19:04:50 +02:00
Daniel Eklöf
3da8dc123f
Merge branch 'search-refactor-extend-word'
Closes #421
2021-05-17 18:20:12 +02:00
Daniel Eklöf
48cc9596f1
changelog: ctrl+w can now be used across lines 2021-05-17 18:19:55 +02:00
Daniel Eklöf
96b19212d3
search: match_to_end_of_word(): we update the selection ourselves
No need to call search_find_next() after doing a
search_match_to_end_of_word(), since we already *know* we have a
match, and where it is.
2021-05-17 18:14:10 +02:00
Daniel Eklöf
a6d9f01c0d
extract: move ‘strip_trailing_empty’ parameter from extra_finish() to extract_begin() 2021-05-17 18:14:10 +02:00
Daniel Eklöf
0945e71572
search: find_next(): correctly wrap row number 2021-05-17 18:14:10 +02:00
Daniel Eklöf
5e621bbdb9
search: match_to_end_of_word(): use a local macro to bump coord 2021-05-17 18:14:10 +02:00
Daniel Eklöf
1c8bdf34ce
search: match_to_end_of_word(): use has_wrapped_around() while extracting text 2021-05-17 18:14:10 +02:00
Daniel Eklöf
11f7a6616b
search: match_to_end_of_word(): we always extend the selection with at least one character 2021-05-17 18:14:10 +02:00
Daniel Eklöf
7cf0e2aae4
search: match_to_end_of_word(): skip newlines when copying from extraction buffer 2021-05-17 18:14:10 +02:00
Daniel Eklöf
e460727afd
search: match_to_end_of_word(): refactor
Rewrite match_to_end_of_word() in terms of

* selection_find_word_boundary_right()
* extract_begin() + extract_one() + extract_finish()

This adds a small overhead, in that extract_*() allocates an internal
buffer, from which we then immediately copy, into our newly resized
prompt buffer.

On the other hand, this makes the matching behavior more consistent
with regular mouse selections, and we don’t have to keep two very
similar match-to-next-word-boundary implementations in sync.
2021-05-17 18:14:10 +02:00
Daniel Eklöf
1bc9fd5fe1
extract: add extract_finish_wide(), and optionally skip stripping trailing empty cells
extract_finish() returns the extracted text in UTF-8, while
extract_finish_wide() returns the extracted text in Unicode.

This patch also adds a new argument to extract_finish{,_wide},
that when set to true, skips stripping trailing empty cells.
2021-05-17 18:14:09 +02:00
Daniel Eklöf
eab874eb06
selection: expose find_word_boundary_{left,right}() 2021-05-17 18:14:09 +02:00
Daniel Eklöf
e415f85829
search: find_next(): proper check for scrollback wrap around
Besides disallowing matches that crosses the scrollback wrap-around,
this also fixes a crash when the trying to search beyond the last
output, when the scrollback history hasn’t yet been completely filled.
2021-05-17 18:14:09 +02:00
Daniel Eklöf
f87a13bbd2
Merge branch 'box-drawing-use-pixman' 2021-05-17 18:09:16 +02:00
Daniel Eklöf
8473deeed3
box-drawing: pre-calculate the LIGHT and HEAVY thicknesses 2021-05-17 17:58:30 +02:00