Commit graph

704 commits

Author SHA1 Message Date
Daniel Eklöf
5ce48a6574
changelog: url.uri-characters 2021-08-09 19:58:40 +02:00
Daniel Eklöf
c2cc964116
input: implement support for mouse wheel left/right
We now emit button 6/7 events (when the client application grabs the
mouse). This buttons map to mouse wheel horizontal scroll events. Or, left/right
tilting, if you like.

Wayland report these as ‘axis’ events (just like regular scroll wheel events),
and thus we need to translate those scroll events to button events.

libinput does not define any mouse buttons for wheel tilts, so we add our own
defitions. These are added last in the BTN_* range, just before the BTN_JOYSTICK
events.
2021-08-07 12:27:44 +02:00
Daniel Eklöf
7a372a8c23
Revert "terminfo: add ich1=\E[@"
This reverts commit 76fab8cf69.

See https://codeberg.org/dnkl/foot/issues/668#issuecomment-246149
2021-08-07 12:25:42 +02:00
Daniel Eklöf
159ae6cb95
terminfo: change kmous to \E[<, add XM+xm capabilities
ncurses has had a bug where mouse support is completely disabled if the terminfo
didn’t have kmous=\E[M, *or*, the terminfo *name* contained ‘xterm’.

This appears to have been fixed.

Thus, change kmous to \E[<, and set xm/XM accordingly. With this, ncurses
application will use the SGR mouse reporting mode, instead of the legacy
reporting mode.
2021-08-06 22:34:47 +02:00
Daniel Eklöf
76fab8cf69
terminfo: add ich1=\E[@ 2021-08-06 22:33:56 +02:00
Daniel Eklöf
1c43fdbea4
box-drawing: add U+1FB3C-U+1FB6F, U+1FB9A and U+1FB9B
These are the “wedges” from the Unicode 13 “Legacy Computing” symbols.

Closes #474
2021-08-05 18:25:01 +02:00
Daniel Eklöf
f1d440e139
term: send SIGTERM/SIGKILL to the entire process group 2021-07-31 22:50:19 +02:00
Daniel Eklöf
98e8778e41
changelog: asynchronous client application termination 2021-07-31 20:13:52 +02:00
Daniel Eklöf
02f0e0d912
config: include: add support for ~-expansion
Closes #659
2021-07-30 14:57:28 +02:00
David Rosca
2c5a23867f
Only brighten palette colors with bold-text-in-bright=palette-based 2021-07-26 19:13:46 +02:00
Daniel Eklöf
be24bd2d32
changelog: initialize output scaling factor to 1 2021-07-26 19:00:56 +02:00
Daniel Eklöf
bcd28311f4
wayland: prevent hang when terminating due to broken Wayland connection
If the call to fdm_wayl() with EPOLLHUP was followed by calls to
wayl_roundtrip(), foot would hang.

The reason for this is that the EPOLLHUP handler in fdm_wayl() would
call wl_display_cancel_read().

wayl_roundtrip() also calls wl_display_cancel_read() (since we
normally have called wl_display_prepare_read()), before calling
wl_display_roundtrip().

When calling wl_display_cancel_read() two times in a row, without a
wl_display_prepare_read() in between, wl_display_roundtrip() hangs.

Fix by not calling wl_display_cancel_read() in fdm_wayl(). This
ensures our invariant holds: wl_display_prepare_read() is *always* in
effect outside of fdm_wayl().

Closes #651
2021-07-24 20:38:56 +02:00
Daniel Eklöf
7c686208a1
meson: add -Ddocs=disabled|enabled|auto command line option
When enabled (the default, if scdoc is found), we build and install
the man pages, example foot.ini, readme, changelog and license files.
2021-07-24 13:12:10 +02:00
Daniel Eklöf
9985b8c713
changelog: window title in CSDs 2021-07-24 11:02:43 +02:00
Daniel Eklöf
251545203b
search: reset match state when selection is cancelled
While we’re in scrollback search mode, the selection may be
cancelled (for example, if the application is scrolling out the
selected text). Trying to e.g. extend the search selection after this
has happened triggered a crash.

This fixes it by simply resetting the search match state when the
selection is cancelled.

Closes #644
2021-07-22 17:57:43 +02:00
Daniel Eklöf
2acd4b34c5
pgo: fix PGO builds with clang
Add stubs for shm_chain_new(), shm_chain_free() and shm_unref(). This
fixes ‘pgo’ linking failures in the ‘generate’ phase when doing a PGO
build with clang.

Closes #642
2021-07-22 10:02:52 +02:00
Timur Celik
a410734f96 render: prevent cells from overflowing into margin 2021-07-20 11:44:27 +02:00
Daniel Eklöf
4a50abece3
changelog: add new ‘unreleased’ section 2021-07-18 18:07:26 +02:00
Daniel Eklöf
721174ffea
changelog: prepare for 1.8.2 2021-07-18 17:57:42 +02:00
Daniel Eklöf
318385040c
changelog: remove entries that are no longer relevant
The tweak.allow-overflowing-double-width-glyphs option have been
superseded by tweak.overflowing-glyphs.
2021-07-18 17:16:17 +02:00
Daniel Eklöf
e8e9cd5595
term: erase_scrollback(): destroy sixels that touch the scrollback 2021-07-18 16:31:33 +02:00
Daniel Eklöf
7d8884fec4
changelog: crash when \E[3J was executed with a selection in the scrollback 2021-07-18 16:14:25 +02:00
Timur Celik
91801ae55d render: Allow cells to bleed into their neighbor
This patch adds a `confined` flag to each cell to track if the last
rendered glyph bled into it's right neighbor.  To keep things simple,
bleeding into any other neighbor cell than the immediate right one is
not allowed.  This should cover most use cases.

Before rendering a row we now do a prepass and mark all cells unclean
that are affected by a bleeding neighbor.  If there are consecutive
bleeding cells, the whole group must be re-rendered even if only a
single cell has changed.

The patch also deprecates both old overflowing glyph options
*allow-overflowing-double-width-glyphs* and *pua-double-width* in favor
of a single new one named *overflowing-glyphs*.
2021-07-17 13:22:44 +02:00
Daniel Eklöf
9211ee694c
Merge branch 'decsdm'
Closes #631
2021-07-16 17:33:30 +02:00
Daniel Eklöf
31fad58465
url-mode: use shm_get_many()
If we have lots of URLs, we use up a *lot* of SHM buffers (and thus
pools). Each and every one is a single mmap(), of at least 4K.

Since all URL labels are created and destroyed at the same time, it
makes sense to use a single pool for all buffers.

To do this, we must now do two passes; first one to generate the
actual string (label content), and to calculate the label sizes.

Then we use this information to allocate all SHM buffers at once, from
the same pool.

Finally, we iterate the URLs again, this time to actually render them.
2021-07-15 18:39:41 +02:00
Daniel Eklöf
5e64c67c25
render: search: set clip region
Fixes crash when the search box has been reduced in height, due to
limited window space.
2021-07-15 18:27:10 +02:00
Daniel Eklöf
628fd39098
render: scrollback indicator: improve handling of very small window sizes 2021-07-15 18:26:26 +02:00
Daniel Eklöf
654e65631d
changelog: box-drawing fixes on big-endian 2021-07-14 19:48:13 +02:00
Daniel Eklöf
fcd9897342
csi: invert the meaning of DECSDM
There has been some confusion whether enabling DECSDM (private mode
80) enables or disables sixel scrolling.

Foot currently enables scrolling when DECSDM is set, and this patch
changes this, such that setting DECSDM now *disables* scrolling.

The confusion is apparently due to a documentation error in the VT340
manual, as described in
https://github.com/dankamongmen/notcurses/issues/1782#issuecomment-863603641.

And that makes sense, in a way: the SDM in DECSDM stands for Sixel
Display Mode. I.e. it stands to reason that enabling that disables
scrolling.

Anyway, this lead to https://github.com/hackerb9/lsix/issues/41, where
it was eventually proven (by testing on a real VT340), that foot, and
a large number of other terminals (including XTerm) has it wrong:
https://github.com/hackerb9/lsix/issues/41#issuecomment-873269599.
2021-07-14 19:17:44 +02:00
Daniel Eklöf
f030c87ee6
url-mode: abort when running into un-allocated scrollback memory
When tagging URL cells (in preparation for rendering URL mode), we
loop the URL’s entire range, setting the `url` attribute of all cells,
and dirtying the rows.

It is possible to create URLs that are invalid, and wrap around the
scrollback, even though the scrollback hasn’t yet been filled. For
example, by starting an OSC-8 URL, moving the cursor, and then closing
the OSC-8 URL.

These URLs are invalid, but are still rendered just fine. “Fine” being
relative - they will typically fill the entire screen. But at least
that’s a very clear indication for the user that’s something is wrong.

The problem is when we hit un-allocated scrollback rows. We didn’t
check for NULL rows, and crashed.

This has now been fixed.
2021-07-11 11:31:11 +02:00
Daniel Eklöf
cf6d04f9f2
url-mode: fix crash when removing duplicate and/or overlapping URLs
Removing overlaping and duplicated URLs is done by running two nested
loops, that both iterate the same URL list.

When a duplicate is found, one of the URLs is destroyed and removed
from the list.

Deleting and removing an item *is* safe, but only as long as _no
other_ iterator has references to it.

In this case, if we remove an item from e.g. the inner iterator, we’ll
crash if the outer iterator’s *next* item is the item being removed.

Closes #627
2021-07-11 10:06:12 +02:00
Daniel Eklöf
0a6e7e6167
url-mode: purge SHM pixmaps when destroying URLs
Unlike other surface types, the SHM cookie depends on the address of
each URL instance. This means if we enable, disable, and then enable
URL mode again (thus showing exactly the same URLs as the first time),
the URLs will have new addresses, and thus the old SHM pixmaps will
not get purged automatically.

So, manually purge them when destroying the URLs.
2021-07-11 09:59:17 +02:00
Daniel Eklöf
fcb60abc13
config: add locked-title=no|yes
Closes #386
2021-07-04 17:59:40 +02:00
Daniel Eklöf
07652d3b9e
term: rows printed to now defaults to having a hard linebreak
That is, instead of requiring a ‘\n’ to be printed, non-empty lines
are now treated as having a hard linebreak by default.

The linebreak is cleared on an explicit wrap.
2021-07-03 18:05:45 +02:00
Daniel Eklöf
396a5ff79b
allow-overflowing-double-width-glyphs: take glyph offset into account
A narrow, but offset:ed glyph should still be considered double
width.

This patch also fixes a crash, when the maybe-double width glyph is in
the last column. This is a regression.
2021-07-02 16:31:14 +02:00
Daniel Eklöf
4e8db9d8b6
changelog: s/from/in 2021-07-01 20:44:53 +02:00
Daniel Eklöf
ea39496f30
changelog: add new ‘unreleased’ section 2021-07-01 20:19:28 +02:00
Daniel Eklöf
7112f24671
changelog: prepare for 1.8.1 2021-07-01 20:14:20 +02:00
Daniel Eklöf
ab8f9afa90
changelog: move grapheme cluster width entry to ‘changed’, and rewrite it 2021-07-01 20:13:03 +02:00
Daniel Eklöf
5138f02214
config: rename at-most-2 (value for grapheme-width-method) to double-width 2021-07-01 08:00:23 +02:00
Daniel Eklöf
9817e44c32
config: add tweak.grapheme-width-method=wcswidth|at-most-2 2021-07-01 07:58:06 +02:00
Daniel Eklöf
149c52bd44
config: remove replaced/removed key bindings, instead of marking as ‘unused’
Instead of keeping removed/replaced key bindings in the key binding
array (marked as ‘unused’), remove them, by compacting the array.

The invariant is thus that there should be *no* entries in the key
binding list with the `BIND_ACTION_NONE` for action.

Add code to debug builds that verifies this, plus a unit test.

Closes #614
2021-06-30 18:05:07 +02:00
Craig Barnes
3e74482d6c terminfo: add Tc, setrgbf and setrgbb capabilities
These extensions are used by tmux and neovim, in order to make use
of 24-bit colors without facing the problems that plague the `RGB`
capability.

This should allow 24-bit colors to work "out of the box" in tmux,
without the usual workaround of adding:

    set-option -ga terminal-overrides ",foot*:Tc"

...to ~/.tmux.conf.

See also:

* 18fe2e8dfa (commitcomment-31373962)
* f83c25942d/runtime/doc/term.txt (L123-L139)
* b1a8c0fe02/CHANGES (L988-L989)

Closes #615
2021-06-29 08:55:53 +01:00
Craig Barnes
5dca0458a0 log: add LOG_CLASS_NONE and use as initializer for log_level
This means that logging will be completely disabled until log_init()
has been called, which is useful to prevent log spam when running
UNITTEST{} blocks in debug builds.

Note that this doesn't change the default log level at runtime, which
was already being set to LOG_CLASS_INFO in main.c and client.c.

The new log level is also exposed to the command-line interface as
`--log-level=none`, which allows disabling logging entirely.
2021-06-26 22:15:09 +01:00
Daniel Eklöf
0ff8f72a9d
vt: don’t reset utf8proc grapheme state when we’re not at a grapheme break 2021-06-25 20:42:23 +02:00
Daniel Eklöf
2535cf51db
changelog: add new ‘unreleased’ section 2021-06-25 08:44:41 +02:00
Daniel Eklöf
8df5f90474
changelog: prepare for 1.8.0 2021-06-25 08:23:36 +02:00
Daniel Eklöf
07128ee905
changelog: spelling; add missing ‘l’ in ‘experimental’ 2021-06-24 22:55:28 +02:00
Daniel Eklöf
cf101ea300
changelog: describe what (does not) happens when grapheme-shaping=no 2021-06-24 17:36:57 +02:00
Daniel Eklöf
d5d57c1b20
changelog: composed -> combining 2021-06-24 17:36:52 +02:00