Commit graph

6003 commits

Author SHA1 Message Date
Daniel Eklöf
7d126ff414
changelog: fixed font baseline calculation 2023-10-10 10:55:26 +02:00
Daniel Eklöf
41932287cf
Revert "font baseline: use max(font->height, font->ascent + font->descent) when calculating font height"
This reverts commit fd813d0e6c.

The intent of the reverted commit was to align font height calculation
with cell height calculation. However, it turns out this breaks some
fonts. Typically those with large:ish differences in their 'height'
attribute, and their ascent+descent value.

Closes #1511
2023-10-10 10:52:35 +02:00
Daniel Eklöf
4cf2c45baa
render: better description of why we disable transparency in fullscreen 2023-10-10 09:27:00 +02:00
Daniel Eklöf
5c58fc2a28
Merge branch 'visual-bell-remastered'
Closes #1337
2023-10-10 08:15:11 +02:00
Daniel Eklöf
af0feed3e5
changelog: fix issue number for visual bell
1508 refers to the pull request, not the feature request.
2023-10-10 08:14:43 +02:00
Daniel Eklöf
ce64da2fe1
doc: foot.ini.5: move flash{,-alpha} to the bottom of the 'colors' section 2023-10-10 08:13:35 +02:00
Daniel Eklöf
0c6a3731c3
doc: foot.ini.5: flash_alpha -> flash-alpha 2023-10-10 08:13:35 +02:00
Daniel Eklöf
9cf22df784
foot.ini: flash_alpha -> flash-alpha 2023-10-10 08:13:35 +02:00
Daniel Eklöf
eea995637d
term: remove unneeded (and mostly unused) term->flash{,_alpha} 2023-10-10 08:13:35 +02:00
Daniel Eklöf
8a2a450778
doc: foot.ini: flash: tweak grammar, use consistent formatting 2023-10-10 08:13:35 +02:00
Raimund Sacherer
8273962372
Enable the use of flash as visual bell
With this patch we can configure flash in the bell section. The colors
section allow now to configure the color and translucency of the
flash.
2023-10-10 08:12:48 +02:00
Daniel Eklöf
c50b1f9900
render: more fine-grained wayland surface damage tracking
Before this patch. Wayland surface damage tracking was done on a
per-row basis. That is, even if just one cell was updated, the entire
row was "damaged".

Now, damage is per cell. This hopefully results in lower latencies in
many use cases, and especially on high DPI monitors.
2023-10-10 07:56:27 +02:00
Daniel Eklöf
1c9d98d57e
config: log_contextual_errno(): sync with log_contextual()
... in terms of whether to print section/value separators
2023-10-08 16:52:21 +02:00
Daniel Eklöf
e41555fe0f
shm: move definition of FOOT_MFD_FLAGS to the top 2023-10-08 11:03:13 +02:00
Daniel Eklöf
e36d95a4c8
Merge branch 'search-extend-selection' 2023-10-08 10:58:33 +02:00
Daniel Eklöf
6970055dca
changelog: add the remaining scrollback-up/down bindings 2023-10-08 10:39:57 +02:00
Daniel Eklöf
3e67415e3e
config: add remaining search.scrollback key bindings
All scrollback up/down key bindings are now available in search mode.
2023-10-08 10:38:39 +02:00
Daniel Eklöf
a772179b6c
search: fix mixup in search_extend_find_line()
The has_wrapped_around_{right,left} functions were mixed up, causing
false positives and false negatives, resulting in bad search matches.

Also make all search_extend_find* functions return a boolean; false
means no change in the selection. In this case, we can skip trying to
extend the selection, and updating the UI.
2023-10-08 10:38:39 +02:00
Daniel Eklöf
6a708b35ee
foot.ini: document all the new search.extend* bindings 2023-10-08 10:38:39 +02:00
Daniel Eklöf
419f0be441
config: map ctrl+shift+right to extend-to-word-boundary 2023-10-08 10:38:39 +02:00
Daniel Eklöf
ca128ae380
selection: find_word_boundary: ensure row number is bounded 2023-10-08 10:38:39 +02:00
Daniel Eklöf
ddf4eb3b78
search: don't try to extend a search match when there is none 2023-10-08 10:38:39 +02:00
Daniel Eklöf
5e013cad78
selection: selection_update() uses view-local coordinates 2023-10-08 10:38:38 +02:00
Daniel Eklöf
78665a7e80
search: add more key bindings to extend the current match
This patch adds the following new search key bindings:

* extend-char (shift+right)
* extend-line-down (shift+down)
* extend-backward-char (shift+left)
* extend-backward-to-word-boundary (ctrl+shift+left)
* extend-backward-to-next-whitespace (ctrl+shift+alt+left)
* extend-line-up (shift+up)

They can be used to extend the search match (i.e. the selection).

This patch also adds an initial set of key bindings to scroll in the
scrollback history:

* scrollback-up-page
* scrollback-down-page

These work just like the key bindings for the normal mode. Also note
that it was already possible to scroll using the mouse.

This patch also fixes a couple of search mode bugs:

* crashing when a search match ends in the last column
* grapheme clusters not being matched correctly
* Search match not being "extendable" after a pointer leave event
* A few others, related to either large matches, or extending matches
  after moving the viewport.

There are still a couple of (known) issues:

* A search match isn't correctly highlighted if its *starting* point
  is outside the viewport.
* Extending the match to end of the scrollback (i.e. the most recent
  output) is simply buggy.

Related to #419
2023-10-08 10:38:37 +02:00
Daniel Eklöf
56d5d4cc21
render: disable transparency in margins when in fullscreen
This amends 899b768b74, where we started
disabling transparency in fullscreen

Closes #1503
2023-10-07 07:58:55 +02:00
6t8k
61eb56dfda
shm: if defined, set MFD_NOEXEC_SEAL flag for memfd_create
Effective from Linux 6.3.0 onward, this creates the memfd without
execute permissions and prevents that setting from ever being changed.

This is a defense-in-depth security measure and prevents a respective
kernel warning from being emitted.

See https://lwn.net/Articles/918106/ for more information.
2023-10-05 12:33:05 +02:00
Daniel Eklöf
33a5a369f2
term_reset: log hard vs. soft reset 2023-10-04 08:23:27 +02:00
Daniel Eklöf
5e1d73f3cd
Codespell fixes 2023-10-03 14:12:58 +02:00
Daniel Eklöf
58d967b2f3
Codespell fixes 2023-10-03 14:11:55 +02:00
Daniel Eklöf
883368572f
wayland: debug: log wm-capabilities as human-readable strings 2023-10-02 16:34:54 +02:00
Daniel Eklöf
b95a7cb84f
term: get_font_dpi(): don't crash when there aren't any available monitors
Seen on plasma; monitor is turned off, and then back on again. Before
the "new" output global is emitted, the compositor calls
fractional_scale::preferred_scale().

This results in a call to get_font_dpi(), where we crash, since it
assumes there is at least one monitor available.

Fix by falling back to a DPI of 96.

Hopefully closes #1498
2023-10-01 09:20:13 +02:00
Alyssa Ross
400a3f5ad2
config: apply overrides even if there's no file
Previously, foot -a test wouldn't actually set the app ID if there was
no config file and the defaults were used, which was very
counterintuitive.

Now, load_config() will carry on until the end, even if there's no
config file, so overrides still work.
2023-09-25 18:15:46 +02:00
Daniel Eklöf
7fcbca808b
csi: decrqm: 2027: permanently disabled when grapheme-width-method != double-width 2023-09-25 16:50:50 +02:00
Daniel Eklöf
4eef001d58
csi: implement DECSET/DECRST/DECRQM 2027 - grapheme cluster processing
This implements private mode 2027 - grapheme cluster processing, as
defined in the "Terminal Unicode Core"[1] specification.

Internally, we just flip the already existing option "grapheme
shaping". Since it's now runtime changeable, we need a copy of it in
the terminal struct, rather than referencing the conf object.

[1]: 13fc5a8993/spec/terminal-unicode-core.tex (L50-L53)
2023-09-25 16:50:44 +02:00
Daniel Eklöf
8a5f2915e9
dcs: xtgettcap: ignore queries with invalid hex encodings
When we receive an XTGETTCAP query, where the capability is not
correctly hex encoded, ignore it.

Before this patch, we echo:ed it back to the TTY inside an error
resonse.
2023-09-25 16:37:32 +02:00
Daniel Eklöf
54722369d8
url-mode: don't strip the file:// prefix from localhost URIs
Before this patch, the file://<host> prefix was stripped from URIs,
when the hostname matched the current host (that is, for "local"
URLs).

Unfortunately, the way this was done caused other parts of the URI to
be stripped as well. For example, the 'query' and 'fragment' parts.

This patch simply removes all special casing of file:// URIs.

Since the URL is passed to a generic opener (i.e. we don't have a
special opener application for file:// URIs), the opener helper must
handle the file:// prefix anyway.

Closes #1474
2023-09-21 18:32:57 +02:00
Daniel Eklöf
b2963bbf80
changelog: crash when xdg token is set, but compositor does not support activation 2023-09-21 18:31:46 +02:00
Alyssa Ross
9257273d84
wayland: check activation supported before activating
It's possible for token to be set when the compositor doesn't support
activation, and this caused a segfault.  For example, this can happen
when overriding WAYLAND_DISPLAY to point to a compositor that doesn't
support activation, in a terminal running under one that does, and so
has set XDG_ACTIVATION_TOKEN.
2023-09-21 06:59:48 +00:00
Sertonix
a4843ef418 doc: keybings default none 2023-09-20 13:20:48 +00:00
Daniel Eklöf
1719ff93a7
selection: add support for selecting the contents of a quote
This patch changes the default of triple clicking, from selecting the
current logical row, to first trying to select the contents of the
quote under the cursor, and if failing to find a quote, selecting the
current row (like before).

This is implemented by adding a new key binding, 'select-quote'.

It will search for surrounding quote characters, and if one is found
on each side of the cursor, the quote is selected. If not, the entire
row is selected instead.

Subsequent selection operations will behave as if the selection is
either a word selection (a quote was found), or a row selection (no
quote found).

Escaped quote characters are not supported: "foo \" bar" will match
'foo \', and not 'foo " bar'.

Mismatched quotes are not custom handled. They will simply not match.

Nested quotes ("123 'abc def' 456") are supported.

Closes #1364
2023-09-19 16:23:34 +02:00
Daniel Eklöf
fe7aa25ad8
input: make wheel events mappable
Un-grabbed wheel events are now passed through the mouse binding
matching logic, instead of being hardcoded to scrolling the terminal
contents.

They are mappable through the BTN_BACK and BTN_FORWARD buttons.

Since they're not actually button *presses*, they never generate a
click count other than 1. This limitation is documented, but not
checked in the config. This means it's possible to create bindings
like "BTN_BACK+3" (i.e. triple "click"). They will however never
trigger.

The old, hardcoded logic is now accessible through the new
scrollback-up-mouse and scrollback-down-mouse mouse
bindings. They (obiously) default to BTN_BACK and BTN_FORWARD,
respectively.

Example usage: keep the default of scrolling terminal contents with
the wheel, when used without modifiers, but map Control+wheel to font
zoom in/out:

  [mouse-bindings]
  font-increase=Control+BTN_FORWARD
  font-decrease=Control+BTN_BACK

(this also keeps the default key bindings to zoom in/out; ctrl-+ and
ctrl+-)

Closes #1077
2023-09-18 16:36:39 +02:00
CismonX
f0f0d02bf7
input: improve touch handling on pointer presense
No longer inhibits touch event handling when terminal window
has pointer focus.  Instead, inhibit touch event when at least
one pointer button is held down.

This change improves user experience when using foot with both
a mouse and a touchscreen.

Closes #1428.
2023-08-24 00:45:20 +08:00
Daniel Eklöf
4f3f614457
url-mode: handle wide chars and grapheme clusters when auto-detecting URLs
* Skip spacer cells. This fixes an issue where characters following a
  double-width character weren't detect properly.

* Unpack grapheme clusters (i.e. cells with multiple codepoints), and
  iterate all their codepoints.

Closes #1465
2023-08-21 16:26:18 +02:00
raggedmyth
482a032d1a
add panda theme 2023-08-19 08:03:54 +02:00
Daniel Eklöf
86ef638102
term: improve fallback logic when selecting scaling factor while unmapped
The foot window may, for various reasons, become completely
unmapped (that is, being removed from all outputs) at run time.

One example is wlroots based compositors; they unmap all other windows
when an opaque window is fullscreened.

21d99f8dce introduced a regression,
where instead of picking the scaling factor from one of the available
outputs (at random), we started falling back to '1' as soon as we were
unmapped.

This patch restores the original logic, but also improves upon it.

As soon as a scaling factor has been assigned to the window, we store
a copy of it in the term struct ('scale_before_unmap').

When unmapped, we check if it has a valid value (the only time it
doesn't is before the initial map). If so, we use it.

Only if it hasn't been set do we fall back to picking an output at
random, and using its scaling factor.

Closes #1464
2023-08-18 16:48:18 +02:00
Daniel Eklöf
50a28fe1e8
ci: replace 'pipeline' with 'steps'
Hopefully fixes:

  failed to parse pipeline: "pipeline:" got removed, use "steps:" instead
2023-08-18 16:46:09 +02:00
Daniel Eklöf
95bce2b20c
Merge branch 'systemd-service-ordering'
Closes #1436
2023-08-11 16:41:11 +02:00
Max Gautier
f1075377d3
changelog: systemd units in GNOME 2023-08-10 11:38:08 +02:00
Max Gautier
be4797d619
systemd: skip foot-server.service when not in a Wayland context 2023-08-10 11:29:08 +02:00
Max Gautier
14ea4322fe
Order the systemd services after graphical-session.target
This fixes services in Wayland session where WAYLAND_DISPLAY is only
imported into the systemd user instance environment after
graphical-session.target is reached (such as GNOME).
2023-08-10 11:29:06 +02:00