Commit graph

4716 commits

Author SHA1 Message Date
Daniel Eklöf
32bceaa786
Merge branch 'check-font-is-monospace'
Closes #704
2021-09-03 20:52:44 +02:00
Daniel Eklöf
73b488a2b2
config: codespell: setting has only two ‘t’ 2021-08-31 20:01:35 +02:00
Daniel Eklöf
e51e085d7a
changelog: check if primary font is monospaced 2021-08-31 19:58:35 +02:00
Daniel Eklöf
1233e000f0
server: verify primary font is monospaced
... unless we’re re-using the main conf as-is, in which case we will
already have done this (and the conf’s user-notification list will
already contain a warning).
2021-08-31 19:58:35 +02:00
Daniel Eklöf
8ffc556d44
main: verify primary font is monospaced at startup
Load a couple of ASCII glyphs and check if their advance widths
matches. If not, warn the user that the font is probably not
monospaced.

This can be disabled by setting tweak.font-monospace-warn=no.

Closes #704.
2021-08-31 19:58:35 +02:00
Daniel Eklöf
bb948d03e1
terminal: prefer the advance width of ‘M’ over that of a space
This makes some non-monospaced fonts more readable, allowing users to
read errors and warnings printed in the window.

Furthermore, fcft-3.0 will remove the space_advance member, so once we
upgrade, we’ll have to rasterize a glyph ourselves anyway.
2021-08-31 19:56:59 +02:00
Craig Barnes
f26251d3bd Merge branch 'csi-cleanup' 2021-08-30 21:35:06 +01:00
Daniel Eklöf
83c8eeb575
changelog: terminfo changes 2021-08-30 20:31:28 +02:00
Daniel Eklöf
fe0b348f89
pkgbuild: fix terminfo package install location 2021-08-30 20:20:37 +02:00
Daniel Eklöf
173bb805c2
pkgbuild: line-wrap meson configure command line 2021-08-30 20:20:12 +02:00
Daniel Eklöf
55433d7797
install: terminfo: pipe sed output to tic
Related to #700
2021-08-30 19:42:02 +02:00
Daniel Eklöf
051745d7b1
install: document how to manually pre-process the terminfo source file
Related to #700
2021-08-30 19:35:56 +02:00
Daniel Eklöf
cf767427d7
pkgbuild: fix terminfo removal 2021-08-30 19:33:22 +02:00
Daniel Eklöf
4e5c8fd1b0
Merge branch 'terminfo-no-custom-install-location'
Closes #695
2021-08-30 19:14:56 +02:00
Daniel Eklöf
9434066546
meson: terminfo install location now defaults to $datadir/terminfo
The meson command line option -Dcustom-terminfo-install-location has
been changed in the following ways:

* If unset, $datadir/terminfo is used, and TERMINFO is *not* exported
* If set, that value (relative to $prefix) is used, and TERMINFO *is*
exported.
* The special value ‘no’ is removed.

-Ddefault-terminfo now also changes the terminfo names generated when
-Dterminfo=enabled.

Furthermore, the documentation for the TERMINFO environment variable
has been removed from the foot.1 and footclient.1 man pages (but as
mentioned above, foot *will* still set it if
-Dcustom-terminfo-install-location has been used).

INSTALL.md has been updated to now recommend using ncurses’ terminfo
definitions, if available. But also to document the other
alternatives; installing the terminfo definitions in a custom
location, or installing them with a diferent name. It also describes
the general problem, and the disadvantages of each alternative (but
without going into too much depth).
2021-08-30 19:09:13 +02:00
Daniel Eklöf
ac30da7a01
spawn: don’t error out if we fail to chdir() 2021-08-30 17:55:36 +02:00
Daniel Eklöf
064121ee95
slave: log _which_ CWD we failed to change to 2021-08-30 17:55:16 +02:00
Craig Barnes
6bd151438f csi: various, minor code/formatting improvements 2021-08-30 07:40:03 +01:00
Daniel Eklöf
3990cd4392
ci: codespell: ignore ‘doas’ 2021-08-27 20:45:19 +02:00
Daniel Eklöf
fd78fa98b4
doc: how to pass TERMINFO through ‘doas’
See #692
2021-08-27 20:25:26 +02:00
Daniel Eklöf
341193a627
changelog: add new ‘unreleased’ section 2021-08-27 13:44:18 +02:00
Daniel Eklöf
55f1f4a30c
Merge branch 'releases/1.9' 2021-08-27 13:43:40 +02:00
Daniel Eklöf
fec5f8784b
meson/pkgbuild: bump version to 1.9.0 2021-08-27 13:32:21 +02:00
Daniel Eklöf
fd0236f323
changelog: prepare for 1.9.0 2021-08-27 13:32:21 +02:00
Daniel Eklöf
6e8da20ee2
doc: foot{,,client}: document TERMINFO
Closes #691
2021-08-27 13:31:15 +02:00
Daniel Eklöf
88b2808dcd
meson: run generate_version.sh in a C locale
Previously, only the date command inside the script was run with
LC_TIME=C.

But there’s no reason to be that conservative; we absolutely do not
want _anything_ in that script to generate locale dependent output.
2021-08-25 19:12:45 +02:00
Daniel Eklöf
b8226fa14c
Merge branch 'terminfo'
Closes #687
2021-08-19 19:34:34 +02:00
Daniel Eklöf
8a7264e905
slave: set TERMINFO instead of TERMINFO_DIRS
This seems to be slightly better supported than TERMINFO_DIRS. It also
simplifies our code, since it’s no longer an issue of whether to
append or not - we just set TERMINFO, and ignore whatever it was set
to before.

Also closes #687
2021-08-18 20:18:35 +02:00
Daniel Eklöf
ee68a3fe95
changelog: cursor.blink now works in GNOME 2021-08-18 20:18:00 +02:00
Daniel Eklöf
f4da46350e
Merge branch 'terminfo-dirs'
Closes #671
2021-08-17 21:24:11 +02:00
Daniel Eklöf
7639186865
terminfo: install to $datadir/foot/terminfo by default, append to TERMINFO_DIRS
As of 2021-07-31, ncurses ships its own version of foot’s terminfo.

Since:

* It doesn’t have the non-standard Sync,Tc,setrgbf,setrgbb
  capabilities.
* It doesn’t set hs,fsl,dsl (statusbar).
* We want to be able to update our termminfo without waiting for an
  ncurses release.
* Foot should be installable and usable on Linux systems that doesn’t
  have the latest ncurses.

we still want to ship our own version. We can however not install it
to the default terminfo location (e.g. /usr/share/terminfo), since it
will collide with the ncurses provided files.

Our options are to either rename our terminfo to something else, or to
keep the name, but install our terminfo files somewhere else.

The first option would be the easy one. However, I think it makes
sense to use the same name. For example, a user that SSH’s into a
remote system that does *not* have our own version installed,
but *does* have the ncurses one, will gracefully fall back to that
one, which is better than manually having to set
e.g. TERM=xterm-256color.

Now, if we want to use the same name, we need to install it somewhere
else. But where? And how do we ensure our version is preferred over
the ncurses one?

I opted to $datadir/foot/terminfo (e.g. /usr/share/foot/terminfo) by
default. It makes it namespaced to foot (i.e. we’re not introducing a
new “standard” terminfo location), thus guaranteeing it wont collide
with ncurses.

To enable applications to find it, we export TERMINFO_DIRS. This is a
list of *additional* directories to search for terminfo files. If it’s
already defined, we *append* to it.

The nice thing with this is, if there’s no terminfo in that
location (e.g. when you SSH into a remote), the default terminfo
location is *also* searched. But only *after* having searched through
TERMINFO_DIRS.

In short: our version is preferred, but the ncurses one (or an older
version of our terminfo package!) will be used if ours cannot be
found.

To enable packagers full control over the new behavior, the existing
meson command line options have been modified, and a new option added:

-Dterminfo=disabled|enabled|auto: *build* and *install* the terminfo
files.

-Dcustom-terminfo-install-location=<path>: *where* the terminfo files
are expected to be found.

This *needs* to be set *even* if -Dterminfo=disabled. For example, if
the packaging script builds and packages the terminfo files separate
from the regular foot build. The path is *relative to $prefix*, and
defaults to $datadir/foot/terminfo.

This is the value that will be appended to TERMINFO_DIRS. Note that
you can set it to ‘no’, in which case foot will *not* set/modify
TERMINFO_DIRS. Only do this if you don’t intend to package foot’s
terminfo files at all (i.e. you plan on using the ncurses ones only).

-Ddefault-terminfo=foot. Allows overriding the default TERM
value. This should only be changed if the target platform doesn’t
support terminfo files.

Closes #671
2021-08-17 21:04:30 +02:00
Daniel Eklöf
b4402a6aa5
term: check visual-focus, not kbd-focus when enabling/disabling cursor blink
term_cursor_blink_update() is called when the visual focus changes
state (i.e. when our top-level surface is activated de-activated).

Checking keyboard focus worked on Sway, but on e.g. GNOME, the order
in which keyboard focus and visual focus are updated is different, and
we ended up either making the cursor invisible, or visible, but not
blinking, when changing focus back to the window.

Closes #686
2021-08-17 18:31:42 +02:00
Daniel Eklöf
9d1de74795
Merge branch 'selection-modify-only-use-one-cell-bit' 2021-08-16 19:16:22 +02:00
Daniel Eklöf
636fea55f5
selection: modify: no need to check for NULL before calling free() 2021-08-16 19:15:52 +02:00
Daniel Eklöf
02fbd0bbce
selection: modify: convert ‘keep_selection’ bitmask from uint64_t to uint8_t 2021-08-16 19:15:52 +02:00
Daniel Eklöf
f0fd3b7578
selection: modify: replace reset_context() macro with a function 2021-08-16 19:15:52 +02:00
Daniel Eklöf
ae70596a50
selection: don’t require two cell attr bits for selection updating
When updating the selection (i.e when changing it - adding or removing
cells to the selection), we need to do two things:

* Unset the ‘selected’ bit on all cells that are no longer selected.
* Set the ‘selected’ bit on all cells that *are* selected.

Since it’s quite tricky to calculate the difference between the “old”
and “new” selection, this is done by first un-selecting the old
selection, and then selecting the new, updated selection. I.e. first
we clear the ‘selected’ bit from *all* cells, and then we re-set it on
those cells that are still selected.

This process also dirties the cells, to make sure they are
re-rendered (needed to reflect their new selected/un-selected status).

To avoid dirtying *all* previously selected, and newly selected cells,
we have used an algorithm that first runs a “pre-pass”, marking all
cells that *will* be selected as such. The un-select pass would then
skip (no dirty) cells that have been marked by the pre-pass. Finally,
the select pass would only dirty cells that have *not* been marked by
the pre-pass.

In short, we only dirty cells whose selection state have *changed*.

To do this, we used a second ‘selected’ bit in the cell attribute
struct.

Those bits are *scarce*.

This patch implements an alternative algorithm, that frees up one of
the two ‘selected’ bits.

This is done by lazy allocating a bitmask for the entire grid. The
pre-pass sets bits in the bitmask. Thus, after the pre-pass, the
bitmask has set bits for all cells that *will* be selected.

The un-select pass simply skips cells with a one-bit in the
bitmask. Cells without a one-bit in the bitmask are dirtied, and their
‘selected’ bit is cleared.

The select-pass doesn’t even have to look at the bitmask - if the cell
already has its ‘selected’ bit set, it does nothing. Otherwise it sets
it and dirties the cell.

The bitmask is implemented as an array of arrays of 64-bit
integers. Each outer element represents one row. These pointers are
calloc():ed before starting the pre-pass.

The pre-pass allocates the inner arrays on demand.

The unselect pass is designed to handle both the complete absence of a
bitmask, as well as row entries being NULL (both means the cell
is *not* pre-marked, and will thus be dirtied).
2021-08-16 19:15:41 +02:00
Daniel Eklöf
647bff22db
Merge branch 'tempus-themes' 2021-08-15 10:35:06 +02:00
Gadzhi Kharkharov
b202eb8444 add tempus themes
rebuild with cursor colors

rebuilt with commented selection colors

rebuild with commented cursor colors
2021-08-15 00:08:41 +03:00
Daniel Eklöf
3daafe9859
Merge branch 'terminfo-remove-keypad'
Closes #670
2021-08-14 21:11:21 +02:00
Daniel Eklöf
f204f09253
changelog: mention keypad application mode keys being removed 2021-08-14 21:10:47 +02:00
Daniel Eklöf
b40aefa50a
changelog: mention km/smm/rmm being removed 2021-08-14 21:08:32 +02:00
Daniel Eklöf
2ff8f59525
terminfo: remove keypad key caps (for keypad application mode)
The keypad application mode gated by private mode 1035. I.e. by
default, there _is_ no keypad application mode in foot.
2021-08-14 21:05:17 +02:00
Daniel Eklöf
572b7d0f96
terminfo: remove km/smm/rmm
By default, foot prefixes Alt-<key> combos with ESC, instead of
setting the 8:th “meta” bit. In this mode, smm/rmm has no effect.

This mode _can_ be disabled, by resetting private mode 1036. However,
the terminfo should reflect the terminal’s *default* behavior.
2021-08-14 21:05:06 +02:00
Daniel Eklöf
807a304306
Merge branch 'pt-or-px-scaling'
Closes #680
2021-08-14 13:00:45 +02:00
Daniel Eklöf
f6f8f2b35e
pt-or-px: heed the dpi-aware setting
Before this patch, pt-or-px values, like letter-spacing, were *always*
scaled using the current DPI value.

This is wrong; if the fonts are scaled using the output’s scaling
factor, then so should all other point values.

This also fixes an issue where e.g. letter-spacing would use one DPI
value at startup, but then when increasing/decreasing or resetting the
font size, would be re-calculated using a different DPI value, leading
to completely different spacing.

This happened when there were multiple monitors, with different DPI
values, and foot guessed the initial DPI value wrong. Normally, foot
would correct itself as soon as the window was mapped, and the
“correct” DPI value known. But if the fonts were scaled using the
scaling factor, it was possible that the font reload never happened.

This patch also updates the thickness calculation (for LIGHT and HEAVY
box drawing characters) to use the scaling factor when appropriate.

Closes #680
2021-08-13 17:38:56 +02:00
Craig Barnes
a37109e5f6 readme: change "32bpp" to "24bpp" in features list
This is somewhat ambiguous, but in a terminal context "True Color"
is usually synonymous with 24-bit RGB (as opposed to 32-bit RGBA).
2021-08-12 13:10:49 +01:00
Daniel Eklöf
7229ddd4ae
Merge branch 'sixel-left-most-column-overwritten' 2021-08-11 18:26:19 +02:00
Daniel Eklöf
41a8f2fc65
render: run the “overflowing glyphs” prepass *before* rendering sixels
This fixes an issue where the left-most column of a sixel was
“overwritten” by the cell content.

This patch also rewrites the prepass logic, to try to reduce the
number of loads performed.

The new logic loops each row from left to right, looking for dirty
cells. When a dirty cell is found, we first scan backwards, until we
find a non-overflowing cell. That cell is unaffected by the
overflowing cell we’re currently dealing with.

We can also stop as soon as we see a dirty cell, since that cell will
already have been dealt with.

Then, we scan forward, dirtying cells until we see a non-overflowing
cell. That first non-overflowing cell is also dirtied, but after that
we break.

The last loop, that scans forward, advances the same cell pointer used
in the outer loop.
2021-08-11 18:26:00 +02:00
Daniel Eklöf
2b14e28512
Merge branch 'uri-characters'
Closes #654
2021-08-11 18:24:25 +02:00