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.
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.
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
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
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
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*.
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.
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.
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.
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
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.
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.
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.
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
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
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.