aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-16 11:12:20 +0200
committeruser <user@clank>2026-08-16 11:12:20 +0200
commita4e09657ca89fe3cc553ec894e3776abfd4a3e99 (patch)
treeacc330c10f38882e139731052c7964b259a3e826 /docs
parentsl0ppty: a pane can set its own shaders (diff)
downloadslosh-a4e09657ca89fe3cc553ec894e3776abfd4a3e99.tar.gz
slosh-a4e09657ca89fe3cc553ec894e3776abfd4a3e99.tar.xz
slosh-a4e09657ca89fe3cc553ec894e3776abfd4a3e99.zip
sl0ppty: a prompt with a memory
`contrib/shader-repl` imports readline, which is most of it: editing, up/down, ctrl-r, and history kept between runs in `$XDG_DATA_HOME/sl0ppty/shader-repl.history`. Chains only -- a `:` command is taken back out of the history it would otherwise fill, because pressing up four times past `:quit` and `:paste` to reach the line you were working on is the annoyance history exists to remove. Tab completes the commands, the nine shader names, the property keys, the two rects, the three channels, and the expression language's own variables and functions. `:help` prints the lot at once, which is the same list from the same place. That list is a claim about what exists, so `tests/test_shader_repl.py` checks it against `src/shader.c` and `src/expr.c` and fails if either grows a name it does not have -- verified by removing `spotlight` and watching it fail. Then it types every name it offers at a real prompt and requires `ok` from a real session, because a name that completes and does not parse is a lie with a keystroke attached. History across two runs, a tab completion, and `:help` are driven the same way, through a pty. Two things that cost me time and are now written down where they bite: keys go into a pane escaped (`\r`, `\t`, `\e[A`) because `raw` takes the rest of one command line and a literal newline ends the command instead of arriving; and Enter is CR, which is what a terminal sends and what readline waits for. Also: **a bare argument on a shader entry is now a complaint.** Every parameter is a property, so `tint color="#000000" spotlight` is not a pass with a spare word, it is a missing `;` -- KDL reads one node, the second name does nothing, and the session used to answer `ok`. It now says `unexpected argument for tint: spotlight (separate entries with ';')`. Found by watching the prompt get used.
Diffstat (limited to 'docs')
-rw-r--r--docs/shaders.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/shaders.md b/docs/shaders.md
index 95550f0..63801db 100644
--- a/docs/shaders.md
+++ b/docs/shaders.md
@@ -110,6 +110,15 @@ pane change, and `:paste` prints what you have as a `shaders { }` block for your
config. What you prototype and what you paste are parsed by the same code, which
is the point of using the config's syntax for a thing typed at a terminal.
+It is a readline prompt, so editing, up/down and ctrl-r work as they do in a
+shell, and history is kept between runs in
+`$XDG_DATA_HOME/sl0ppty/shader-repl.history` -- the chains only, since `:quit` is
+not something you want to press up past. Tab completes the commands, the shader
+names, the property keys and the expression language's own variables and
+functions; `:help` prints the same list at once. A test checks that list against
+`src/shader.c` and `src/expr.c`, because a completion list that has gone stale
+reads as "that is all there is".
+
**Off by default.** It needs `in_band_shaders true`, because a program that can
restyle the session it happens to be running in is a hazard first and a
convenience second: `cat` the wrong file and your panes go dark. With it on, a