Commit graph

5336 commits

Author SHA1 Message Date
Craig Barnes
6940d2047e Merge branch 'terminfo-sync-2026' 2022-02-16 19:50:30 +00:00
Craig Barnes
f066f28026 csi: fix case label typo in decrqm()
The other functions that deal with private modes all use 1070 for
term->sixel.use_private_palette. The xterm docs[1] also list this
param as 1070:

> Ps = 1 0 7 0  ⇒  use private color registers for each graphic

Using 1079 seems to have been a mistake in commit 4aa980a6a2.
2022-02-16 17:31:09 +00:00
Craig Barnes
f8262f2125 doc: ctlseq: recommend using DECSET 2026 for synchronized updates
Instead of the somewhat problematic[1] DCS-based equivalent.

[1]: https://codeberg.org/dnkl/foot/issues/459
2022-02-16 14:48:10 +00:00
Craig Barnes
b6ea9d2dbc terminfo: use DECSET 2026 instead of DCS sequences for Sync capability
Even though it makes little difference to foot which is used in the
terminfo entry, DECSET 2026 has some advantages[1] over the DCS
sequences and we should probably promote the better of the 2 where
possible.

Note: the terminfo string was taken from Nicholas Marriott's
suggestion[2] in the terminal-wg discussion.

[1]: https://codeberg.org/dnkl/foot/issues/459
[2]: https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/2#note_973680
2022-02-16 14:08:22 +00:00
Craig Barnes
9db416ccdc doc: ctlseq: tweak formatting of OSC 22 sequence slightly, for clarity
Having 3 separately underlined words made it look a bit like 3 separate
parameters, at a glance.
2022-02-15 15:39:35 +00:00
Craig Barnes
3d3ee2274f doc: ctlseq: make OSC 8 formatting consistent with other sequences 2022-02-15 15:35:04 +00:00
Craig Barnes
23cf80667a Explicitly initialize sigaction::sa_mask members with sigemptyset(3)
Not doing so before calling sigaction(3) is "undefined" according to
POSIX[1]:

> Applications shall call either sigemptyset() or sigfillset() at least
> once for each object of type sigset_t prior to any other use of that
> object. If such an object is not initialized in this way, but is
> nonetheless supplied as an argument to any of pthread_sigmask(),
> sigaction(), sigaddset(), sigdelset(), sigismember(), sigpending(),
> sigprocmask(), sigsuspend(), sigtimedwait(), sigwait(), or
> sigwaitinfo(), the results are undefined.

The use of designated initializers means that sa_mask members were
still being initialized, but sigset_t is an opaque type and implicit
initialization doesn't necessarily produce the same results as using
sigemptyset(3) (although it typically does on most implementations).

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaddset.html
2022-02-12 12:26:42 +00:00
Daniel Eklöf
d34c8007f1
osc: don’t damage the entire view on a single color palette update
Instead, loop the viewport and dirty only those cells that are
affected by the palette change.
2022-02-10 20:09:11 +01:00
Craig Barnes
3c232bec28 Merge branch 'remove-decset-27127' 2022-02-09 20:59:36 +00:00
Craig Barnes
e32707ffc0 csi/input: remove private mode 27127
This effectively reverts commit 31c73f0cf0.
2022-02-09 20:50:20 +00:00
Daniel Eklöf
990a15250a
meson: fcft-3.0.0 is buggy, require 3.0.1
Fcft-3.0.0 is known to cause crashes. We don’t want anyone ever
compiling foot against it.

Closes #935
2022-02-09 21:48:34 +01:00
Daniel Eklöf
ee840a308a
Merge branch 'refactor-key-bindings' 2022-02-09 17:52:37 +01:00
Daniel Eklöf
757768dbe5
config: rename csd.color.close -> quit
This fixes a compilation error on FreeBSD:

../../foot/render.c:2055:45: error: no member named 'epoll_shim_close' in 'struct config::(anonymous at ../../foot/config.h:254:9)'
        conf_color = &term->conf->csd.color.close;
                      ~~~~~~~~~~~~~~~~~~~~~ ^

/usr/local/include/libepoll-shim/epoll-shim/detail/common.h:8:15:
note: expanded from macro 'close': #define close epoll_shim_close
2022-02-09 17:51:05 +01:00
Daniel Eklöf
fed90646d3
input/search/url: pass pointer-to key-binding struct to execute() 2022-02-09 17:51:05 +01:00
Daniel Eklöf
e5c5cd5478
config: ‘pipe’ is now optional ‘aux’ data in the key-binding struct
This allows us to add helper functions that e.g. compare bindings’ aux
data in a generic way.
2022-02-09 17:51:05 +01:00
Daniel Eklöf
9814d96206
config: rename enum config_key_binding_type -> key_binding_type 2022-02-09 17:51:05 +01:00
Daniel Eklöf
56b948ca20
input: call wayl_bindings_reset() when receiving a new keymap 2022-02-09 17:51:05 +01:00
Daniel Eklöf
026785b777
wayland: add wayl_bindings_reset()
This function resets (clears) all key- and mouse-bindings associated
with the seat.
2022-02-09 17:51:05 +01:00
Daniel Eklöf
e1a4b5c5a8
wayland: use key_bindings_destroy() to destroy the mouse bindings 2022-02-09 17:51:05 +01:00
Daniel Eklöf
dcd79065c8
wayland: unify key- and mouse-binding structs 2022-02-09 17:51:04 +01:00
Daniel Eklöf
d04bc6ab10
config: move structs and enums used by config from terminal.h -> config.h 2022-02-09 17:51:04 +01:00
Johannes Altmanninger
cbae14f0c5
foot.ini: add modeline so vim uses # comments instead of ;
Editors like Vim and Kakoune ship filetypes dosini and ini
respectively. Both use ";" as comment character, which is used for
example by Vim's "gq" command which wraps lines while preserving
comment prefixes.

foot only accepts # comments. I think it's desirable to stick to
a single commenting style (easier to diff configs).

Make Vim accept that by adding modeline to use the "conf"
filetype, which is for "generic Unix config files".  We already
have an Emacs modeline at the top, but Vim seems to ignore it.
Kakoune doesn't have that filetype, but a patch has been
proposed to use # whenever it already occurs in the file, see
https://github.com/mawww/kakoune/pull/4537
2022-02-09 17:48:44 +01:00
Daniel Eklöf
c9da1dc152
Merge branch 'fallback-mouse-cursor'
Closes #738
2022-02-07 18:07:35 +01:00
Ashish SHUKLA
5631f16a62
changelog: fallback xcursor 2022-02-07 22:17:31 +05:30
Ashish SHUKLA
4df73585e7
Specify a fallback mouse cursor
`text' cursor is not available in lots of cursor themes, but `xterm'
is, so specify `xterm' as a fallback cursor name.
2022-02-07 22:15:47 +05:30
Ashish SHUKLA
91559fe480
pgo: add stub for render_xcursor_is_valid 2022-02-07 22:15:07 +05:30
Daniel Eklöf
f718af4c1b
doc: ctlseq: OSC-22 2022-02-07 17:28:38 +01:00
Daniel Eklöf
448a0f2833
changelog: OSC-22 2022-02-07 17:28:38 +01:00
Daniel Eklöf
6cdaa4fd0a
osc: implement OSC-22 - set xcursor pointer 2022-02-07 17:28:37 +01:00
Daniel Eklöf
0bf92fff05
term: add term_set_user_mouse_cursor()
This function allows setting a custom mouse cursor.

This is done by adding a ‘char*’ member to the term struct. When it is
non-NULL, we *always* use that pointer (the exception being when the
pointer is hidden), while the pointer is over the grid. This is
instead of the hand/beam pointers we otherwise would use.
2022-02-07 17:28:37 +01:00
Daniel Eklöf
e4f9dc7d58
render: add render_xcursor_is_valid()
Returns true if the provided cursor name is non-NULL, and exist in the
currently loaded xcursor theme.
2022-02-07 17:28:37 +01:00
Daniel Eklöf
92ebe00927
render: call wl_cursor_theme_get_cursor() earlier
Before this patch, wl_cursor_theme_get_cursor() was called in the FDM
hook, just before we’re about to update the mouse cursor “for real”.

This relies on seat->pointer.xcursor still being valid. This is true
as long as we’re only using our compiled-in static xcursor names, but
not otherwise.

Now, we call wl_cursor_theme_get_cursor() in render_xcursor_set(). At
this point, we *know* seat->pointer.xcursor is valid.

There is a slight chance of added overhead here, if the client
application is switching mouse grabbing on/off rapidly. Before, the
calls to wl_cursor_theme_get_cursor() would automatically be
throttled.

However, the main point of delaying the actual pointer update to the FDM
hook is to throttle the *Wayland* calls. And this is still happening:
wl_cursor_theme_get_cursor() is client-side only.
2022-02-07 17:28:28 +01:00
Daniel Eklöf
22307565ac
Merge branch 'pipe-scrollback-crash'
Closes #926
2022-02-07 15:13:31 +01:00
Daniel Eklöf
91be6d2e6e
changelog: crash in pipe-scrollback 2022-02-07 15:12:46 +01:00
Daniel Eklöf
631c63d5a4
term: scrollback-to-text: crash when trying to extract the entire scrollback
We calculated the ‘start’ row by adding the number of screen rows to
the current grid offset. This works in most cases. But not when the
offset is close to the wrap-around.

This triggered a crash when we tried to access a row number larger
than the number of available grid rows.

Fix by bounding the start row to the number of grid rows.

This unearthed a second bug, where trying to extract the scrollback
resulted in nothing getting copied.

The extraction logic did:

   for (r = start; r != (end + 1); r++)
       ....

This works, as long as end isn’t start-1. When we try to extract the
entire scrollback, it _is_ start-1.

Fix by rewriting the loop logic to check for r==end *after* copying
the row contents, but *before* incrementing r.

Closes #926
2022-02-07 15:12:38 +01:00
Daniel Eklöf
b2d59a0e54
Merge branch 'selection-handling-during-reflow'
Closes #924
2022-02-07 15:12:08 +01:00
Daniel Eklöf
1b0cfafb9e
changelog: scrollback wrap-around crossing selections 2022-02-07 15:06:55 +01:00
Daniel Eklöf
ef522e292f
selection: foreach: sort start/end based on their scrollback-start relative values
When iterating the characters in a selection, we want to go from the
“start” to the “end”, where start is the upper left-most character,
and “end” is the lower right-most character.

There are two things to consider:

* The ‘start’ coordinate may actually sort after the ‘end’
  coordinate (user selected from bottom of the window and upward)
* The scrollback wraparound.

What we do is calculate both the star and end coordinates’
scrollback-start relative row numbers. That is, the number of rows
from the beginning of the scrollback. So if the very first
row (i.e. the oldest) in the scrollback is selected, that has the
scrollback-start relative number “0”.

Then we loop from whichever (start or end coordinate) is highest up in
the scrollback, to the “other” coordinate.
2022-02-07 15:06:55 +01:00
Daniel Eklöf
0800515c04
grid: reflow: add TODO to detect selection on re-used rows, and cancel it 2022-02-07 15:06:55 +01:00
Daniel Eklöf
2e828248d0
selection: ensure start/end coordinates are bounded by the current grid
Closes #924
2022-02-07 15:06:39 +01:00
Craig Barnes
ff90781ebc tests: fix typo in error message 2022-02-07 12:32:23 +00:00
Daniel Eklöf
3baf7de3b8
Merge branch 'finalize-selection-on-window-resize'
Closes #922
2022-02-07 13:23:56 +01:00
Daniel Eklöf
09fd39bb29
changelog: mouse selections are finalized on window resize 2022-02-07 10:44:00 +01:00
Daniel Eklöf
003ea4904d
render: resize: add TODO: translate pivot coords 2022-02-07 10:42:32 +01:00
Daniel Eklöf
a187271ca4
render: resize: finalize selection before reflowing the grid
This fixes a crash caused by the selection’s pivot point not being
translated during reflow.

While we could simply reflow the pivot point as well, testing shows
irregular behavior with ongoing selections across window resizes, with
different compositors behaving differently.

For now, we simply finalize the selection, instead of trying to handle
ongoing selections.

Closes #922
2022-02-07 10:38:30 +01:00
Daniel Eklöf
b4027118e6
term: init: initialize selection pivot point coords to -1,-1
While this _shouldn’t_ be necessary (pivot points are only used while
a selection is ongoing). But it doesn’t hurt to initialize them
anyway.
2022-02-07 10:36:59 +01:00
Daniel Eklöf
1eef5a00e6
changelog: “(null)” being logged as font-name 2022-02-06 12:07:58 +01:00
Daniel Eklöf
b0e9ee2137
config: font->name may be NULL
If it is, fallback to the font pattern instead, like we used to do
before fcft-3.
2022-02-06 12:07:42 +01:00
Daniel Eklöf
87c0d857cf
changelog: missing ‘wayland_client’ dependency in test-config 2022-02-06 12:05:01 +01:00
Daniel Eklöf
203a09d533
meson: tests: config: add missing ‘wayland_client’ dependency
Closes #918
2022-02-06 12:02:42 +01:00