diff options
| author | user <user@clank> | 2026-08-16 00:24:41 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-16 00:25:27 +0200 |
| commit | 25fb74894a826777d2f9dd10148b304bc8d02ceb (patch) | |
| tree | 47f36b60fef2ae4c53948988a2a28e6ab7825cca /docs | |
| parent | sl0ppty: [CC] src/app.c (diff) | |
| download | slosh-25fb74894a826777d2f9dd10148b304bc8d02ceb.tar.gz slosh-25fb74894a826777d2f9dd10148b304bc8d02ceb.tar.xz slosh-25fb74894a826777d2f9dd10148b304bc8d02ceb.zip | |
sl0ppty: every complaint, and the chords that produced eleven of them
Reported as "C-a is not a valid prefix in my config.kdl", which it was
not, and neither were ten other lines of the same file -- a file written
by `sl0ppty --dump-config`.
The loader now collects every complaint instead of keeping the first.
Each one carries the file and the line it happened at, so
"line 14: bad binding" became "config.kdl:116: bad key: ←", and a
complaint from an included file names that file. `err` still means the
first message, so a session's one status line behaves as before; the list
is what a linter needs, and `--check` (next commit) is that linter. Both
changes live in the same regions of config.c, which is why they are one
commit.
Then what the list found.
`--dump-config` is documented as "a file you could have written", and
`--dump-config > ~/.config/sl0ppty/config.kdl` as a supported way to
start one. It wrote every chord in the *cheatsheet's* notation:
prefix "C-a"
bind "?" "help"
bind "←" "focus-left"
bind "S-tab" "prev-tab"
and the parser only spoke the config's, so eleven of the file's own lines
came back as complaints and the session ran on the defaults those lines
were describing. Two sessions looked identical for the worst possible
reason, which is why the test asserting exactly that never noticed.
Both halves were wrong, so both are fixed.
The parser accepts what the sheet prints: `C-` `M-` `S-` as well as
`ctrl+ alt+ shift+`, the arrow glyphs as well as `left`/`right`, and a
character that carries its own shift -- `?` is shift+slash, `H` is
shift+h, `|` is shift+backslash. config.kdl has claimed for months that
`?` and `S-slash` were both writable; only one of them was.
A punctuation binding registers *both* encodings, because whether a
terminal reports `?` as shift+slash or as a bare byte is up to the
terminal and not to what the config meant. The shipped default has bound
`?` twice by hand for exactly this reason since it was written; this is
that, done once, in the one place that knows the character implied the
shift. A capital letter needs no such thing -- the decoder reports `H` as
shift+h everywhere.
And the dumper writes the canonical config spelling: `ctrl+a`,
`shift+slash`, `left`, `shift+tab`. `shift+` spelled out rather than
folded back into `?` or `H`, because both are accepted on the way in and
one spelling on the way out keeps a dump of a dump the same dump. A key
with no spelling the parser would accept is written as an empty chord
rather than as its display form: writing the display form is what caused
this, and a dump that does not load is worse than a dump missing a line.
The test that should have caught it now does: a session started from the
dump is asked to reload and must have nothing to say. Looking at the
screen was never going to find this, because the screen was right.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/keys.md | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/docs/keys.md b/docs/keys.md index e421df2..66163b5 100644 --- a/docs/keys.md +++ b/docs/keys.md @@ -55,10 +55,21 @@ keys { } ``` -Modifiers are `ctrl+ alt+ shift+ super+`. Named keys are -`left right up down enter tab escape space backspace home end pageup pagedown -delete insert backslash minus slash comma period`; anything else is the -character you press, so `"?"` and `"S-slash"` are the same binding. +Modifiers are `ctrl+ alt+ shift+ super+`, or the shorthand the cheatsheet +prints: `C-` `M-` `S-`. Named keys are `left right up down enter tab escape +space backspace home end pageup pagedown delete insert backslash minus slash +comma period`, and the arrows can be written as `←` `→` `↑` `↓` too — so a chord +copied off the cheatsheet is a chord you can paste into a config. + +Anything else is the character you press. That includes the shifted ones, which +carry their own shift: `"?"` is `"shift+slash"`, `"H"` is `"shift+h"`, `"|"` is +`"shift+backslash"`. A punctuation binding written that way answers both +encodings, because whether your terminal reports `?` with a shift modifier or as +a bare byte is up to your terminal and not to what you meant. + +`sl0ppty --check` reads a config and says what it could not honour, one problem +per line with a file and a line number. Worth running after editing bindings by +hand. ## Without the leader |
