Commit graph

3124 commits

Author SHA1 Message Date
Daniel Eklöf
9c7cded616
keymap: fix alt+return combos
All alt+return combos mapped to the same escape sequence as alt+return
itself.

With this patch, alt+<mod(s)>+return map to a standard ‘CSI 27;x;13~’
sequence.
2020-12-01 19:41:33 +01:00
Daniel Eklöf
3a3616af96
keymap: use same lookup table for Tab and ISO_Left_Tab
With XKB, Shift+Tab maps to XKB_KEY_ISO_Left_Tab, not
XKB_Key_Tab. Previously, we had two different lookup tables for the
two.

The tab table was correctly populated, while the ISO-left tab
wasn’t. As a result, all Shift+Tab combos (except Shift+Tab itself)
was wrong, and resulted in the same escape sequence as Shift+Tab.

Fix by using the same table for both tab and ISO-left tab.

Closes #210
2020-12-01 19:41:29 +01:00
Daniel Eklöf
ca150fbdd5
readme: don’t uppercase titles 2020-12-01 19:40:46 +01:00
Daniel Eklöf
3526af34d7
config: enable allow-overflowing-double-width-glyphs by default 2020-12-01 19:40:43 +01:00
Daniel Eklöf
d86b6b3031
changelog: fix link to readme#keypad 2020-12-01 19:40:13 +01:00
Daniel Eklöf
8970c7ea18
readme/doc:foot.1: document the (new) keypad behavior 2020-12-01 19:40:03 +01:00
Daniel Eklöf
dea8e89fda
input: enforce ‘numerical’ keypad mode when Num Lock override is enabled
When num lock override has been enabled via “CSI?1035h” (the default),
keypad is always considered to be in ‘numerical’ mode.

This affects how keypad keys are translated to escape sequences when
Num Lock is active.

The keypad has four modes:

* Num Lock off, numerical mode
* Num Lock off, application mode
* Num Lock on, numerical mode
* Num Lock on, application mode

The keymap is identical for numerical and application mode when Num
Lock is off, meaning the keypad effectively has three different modes.

In XTerm, numerical and application mode _can_ be the same, **if** the
‘numLock’ resource is set to true (the default). It is only when
‘numLock’ is false that the application mode is actually used.

This patch changes foot to do the same. We don’t expose an option, but
do implement “CSI ? 1035”.

Closes #194
2020-12-01 19:39:10 +01:00
Daniel Eklöf
4f0d057243
input: track num lock state 2020-12-01 19:39:05 +01:00
Daniel Eklöf
7dcc885a7a
csi: implement “CSI ? 1035” - toggle Num Lock override
This adds a num_lock_modifier state to the terminal, and hooks up
“CSI?1035h/l” to toggle it.
2020-12-01 19:38:36 +01:00
Daniel Eklöf
61f4845a59
input: use XKB_MOD_NAME_* macros instead of hard-coded strings 2020-12-01 19:37:29 +01:00
Daniel Eklöf
3031ddfc16
wayland: preempt render scheduling in ‘configure’ events
A configure event must be “committed”. In case of resizing, that means
rendering a new frame and committing that surface.

render_resize() will resize the grid and *schedule* a render
refresh. However, if one is already pending, the refresh will take a
very (relatively) long time - until the next frame callback is
received.

This poses a problem when the window is hidden, since in this case,
the frame callback *never* comes. This in turn means we fail to commit
a new surface in response to the ‘configure’ event. And that means the
compositor needs to wait for a transaction timeout before continuing.

The end effect is very slow and jerky window resizing when a hidden
foot window is being resized.

This can happen in tiled compositors, like Sway, where a window can be
tabbed (and thus invisible), but still resized when its container is
resized.

Closes #190
2020-12-01 19:35:58 +01:00
Daniel Eklöf
99b3e20126
changelog: add entry for 1.5.4 2020-12-01 19:33:22 +01:00
Daniel Eklöf
c3201b9770
Merge branch 'modify-escape-key'
Closes #225
2020-12-01 18:31:25 +01:00
Daniel Eklöf
1f6a663bed
Merge branch 'clipboard-ignore-unhandled-mime-types'
Closes #230
2020-12-01 18:30:29 +01:00
Daniel Eklöf
c44c7cc5be
input: relax requirements for overriding keypad application mode
Don’t require NumLock to be locked. Foot has no idea _which_ modifier
the user has mapped NumLock to, meaning we really cannot require it to
be locked.
2020-12-01 18:27:56 +01:00
Daniel Eklöf
282ca89168
Merge branch 'base64-padding-fix' 2020-11-30 20:15:41 +01:00
Daniel Eklöf
f55e65808c
Merge branch 'simplify-config-struct' 2020-11-30 20:14:37 +01:00
Daniel Eklöf
9e1746cc29
selection: do not try to paste un-handled mime types
Closes #230
2020-11-30 20:04:17 +01:00
Daniel Eklöf
043b741008
selection: offer clipboard content in more mime types 2020-11-30 20:02:47 +01:00
Daniel Eklöf
09c88e6715
input: improved debug logging of pressed keys 2020-11-30 20:01:46 +01:00
Craig Barnes
c66ad27cc8 base64: only allow padding bytes at the end of a string when decoding 2020-11-30 06:06:28 +00:00
Craig Barnes
adde947fc5 config: replace union in config struct with simple width/height members 2020-11-30 02:24:38 +00:00
Daniel Eklöf
0beed9fcf6
Merge branch 'base64-optimize' 2020-11-29 11:17:50 +01:00
Craig Barnes
8d568143da base64: optimize error checking in base64_decode() 2020-11-29 07:19:58 +00:00
Craig Barnes
31c73f0cf0 csi: add new private mode that makes the Escape key emit "\E[27;1;27~"
This mode can be set by client programs with the DECSET, DECRST,
XTSAVE and XTRESTORE sequences by using 27127 as the parameter.

The sequence "\E[27;1;27~" is encoded in the same way as is done by
xterm's "modifyOtherKeys" mode. Even though xterm itself never emits
such a sequence for the Escape key, many programs already have
support for parsing this style of key sequence.
2020-11-29 04:04:57 +00:00
Daniel Eklöf
c213ee90f1
keymap: add ‘CSI 27;<mod>;27~’ escapes for Esc with modifiers 2020-11-28 11:50:32 +01:00
Daniel Eklöf
016c703b3d
doc: foot.1: add IRC channel 2020-11-27 22:39:33 +01:00
Daniel Eklöf
cf1c92eae5
readme: better link to freenode 2020-11-27 19:48:40 +01:00
Daniel Eklöf
632dda93d3
readme: rename ‘IRC, social media’ -> ‘Contact’ 2020-11-27 19:06:41 +01:00
Daniel Eklöf
f6dcb88771
readme: irc: add channel and my username 2020-11-27 18:54:18 +01:00
Daniel Eklöf
abe6a4f212
Merge branch 'split-cursor-blink-state'
Closes #218
2020-11-27 17:14:16 +01:00
Daniel Eklöf
addc374655
main: tag fdm loop with likely() and unlikely() 2020-11-26 18:23:28 +01:00
Daniel Eklöf
15b35b7641
fdm: keep polling on EINTR 2020-11-26 18:23:01 +01:00
Daniel Eklöf
903a8eaf4a
doc: foot.5: minor highlighting fixes 2020-11-26 18:22:45 +01:00
Daniel Eklöf
4d9e5368a9
doc: foot.1: no need to say foot.ini twice 2020-11-26 18:22:22 +01:00
Daniel Eklöf
cb2f496269
term: split cursor blink state into two
There are two different escape sequences that can be used to set the
cursor blink state: ‘CSI ? 12 h/l’ and ‘CSI Ps SP q’.

Up until now, they both modified the same internal state in foot. This
meant you could enable a blinking cursor with e.g. ‘CSI ? 12 h’ and
then disable it with ‘CSI 2 SP q’.

Since the ‘CSI ? 12’ escapes are used in the civis/cnorm/cvvis
terminfo entries, applications often ended up disabling the blink
state on exit (typically be emitting ‘cnorm’), requiring users to
manually re-enable blinking.

By splitting the internal state into two separate states, we can
improve the situation.

The cursor will blink if at least one of the two have been enabled.

The setting in foot.ini sets the default state of the ‘CSI Ps SP q’
escape.

This means if the user has enabled blinking in the configuration, the
cursor will blink regardless of civis/cnorm/cvvis. Which probably is
what the user wants.

If the user has NOT enabled blinking, civis/cnorm/cvvis act as
intended: cvvis blink, civis and cnorm do not.

If an application overrides the cursor blink/style with ‘CSI Ps SP q’,
that will override the user’s setting in foot.ini. But most likely
that too is intended (for example, the user may have configured the
application to use a different cursor style). And, a well written
application will emit the ‘Se’ terminfo sequence on exit, which in
foot is defined to ‘CSI SP q’, which will reset both the style and
blink state to the user configured style/state.

Closes #218
2020-11-26 18:09:32 +01:00
Daniel Eklöf
360cc8e6de
term: remove read-only properties copied from the config
Use the config directly instead.
2020-11-26 18:08:28 +01:00
Daniel Eklöf
bb0b3ab122
changelog: update contributor list 2020-11-25 20:43:59 +01:00
Daniel Eklöf
d151d4bc50
Merge branch 'dont-reflow-alt-screen'
Closes #221
2020-11-25 20:33:56 +01:00
Daniel Eklöf
434c8e4121
grid: resize_without_reflow: don’t call min() on every loop iteration 2020-11-25 20:33:07 +01:00
Daniel Eklöf
9a498038d6
resize: don’t reflow text on alt screen
Alt screen applications normally reflow/readjust themselves on a
window resize.

When we do it too, the result is graphical glitches/flashes since our
re-flowed text is rendered in one frame, and the application re-flowed
text soon thereafter.

We can’t avoid rendering some kind of re-flowed frame, since we don’t
know when, or even if, the application will update itself. To avoid
glitches, we need to render, as closely as possible, what the
application itself will render shortly.

This is actually pretty simple; we just need to copy the visible
content over from the old grid to the new grid. We don’t bother with
text re-flow, but simply truncate long lines.

To simplify things, we simply cancel any active selection (since often
times, it will be corrupted anyway when the application redraws
itself).

Since we’re not reflowing text, there’s no need to translate e.g. the
cursor position - we just keep the current position (but bounded to
the new dimensions).

Fun thing: ‘less’ gets corrupted if we don’t leave the cursor at
the (new) bottom row. To handle this, we check if the cursor (before
resize) is at the bottom row, and if so, we move it to the new bottom
row.

Closes #221
2020-11-25 07:47:40 +01:00
Daniel Eklöf
c2f043f906
Merge branch 'wl_output'
Closes #219
2020-11-25 07:43:57 +01:00
Kenny Levinsen
ab6327da26 wayland: Use wl_output_release with wl_output v3
wl_output_release, the use of which was recently introduced, is not
available until wl_output interface version 3.

However, only wl_output version 2 was bound. This lead to protocol
errors when a display was disconnected, causing foot to terminate.

Instead, only use wl_output_release if wl_output version 3 is provided
and bound. Otherwise, just use wl_output_destroy.

Closes: https://codeberg.org/dnkl/foot/issues/219
2020-11-25 00:19:23 +01:00
Daniel Eklöf
519eb24282
Merge branch 'sixel-pgo' 2020-11-24 21:35:28 +01:00
Daniel Eklöf
c03a4f6ffb
pkgbuild: add --sixel to generate-alt-random-writes 2020-11-24 21:31:44 +01:00
Daniel Eklöf
7755af5bea
install: add --sixel to suggested command line for generate-alt-random-writes 2020-11-24 21:31:44 +01:00
Daniel Eklöf
d2f0b82bda
scripts: generate-alt-random-writes: add --sixel
When --sixel is specified, we generate random sixel images in the
‘normal’ screen, after exiting the alt screen.
2020-11-24 21:31:34 +01:00
Daniel Eklöf
22c354c8fd
term: place frequently accessed members first in term struct
To hopefully use the cache better.
2020-11-24 20:55:41 +01:00
Daniel Eklöf
309e30ba97
Merge branch 'increase-sixel-default-max-size' 2020-11-24 19:24:07 +01:00
Daniel Eklöf
ba8b15d675
sixel: change default max size to 10000x10000
It used to be the size of the window. This caused images to be cropped
when the application emitting them didn’t change the max size.
2020-11-23 20:10:55 +01:00