Commit graph

3307 commits

Author SHA1 Message Date
Daniel Eklöf
dcd4f1ca79
meson/pkgbuild: bump version to 1.6.4 2021-02-12 21:27:47 +01:00
Daniel Eklöf
c18e459757
changelog: prepare for 1.6.4 2021-02-12 21:27:15 +01:00
Daniel Eklöf
299904e987
selection: don’t strip formatting C0 control characters in bracketed paste mode
It’s ok to let the receiving end handle formatting C0 control
characters in bracketed paste mode.

In fact, we *must* let them through. Otherwise it is impossible to
paste e.g. tabs into editors and similar applications.
2021-02-12 20:58:37 +01:00
Daniel Eklöf
caede90544
changelog: use standard signals for SIGCHLD 2021-02-12 10:58:58 +01:00
Daniel Eklöf
036a77194b
config: selection-target: space-optimize the static ‘value’ array 2021-02-12 10:56:38 +01:00
Daniel Eklöf
416e8e7e58
doc: foot.ini: selection-target=none|primary|clipboard|both 2021-02-12 10:56:34 +01:00
Daniel Eklöf
c0bff58d8d
changelog: selection-target=none|primary|clipboard|both 2021-02-12 10:56:28 +01:00
Daniel Eklöf
9db9a0d225
config: add ‘none’ as a possible value for ‘selection-target’
When ‘selection-target’ is set to ‘none’, selecting text does not copy
the text to _any_ clipboard.

This patch also refactors the value parsing to be data driven.
2021-02-12 10:55:50 +01:00
Daniel Eklöf
76e8d3f483
selection: copy selected text to the target configured by ‘selection-target’
Closes #288
2021-02-12 10:55:40 +01:00
Daniel Eklöf
a0afae747b
config: add new option ‘selection-target’
This option controls the clipboard target that selected text should be
copied to.
2021-02-12 10:55:06 +01:00
Daniel Eklöf
79e3a46943
reaper: monitor SIGCHLD using the FDM instead of via a signalfd
In addition to letting the FDM do the low-level signal watching, this
patch also fixes a bug; multiple SIGCHLDs, be it delivered either through a
signal, or via a signalfd, can be coalesced, like all signals.

This means we need to loop on waitpid() with WNOHANG until there are
no more processes to reap.

This in turn requires a small change to the way reaper callbacks are
implemented.

Previously, the callback was allowed to do the wait(). This was
signalled back to the reaper through the callback’s return value.

Now, since we’ve already wait():ed, the process’ exit status is passed
as an argument to the reaper callback.

The callback for the client application has been updated accordingly;
it sets a flag in the terminal struct, telling term_destroy() that the
process has already been wait():ed on, and also stores the exit
status.
2021-02-12 10:53:10 +01:00
Daniel Eklöf
37220fc189
render: block all signals in the rendering threads 2021-02-12 10:53:10 +01:00
Daniel Eklöf
89f49b5bc7
main: monitor SIGINT+SIGTERM using the FDM 2021-02-12 10:53:10 +01:00
Daniel Eklöf
cf1335f258
fdm: add support for managing signals
Add fdm_signal_add() and fdm_signal_del(). Signals added to the fdm
will be monitored, and the provided callback called as “soon as
possible” from the main context (i.e not from the signal handler
context).

Monitored signals are *blocked* by default. We use epoll_pwait() to
unblock them while we’re polling. This allows us to do race-free
signal detection.

We use a single handler for all monitored signals; the handler simply
updates the signal’s slot in a global array (sized to fit SIGRTMAX
signals).

When epoll_pwait() returns EINTR, we loop the global array. The
callback associated with each signal that fired is called.
2021-02-12 10:53:10 +01:00
Daniel Eklöf
ac46e58448
install: add -Dterminfo to list of compile-time options 2021-02-12 10:48:17 +01:00
Daniel Eklöf
a60b7babd3
changelog: -Dterminfo changed from boolean to feature option 2021-02-12 10:48:13 +01:00
Daniel Eklöf
c49eac2147
meson: convert -Dterminfo from a boolean to a feature option
Patch from Jan Beich
2021-02-12 10:48:06 +01:00
Tadeo Kondrak
8a32c5c5c1
ime: Reset terminal's IME state on text_input.leave
To reproduce issue:
- Launch an IME from inside foot
- Type in some preedit text
- Use Ctrl-C to close the IME
- IME text stays in terminal until focus is changed
2021-02-12 10:45:43 +01:00
Daniel Eklöf
6e94da182c
changelog: add section for 1.6.4 2021-02-12 10:44:42 +01:00
Daniel Eklöf
4c168b84cf
meson/pkgbuild: bump version to 1.6.3 2021-01-29 19:53:10 +01:00
Daniel Eklöf
efd1e05b48
changelog: prepare for 1.6.3 2021-01-29 19:52:27 +01:00
Tadeo Kondrak
8f0a3ee7a9
Send text_input_rectangle requests for text-input 2021-01-29 19:39:48 +01:00
Daniel Eklöf
9411054b50
ci: freebsd: don’t need -Wno-missing-braces anymore
builds.sr.ht has been updated to FreeBSD-12.2
2021-01-29 10:57:32 +01:00
Daniel Eklöf
7049c95b62
selection: don’t replace \r\n and \n with \r in bracketed paste mode 2021-01-27 10:54:37 +01:00
Daniel Eklöf
567071e48a
selection: no xassert() in the releases/1.6 branch 2021-01-26 20:48:56 +01:00
Daniel Eklöf
5db389da21
search: match composed characters when extending the search string to the next word boundary 2021-01-26 20:47:51 +01:00
Daniel Eklöf
709d6deeae
search: fix matching of multi-column characters
We were matching the sub-sequence SPACERs as if they were regular
characters, which obviously failed.
2021-01-26 20:47:43 +01:00
Daniel Eklöf
7611a6c7fc
selection: remove duplicate ‘ESC’ in switch case 2021-01-26 20:47:37 +01:00
Daniel Eklöf
c8fdd3a214
selection: DEL is 0x7f, not 0x1f 2021-01-26 20:47:35 +01:00
Daniel Eklöf
94d587fa6a
selection: codespell: stript -> strip 2021-01-26 20:47:32 +01:00
Daniel Eklöf
9f8856ee7d
selection: strip non-formatting C0, BS, HT and DEL from pasted text 2021-01-26 20:47:22 +01:00
Daniel Eklöf
579f3cf8e3
selection: unbreak text/uri-list decoding: we’re not using \r, not \n
Before passing the pasted text to the decoder, we now replace \r\n,
and \n, with \r.

The URI decoder was looking for a \n, which meant we failed to split
up the list and instead pasted a single “multi-line” URI.
2021-01-26 20:47:19 +01:00
Daniel Eklöf
f32b924241
selection: replace \r\n and \n with \r, and strip \e from pasted text
Closes #305
Closes #306
2021-01-26 20:47:14 +01:00
Daniel Eklöf
adbf036053
ime: fix rendering of pre-edit cursor when positioned after the pre-edit string
We failed to convert the byte-indices to cell indices, resulting in a
box cursor covering the entire pre-edit string.

Note that in addition to fixing the translation from byte index to
cell index, the rendered had to be updated to dirty one extra cell
from the original grid.

Without this, we left trailing cursors behind us when the user deleted
text from the pre-edit string.
2021-01-26 20:46:59 +01:00
Daniel Eklöf
f9a43209f2
search: ad-hoc workaround for combining characters with positive x-offsets
When rendering the search input box, do the same ad-hoc workaround for
combining characters with a positive x-offset as we do when rendering
normal grid cells.

In this case, we don’t *know* when we’re dealing with combining
characters. But we can detect zero-width characters. For these, check
their glyph’s x-offset. If positive, adjust it like we do when
rendering combining glyphs in the main grid, to ensure the glyph is
positioned over the _previous_ character, not the next.
2021-01-26 20:46:50 +01:00
Daniel Eklöf
569795a529
changelog: high cpu usage while holding down e.g. arrow keys in search mode 2021-01-26 20:45:42 +01:00
Daniel Eklöf
9d51f2cb1a
search: don’t re-scan the scrollback unless the search string actually has changed 2021-01-26 20:45:35 +01:00
Daniel Eklöf
8df49c7f84
search: fix matching against composed characters 2021-01-26 20:43:18 +01:00
Daniel Eklöf
b4448d2c03
changelog: search input box no longer accepts non-printables 2021-01-26 20:43:06 +01:00
Daniel Eklöf
96af3971de
search: filter out non-printable characters
Don’t allow non-printable characters in the search input string.
2021-01-26 20:42:09 +01:00
Daniel Eklöf
3252131dd4
terminal: fix encoding of mouse buttons 6 and 7 in mouse events
These two buttons were encoded using the *exact* same numbers as
button 4 and 5 (scroll wheel up/down), making it impossible to
distinguish them.

The relevant section from XTerm’s control sequences documentation is:

    Some wheel mice can send additional button events, e.g., by tilting the
    scroll wheel left and right.

    Additional buttons are encoded like the wheel mice,

    o  by adding 64 (for buttons 6 and 7), or

    o  by adding 128 (for buttons 8 through 11).
2021-01-26 20:41:25 +01:00
Daniel Eklöf
30ef3fe4b6
changelog: add bug ref to the ‘FreeBSD support’ entry 2021-01-23 10:20:32 +01:00
Daniel Eklöf
07bb18847d
changelog: freebsd support 2021-01-23 10:18:59 +01:00
Daniel Eklöf
207fdaf06c
ci: freebsd-x64: compile with -Wno-missing-braces
The freebsd/latest image is still FreeBSD-12, with clang-8. It
generate false positive warnings:

../../foot/search.c:357:21: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
    mbstate_t ps = {0};
2021-01-23 10:18:33 +01:00
Daniel Eklöf
1f745655ac
shm: don’t check for __i386__ and __x86_64__ - there are other architectures out there
Instead, check for __SIZEOF_POINTER__ == 8, since what we’re really
interested in is whether we have enough virtual address space or not.
2021-01-23 10:18:30 +01:00
Daniel Eklöf
c70694bd8f
client: explicitly use a 64-bit type for ‘total_len’
This fixes an out-of-range comparison in 32-bit builds:

 client.c:289:19: error: result of comparison of constant 4294967296 with expression of type 'size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
        if (total_len >= 1llu << (8 * sizeof(uint32_t)) ||
            ~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-01-23 10:18:26 +01:00
Jan Beich
ab040d0d6f
completions/zsh: unbreak with BSD find(1)
find: -printf: unknown primary or operator
2021-01-23 10:18:23 +01:00
Jan Beich
d31cc9b5ef
ci: enable freebsd-x64 job
- Add missing dependencies
- Disable terminfo to match downstream
2021-01-23 10:18:19 +01:00
Jan Beich
8b092256d1
meson: optionalize terminfo dependency
ncurses on FreeBSD still uses termcap(5) while foot works fine with
xterm-256color sans status line and visible bell. Having more than
one ncurses version installed may break other applications.

Document -Dterminfo=false uses --term=xterm-256color by default
2021-01-23 10:18:09 +01:00
Jan Beich
0b07bf78f0
meson: depend on wayland-client when using wayland-protocols
Base compiler on BSDs doesn't look where packages are installed to
avoid tainting build environment. When system fcft is installed to
the same prefix as wayland-client it passes CFLAGS that satisfy both
but when using subprojects/fcft there's a build error.

xdg-shell.c:33:10: fatal error: 'wayland-util.h' file not found
xdg-decoration-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
xdg-output-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
presentation-time.c:28:10: fatal error: 'wayland-util.h' file not found
primary-selection-unstable-v1.c:28:10: fatal error: 'wayland-util.h' file not found
text-input-unstable-v3.c:33:10: fatal error: 'wayland-util.h' file not found
In file included from ../../foot/grid.c:1:
In file included from ../../foot/grid.h:5:
In file included from ../../foot/terminal.h:19:
../../foot/wayland.h:8:10: fatal error: 'wayland-client.h' file not found
In file included from ../../foot/selection.c:1:
../../foot/selection.h:4:10: fatal error: 'wayland-client.h' file not found
2021-01-23 10:16:52 +01:00