Commit graph

5714 commits

Author SHA1 Message Date
Craig Barnes
becdcd9bb7 completions: bash: complete option arguments for short options 2023-01-10 19:56:12 +00:00
Craig Barnes
8acc10b9d4 completions: bash: use "case" instead of long if/elif/else chain 2023-01-10 19:44:24 +00:00
Craig Barnes
7d28da5006 Use "command -v" instead of "which" in bash completion scripts
The former is a built-in command in bash, whereas the latter is an
external command and isn't always necessarily available.
2023-01-10 18:34:25 +00:00
Grigory Kirillov
a38b8d0222 doc: fix a typo 2023-01-08 00:55:01 +03:00
Craig Barnes
f19768e304 wayland: avoid passing NULL to log_msg() in wayl_reload_xcursor_theme()
This pointer ends up being passed to various printf-family functions,
where passing a NULL pointer for an "%s" format specifier invokes
undefined behaviour.
2023-01-06 23:43:51 +00:00
woojiq
c9465e4c5c
themes: add Onedark 2023-01-06 10:49:45 +01:00
Daniel Eklöf
63bef0dc8c
ci: drop gitlab CI
We’re no longer mirroring to gitlab.
2023-01-02 13:52:56 +01:00
Craig Barnes
1d3023ec5e changelog: amend terminfo names, in accordance with previous commit 2023-01-01 15:21:17 +00:00
Daniel Eklöf
88641005fe
terminfo: PD/PE -> PE/PS
Ncurses 2022-12-24 had the names wrong. It was corrected on
2022-12-29.
2023-01-01 15:21:05 +01:00
Daniel Eklöf
e7c1a93d29
terminfo: add entries for bracketed paste
Ncurses added these in 2022-12-24, but they have been used/supported
by vim since 2017.

* BE - Bracketed paste Enable
* BD - Bracketed paste Disable
* PE - Paste Enable (i.e. "begin")
* PD - Paste Disable (i.e. "end")
2023-01-01 15:07:02 +01:00
Daniel Eklöf
6259d59b4d
config: change default grapheme-width-method from wcswidth to double-width
The old default, wcswidth, simply calls wcswidth() on the grapheme
cluster. This was supposedly the implementation with the highest
application compatibility. Except we never even tried to measure
it. It was just assumed.

A lot of modern applications have better implementations. Let’s try to
push support for better emoji support by changing our default method
from wcswith to double-width.

While far from correct (it’s not based on the Unicode tables), the
‘double-width’ method produces accurate results anyway.

double-width is like wcswidth(), in that it adds together the
individual wcwidths of all codepoints in the grapheme cluster. But, it
limits the maximum width to 2.
2023-01-01 10:29:27 +01:00
Daniel Eklöf
9e4270cd48
themes: comment out selection-{foreground,background}
That is, mouse selections should default to inverse fg/bg
2022-12-26 11:03:17 +01:00
Daniel Eklöf
135d4478a1
themes: add ‘conf’ modeline 2022-12-26 10:59:37 +01:00
Daniel Eklöf
da7b393a03
themes: remove alpha
Alpha isn’t really part of the theme. Leave it up to the user to set
alpha.
2022-12-26 10:54:02 +01:00
argosatcore
6ebe5cf621
Add Deus theme.
New color palette based on: https://github.com/ajmwagar/vim-deus
2022-12-26 10:51:42 +01:00
Daniel Eklöf
4ee0b28b02
config: font-size-adjustment: don’t allow empty %-values (key=%) 2022-12-17 11:00:05 +01:00
Daniel Eklöf
7bf150c11a
config: value_to_pt_or_px(): don’t allow empty px values (key=px) 2022-12-17 11:00:05 +01:00
Daniel Eklöf
59018446fd
foot.ini: add font-size-adjustment 2022-12-17 11:00:05 +01:00
Daniel Eklöf
f6ca8c90e1
config: add ‘font-size-adjustment=N[px|%]’ option
This patch adds a new config option, font-size-adjustment.

It lets you configure how much the font size should be
incremented/decremented when zooming in or out (ctrl-+, ctrl+-).

Values can be specified in points, pixels or percent.

Closes #1188
2022-12-17 10:59:17 +01:00
Joakim Nohlgård
7bb5c80d04 main: Graceful fallback if user has configured an invalid locale 2022-12-16 08:38:37 +01:00
Daniel Eklöf
3b9aca6a3d
doc: foot-ctlseq: expand last column to fill screen in all tables 2022-12-14 12:20:52 +01:00
Daniel Eklöf
ccfb953bb0
slave: unsetenv() env vars that have been set to the empty string
That is, users can now *clear* environment variables by doing:

  [environment]
  VAR=””

Note that the quotes are required.

Closes #1225
2022-12-06 19:36:15 +01:00
Daniel Eklöf
646314469a
doc: foot.ini: add example, and mention string options can be quoted 2022-12-06 19:36:07 +01:00
Daniel Eklöf
57d9a7451f
foot.ini: use a quoted, empty string for “indicator-format”
We don’t allow empty values, but we do allow quoted, empty values.
2022-12-06 19:36:07 +01:00
Daniel Eklöf
051e862420
config: allow string values to be quoted
* Both double and single quotes are recognized. There’s no difference
  in how they are handled.
* The entire string must be quoted:
  - “a quoted string” - OK
  - quotes “in the middle” of a string - NOT ok
* Two escape characters are regonized:
  - Backslash
  - The quote character itself
2022-12-06 19:35:58 +01:00
Daniel Eklöf
1486c57bdb
doc: foot: add PWD to list of env vars set in child process 2022-12-04 19:49:02 +01:00
Daniel Eklöf
b43a41df6a
log: don’t default to syslog enabled
Initialize the global ‘do_syslog’ variable to false. This ensures any
log calls done before log_init() has been called (e.g. unit tests)
doesn’t syslog anything.

As a side effect, such log calls no longer open an implicit syslog
file descriptor; this is how this “bug” was found: valgrind detected
an unclosed file descriptor at exit.

Finally, completely disable syslogging if log-level is “none”.
2022-12-02 11:45:10 +01:00
Daniel Eklöf
76d494484f
url-mode: tag cells after snapshot:ing the grid
Before this patch, hyperlinked cells were tagged with the “URL”
attribute (thus instructing the renderer to draw an
underline) *before* the grid was snapshot.

When exiting URL mode, the cells were once again updated, this time
removing the URL attribute.

But what if an escape sequence had modified the grid _while we were in
URL mode_? Depending on the sequence, it could move cells around in
such a way, that when exiting URL mode, the affected cells weren’t
updated correctly. I.e. we left some cells with the URL attribute
still set.

The fix is simple: tag cells in the snapshot:ed grid only (which isn’t
affected by any escape sequence received while in URL mode). Not in
the *actual* grid (which _is_ affected).
2022-11-30 10:51:45 +01:00
Craig Barnes
1b24cf4fcb doc: ctlseq: add trailing space to fix XTGETTCAP entry in DCS table
Without the trailing space, both the sequence and the description
were getting packed into a single table column.
2022-11-24 20:34:41 +00:00
Daniel Eklöf
0fc8b65a2b
selection: selection_on_rows(): typo: row_start -> row_end
This fixes an issue where selections in the scroll margins were not
detected correctly. This meant they weren’t canceled as they should
have been, which in turn caused a visual glitch where text appeared to
be selected, but were in fact not.
2022-11-24 19:18:20 +01:00
Daniel Eklöf
4d03b6c611
Merge branch 'line-height-adjust'
Closes #1218
2022-11-24 19:17:09 +01:00
Daniel Eklöf
db2627ea26
changelog: scaling factor not being applied when converting px-to-pt 2022-11-24 17:21:53 +01:00
Daniel Eklöf
fa6b07abea
term: apply scale factor when converting a px value to pt 2022-11-24 17:20:05 +01:00
Daniel Eklöf
e85257bcae
term: initialize term->font_line_height when there’s no user-set line-height 2022-11-24 17:09:31 +01:00
Daniel Eklöf
94bac0513a
term: update user-set line-height just before calculating the cell dimensions
This ensures *all* font-size affecting changes (DPI, output scaling,
font size increment/decrement) also updates the line-height.
2022-11-24 14:34:31 +01:00
Daniel Eklöf
f31ea4f56d
changelog: line-height adjustment with user-set line-height 2022-11-23 16:29:42 +01:00
Daniel Eklöf
5a54423000
term: adjust user-set line-height by the same percentage as the primary font
Before this patch, a user-set line-height was increased/decreased by
the exact same amount of pt’s as the font(s).

This means, that when there’s a large discrepancy between the
line-height and the font size, the proportion between the line’s
height and the font size will change as we increase or decrease the
font size.

This patch changes how the line height is adjusted when the font size
is incremented or decremented. We calculate the difference, in
percent, between the primary font’s original (default) size, and its
current size, and then apply that to the configured line-height.

Closes #1218
2022-11-23 16:29:42 +01:00
Daniel Eklöf
dfabc5d754
readme/foot.1: mention that we now need “-d info” to get log output 2022-11-23 16:27:50 +01:00
Antoine Beaupré
b80c7f75fe
change default log level to WARNING
The default foot output looks like this, in Debian testing "bookworm"
at the time of writing:

    anarcat@angela:pubpaste$ foot true
    info: main.c:421: version: 1.13.1 +pgo +ime +graphemes -assertions
    info: main.c:428: arch: Linux x86_64/64-bit
    info: main.c:440: locale: fr_CA.UTF-8
    info: config.c:3003: loading configuration from /home/anarcat/.config/foot/foot.ini
    info: fcft.c:338: fcft: 3.1.5 +graphemes -runs +svg(nanosvg) -assertions
    info: fcft.c:377: fontconfig: 2.13.1, freetype: 2.12.1, harfbuzz: 5.2.0
    info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Regular.otf: size=8.00pt/8px, dpi=75.00
    info: wayland.c:1353: eDP-1: 2256x1504+0x0@60Hz 0x095F 13.32" scale=2 PPI=205x214 (physical) PPI=136x143 (logical), DPI=271.31
    info: wayland.c:1509: requesting SSD decorations
    info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Bold.otf: size=24.00pt/32px, dpi=96.00
    info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Regular.otf: size=24.00pt/32px, dpi=96.00
    info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Bold.otf: size=24.00pt/32px, dpi=96.00
    info: fcft.c:838: /home/anarcat/.local/share/fonts/Fira-4.202/otf/FiraMono-Regular.otf: size=24.00pt/32px, dpi=96.00
    info: terminal.c:700: cell width=19, height=39
    info: terminal.c:588: using 16 rendering threads
    info: wayland.c:859: using SSD decorations
    info: main.c:680: goodbye
    anarcat@angela:pubpaste$

That's 17 lines of output that are *mostly* useless for most use
cases. I might understand having this output during the project's
startup, when it's helpful for diagnostics, but now Foot just mostly
works everywhere, and I've never had a use for any of that stuff in
the (arguably short) time I've been using Foot so far.

And if I do, there's the `--log-level` commandline option to tweak
this. At first, I looked at tweaking the log level through the config
file. But as explained in this issue:

https://codeberg.org/dnkl/foot/issues/1142

... there's a chicken and egg problem there that makes it hard to
implement and possibly confusing for users as well.

There's also the possibility for users to change the shortcut with
which they start foot, for example a `.desktop` file so that menu
systems that support those start foot properly. But that only works in
that environment, and not through the so many things that will just
call `foot` and hope it will do the right thing.

In my case, I have `foot` hardcoded in a lot of places now, between
sway and waybar, and this is only going to grow. Others have suggested
adding the flag to a $TERMINAL global variable, but that won't help
.desktop users.

So, instead of playing whack-a-mole with the log levels, just make it
so that, by default, foot is silent. This is actually one of the
[basics of UNIX philosophy][1]:

> Rule of Silence: When a program has nothing surprising to say, it
> should say nothing.

And yes, I am aware I am severely violating that principle by writing
a way too long commit log for a one-line patch, but there you go, I
figured it was good to document the why of this properly.

[1]: https://web.archive.org/web/20031102053334/http://www.faqs.org/docs/artu/ch01s06.html
2022-11-22 10:22:22 -05:00
Daniel Eklöf
4d2b8a993f
Merge branch 'fp-calc-dpi'
Closes #1209
2022-11-22 09:34:53 +01:00
Daniel Eklöf
42c6af0914
wayland: force monitor DPI to 96 when it’s unreasonably high
If an output has a bogus physical width or height, the DPI can become
so high that the cell width/height is too large for
pixman_image_fill_rectangles(), resulting in a crash in pixman_fill().

Since it doesn’t make any sense to use a DPI that is obviously bogus,
don’t. Force it 96 instead.
2022-11-04 17:49:01 +01:00
Daniel Eklöf
2910ca354c
wayland: use fp math all the way when calculating DPI
This fixes an FPE when the monitor’s physical width/height is so small
that the conversion from mm to inch resulted in inches being zero.
2022-11-04 17:42:52 +01:00
Soren A D
fa9beae3a6
added modus themes 2022-11-02 19:11:12 +01:00
Craig Barnes
8f2bda6703 wayland: use BUG() instead of xassert(false)
The latter will expand to the former anyway, so we may as well provide
an explicit error message instead of "assertion failed: 'false'".
2022-11-01 21:04:22 +00:00
Daniel Eklöf
30d088376c
render: maybe_resize(): remove debug assert
This, depending on which compiler being used, caused issues not only
in debug builds, but release builds as well (with NDEBUG defined).
2022-11-01 17:12:16 +01:00
Daniel Eklöf
2c2a39317b
render: never apply alpha to text color
When drawing a block cursor using inversed fg/bg colors, we didn’t
strip the alpha from the background color. This meant that the text
"behind" the cursor was rendered with transparency. If alpha was set
to 0, the text was completely invisible.

We should never apply alpha to the text color. So, detect this, and
force alpha to 1.0.

Normally, when selecting the cursor’s color, we don’t really know
_where_ the background color is coming from (or more accurately,
_what_ it is).

However, the *only* background color that can have a non-1.0 alpha is
the *default* background color.

This is why we can ignore the bg parameter, and use term->colors.fg/bg
instead.

Closes #1205
2022-10-30 19:43:18 +01:00
Andrea Pappacoda
49fa751953
chore: use MIT license for appstream metadata
The Appstream metadata file introduced in commit
335612cfa4
has been submitted as licensed under the CC0-1.0 license. People
generally use the CC0-1.0 to put the file in the "public domain", but
this isn't actually possible in lots of countries, so the file ends up
being licensed under CC0's fallback permissive license; unfortunately,
the fallback license contains some terms that are seen as problematic to
some (notably, Fedora has recently decided to consider the license
pretty much non-free).

As foot is already MIT-licensed, and since this license is in the list
of allowed [metadata licenses], this patch changes the license of the
metadata file from CC0-1.0 to MIT.

[metadata licenses]: https://freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-metadata_license
2022-10-27 13:58:52 +02:00
Andrea Pappacoda
1313e6352a
build: fix GCC detection in pgo.sh
On my system, GCC doesn't output its name when passing the --version
flag:

    $ cc --version
    cc (Debian 12.2.0-3) 12.2.0
    Copyright (C) 2022 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

As the Free Software Foundation is unlikely to write another compiler, I
think that searching for the foundation's name instead of GCC is a good
enough fix (and I'm almost sure we wouldn't be the first ones to do so).
2022-10-23 23:56:34 +02:00
Daniel Eklöf
59c9dfe109
render: resize: do full text reflow immediately if resize-delay-ms == 0
That is, skip all custom grid handling when doing an interactive
resize, if resize-delay-ms == 0.
2022-10-23 10:34:18 +02:00
Daniel Eklöf
3ba03901b8
pgo: don’t re-use the rows between the ‘normal’ and ‘alt’ grids
This used to work because we never free:d any of the rows. Now
however, we do free (some of) them when reverse scrolling. This means
we can no longer re-use the rows between the two screens.

Closes #1196
2022-10-18 18:31:18 +02:00