Commit graph

5125 commits

Author SHA1 Message Date
Daniel Eklöf
873a27c6a5
test: add missing END_TESTs 2021-12-11 21:04:52 +01:00
Daniel Eklöf
466fd62e85
test: config: main.box-drawings-uses-font-glyphs, main.dpi-aware 2021-12-11 21:04:52 +01:00
Daniel Eklöf
e058f7a988
test: config: add test cases for font positioning
* letter-spacing
* horizontal-letter-offset
* vertical-letter-offset
* underline-offset
2021-12-11 21:04:51 +01:00
Daniel Eklöf
50b5168ec9
test: config: add test case for main.line-height 2021-12-11 21:04:51 +01:00
Daniel Eklöf
ed739cbc2a
test: config: initial tests for the “main” section
* Verify empty section loads correctly
* Verify the “shell” option
* Verify the “login-shell” option
* Verify loading an invalid option fails
2021-12-11 21:04:51 +01:00
Daniel Eklöf
64787962ff
test: config: verify we fail to load a config with an invalid section 2021-12-11 21:04:51 +01:00
Daniel Eklöf
11dfa2145f
test: unlink config file in teardown 2021-12-11 21:04:51 +01:00
Daniel Eklöf
f6908619b3
test: verify an empty config can be loaded successfully 2021-12-11 21:04:51 +01:00
Daniel Eklöf
6ea10bdb73
test: meson: link with tllist 2021-12-11 21:04:51 +01:00
Daniel Eklöf
30709b0968
test: add a test binary for foot, using the ‘check’ test framework 2021-12-11 21:04:51 +01:00
Daniel Eklöf
fd26fadc2c
Merge branch 'config-refactor-and-verify-binding-collisions-after-load' 2021-12-11 21:04:27 +01:00
Daniel Eklöf
6911a50df7
config: NOINLINE modifiers_to_str() 2021-12-11 20:59:08 +01:00
Daniel Eklöf
f077a2e77a
test: config: verify collisions with the mouse override modifiers are detected 2021-12-11 20:44:01 +01:00
Daniel Eklöf
40249ab3a2
test: config: port key/mouse binding tests to new API 2021-12-11 20:19:12 +01:00
Daniel Eklöf
2a02ba77a1
config: resolve collisions: argv_compare() returns -1,0,+1, not a bool 2021-12-11 20:19:12 +01:00
Daniel Eklöf
17250ec393
config: resolve collisions: return ‘false’ on failure 2021-12-11 20:19:12 +01:00
Daniel Eklöf
6fa09d24e5
config: use “(default)” as path in log message, if path is NULL 2021-12-11 20:19:12 +01:00
Daniel Eklöf
ff82a3900e
config: remove commented out struct definition 2021-12-11 20:19:11 +01:00
Daniel Eklöf
3512a7febf
config: remove unneeded function prototype 2021-12-11 20:19:11 +01:00
Daniel Eklöf
f6a591b80a
config: unify key- and mouse bindings
With this patch, key- and mouse-bindings structs (the non-layout
specific ones) are unified into a single struct.

The logic that parses, and manages, the key- and mouse binding lists
are almost identical. The *only* difference between a key- and a mouse
binding is that key bindings have an XKB symbol, and mouse bindings a
button and click-count.

The new, unified, struct uses a union around these, and all functions
that need to know which members to use/operate on now takes a ‘type’
parameter.
2021-12-11 20:19:11 +01:00
Daniel Eklöf
4c50c44cf7
config: do mouse binding collision detection after loading the conf 2021-12-11 20:19:11 +01:00
Daniel Eklöf
bb4b4ae43d
config: value_to_key_combos(): reset modifiers in binding 2021-12-11 20:19:11 +01:00
Daniel Eklöf
e67639a682
main: ignore SIGPIPE
We want to handle SIGPIPEs without crashing... One way to trigger this
was to use e.g.

  pipe-visible=[cat /foo/bar] Control+Shift+q

That is, pipe output to something that did not consume it. This led
to a SIGPIPE when we tried to write the terminal contents to the pipe,
and crashed the whole foot instance.
2021-12-11 20:19:11 +01:00
Daniel Eklöf
197c1c5ced
config: do key binding collision detection after loading the conf
This allows the user to write, to swap two key bindings:

  [key-bindings]
  show-urls-launch=Control+Shift+r
  search-start=Control+Shift+u

instead of:

  [key-bindings]
  search-start=none
  show-urls-launch=Control+Shift+r
  search-start=Control+Shift+u

This should simplify the configuration for people who replace a lot of
the default key bindings.

This also simplifies the parsing somewhat, since we no longer has to
parse a key-binding into a temporary list, ensure it doesn’t have any
collisions, and then copy it into the actual key binding list.

_While_ parsing a key-binding, we still need a temporary array (at
least for the time being), but that temporary array is no longer
visible outside the parsing function that allocates it.
2021-12-11 20:19:11 +01:00
Daniel Eklöf
fc2bacbb78
config: remove struct key_combo, use config_key_binding instead 2021-12-11 20:19:10 +01:00
Daniel Eklöf
87c454c044
test: meson: add fontconfig to ‘test-config’ binary (fixes PGO builds) 2021-12-11 20:09:30 +01:00
Daniel Eklöf
8d7dceb88a
Merge branch 'config-unittest'
Part of #813
2021-12-11 18:54:42 +01:00
Daniel Eklöf
614de228a8
test: config: mouse-bindings 2021-12-11 18:52:06 +01:00
Daniel Eklöf
9c5019ae77
test: config: key-bindings
This adds tests for all [key-bindings] options, as well as an invalid
“action”.

The tests also verify key combo collisions are detected correctly.
2021-12-11 18:52:05 +01:00
Daniel Eklöf
8cf9f0f0dc
tests: meson: link with tllist 2021-12-11 18:52:05 +01:00
Daniel Eklöf
4a00d0d050
ci (gitlab+builds.sr.ht): execute foot{,client} --version
This runs our builtin unit tests (debug builds only), and verifies it
runs, at all. (and also logs the version in the build logs...)
2021-12-11 18:52:05 +01:00
Daniel Eklöf
7a9f929368
test: config: cover all basic (primitive) options in [main] 2021-12-11 18:52:05 +01:00
Daniel Eklöf
e1c3bdc6f2
test: initial external unit test suite for ‘config.c’
This patch adds a separate (external) test binary with unit tests for
config.c

This is achieved by having the test’s source file include
config.c (yes, the C file, not the header file).

This allows us to call e.g. parse_section_*() directly, without having
to go through config_load() (which requires having a readable file at
“path”).
2021-12-11 18:52:05 +01:00
Daniel Eklöf
c685406a13
changelog: kitty kbd: add link to codeberg issue 2021-12-08 19:06:51 +01:00
Daniel Eklöf
7ed671ef59
Merge branch 'releases/1.10' 2021-12-08 18:20:53 +01:00
Daniel Eklöf
baae46ea75
changelog: kitty: alternate keys: base layout key is implemented 2021-12-08 18:20:26 +01:00
Daniel Eklöf
3d7643b181
Merge branch 'releases/1.10' 2021-12-08 18:14:44 +01:00
Daniel Eklöf
a9026f16a7
meson: bump version to 1.10.3 2021-12-08 18:09:50 +01:00
Daniel Eklöf
924726ac76
changelog: prepare for 1.10.3 2021-12-08 18:08:45 +01:00
Daniel Eklöf
352077c78a
kitty: simplify: always calculate alternate/base keys
But only _emit_ them if report alternate has been enabled.
2021-12-08 18:06:10 +01:00
Daniel Eklöf
30a66996b2
kitty: when emitting associated text, don’t report mods/events unless necessary 2021-12-08 18:06:08 +01:00
Daniel Eklöf
db95a90e57
kitty: report-alternate: apply base-layout key to composed characters 2021-12-08 18:06:06 +01:00
Daniel Eklöf
7e9ca65f4d
kitty: implement “base layout key” in “report alternate key” 2021-12-08 18:06:04 +01:00
Daniel Eklöf
010c4001d2
kitty: initial support for “report alternate key”
In this mode, the “shifted” and “base layout” keys are added to the
CSIs, as sub-parameters to the “key” parameter.

Note that this PR only implements the “shifted” key, not the “base
layout key”.

This is done by converting the original XKB symbol to it’s
corresponding UTF-32 codepoint. If this codepoint is different from
the one we use as “key” in the CSI, we add it as a sub-parameter.

Related to #319
2021-12-08 18:06:02 +01:00
Daniel Eklöf
f3f3f60040
kitty: only emit plain text on key press- and repeat events
That is, release events always generate CSIs
2021-12-08 18:05:56 +01:00
Daniel Eklöf
40b69ab521
kitty: add ISO_Level{3,5}_Shift keys 2021-12-08 18:05:51 +01:00
Daniel Eklöf
305f3122b1
kitty: composed characters with “report associated text”
The generic input handler now converts the composed character to it’s
UTF-32 equivalent. This means we now provide a valid UTF-32 codepoint
for both composed characters, and non-composed (plain-text)
characters.

Use this in the kitty protocol to simplify the logic around composed
characters, by simply treating them as plain text.
2021-12-08 18:05:49 +01:00
Daniel Eklöf
7a5386d883
kitty: implement “report associated text”
In this mode, key events that generate text now add a third CSI
parameter, indicating the actual codepoint.

Remember that we always use the *unshifted* key in the CSI
escapes. With this mode, those CSI escapes now also included the text
codepoint. I.e. what would have been emitted, had we not generated a
CSI escape.

As far as I can tell, this mode has no effect unless “report all keys
as escape sequences” is enabled (reason being, without that, there
aren’t any text events that generate CSIs - they’re always emitted
as-is).

Note that Kitty itself seems to be somewhat buggy in this mode. At
least on Wayland, with my Swedish layout. For example ‘a’ and ‘A’ does
generate the expected CSIs, but ‘å’ and ‘Å’ appears to be treated as
non-text input.

Furthermore, Kitty optimizes away the modifier parameter, if no
modifiers are pressed (e.g. CSI 97;;97u), while we always emit the
modifier (CSI 97;1;97u).

Related to #319
2021-12-08 18:05:46 +01:00
Daniel Eklöf
9649842eca
grid: reload pointers into the uri range vector after inserting
Inserting elements into the URI range vector typically triggers a
vector resize. This is done using realloc(). Sometimes this causes the
vector to move, thus invalidating all existing pointers into the
vector.
2021-12-08 18:05:40 +01:00
Daniel Eklöf
4e34fb8fb7
input: kitty: add support for “report all keys as escape codes” 2021-12-08 18:05:33 +01:00