Add a settings screen so nothing needs a text editor

All eighteen options are now reachable from the menu as a cursor list: arrows
select, Space or Right cycles a value, q goes back, changes are written
immediately. A numbered menu would have run out of digits.

Three real bugs surfaced while building it, each found by testing against an
actual pty rather than a pipe:

- Labels went through printf as format strings, so the percent sign in
  "Minimum battery level (%)" was an invalid conversion. cau_msg_in now only
  treats a message as a format string when arguments were actually passed -
  otherwise any literal % a translator writes is a trap.

- Mixing bash's line-mode read into a single-key interface left the following
  read -sn1 receiving nothing at all, reproducibly, so the screen froze after
  editing the package list. Replaced with a small line editor built on the same
  single-character reader.

- Backspace was being swallowed: in canonical mode DEL is the ERASE character
  and the line discipline consumes it, and bash returns to canonical mode
  between each read -sn1. The interface now holds non-canonical mode for its
  whole lifetime and hands the terminal back only around actions that print or
  prompt, with a trap restoring it on Ctrl-C.

Translations and config reads are memoized; the screen redraws every label on
every keypress and a fork per lookup was the reason the redraw was slow enough
to matter.
This commit is contained in:
Felitendo committed 2026-08-08 16:18:59 +02:00
1 parent 2eff62f9fd
commit c308b7e286
8 files changed
+491 -26

No files matched your search

+66
View File
@@ -271,3 +271,69 @@ msgstr "Updates werden installiert"
#, c-format
msgid "%d packages are being updated. Please leave the computer switched on until this is done."
msgstr "%d Pakete werden gerade aktualisiert. Bitte den Rechner so lange eingeschaltet lassen."
msgid "Settings"
msgstr "Einstellungen"
msgid "(none)"
msgstr "(keine)"
msgid "Up/Down select - Space or Right changes - q goes back"
msgstr "Hoch/Runter wählen – Leertaste oder Rechts ändert – q zurück"
msgid "Package names separated by spaces, empty to clear:"
msgstr "Paketnamen mit Leerzeichen getrennt, leer zum Löschen:"
msgid "Notify when an update starts"
msgstr "Melden, wenn ein Update beginnt"
msgid "Notify after a successful update"
msgstr "Melden nach erfolgreichem Update"
msgid "Notify when something goes wrong"
msgstr "Melden, wenn etwas schiefgeht"
msgid "Notify when a restart is needed"
msgstr "Melden, wenn ein Neustart nötig ist"
msgid "Time between update runs"
msgstr "Abstand zwischen Update-Läufen"
msgid "Postpone while a game is running"
msgstr "Verschieben, solange ein Spiel läuft"
msgid "Only update on mains power"
msgstr "Nur am Stromnetz aktualisieren"
msgid "Minimum battery level (%)"
msgstr "Mindest-Akkustand (%)"
msgid "Update AUR packages"
msgstr "AUR-Pakete aktualisieren"
msgid "Update Flatpaks"
msgstr "Flatpaks aktualisieren"
msgid "Update AppImages"
msgstr "AppImages aktualisieren"
msgid "Also rebuild -git packages"
msgstr "Auch -git-Pakete neu bauen"
msgid "AUR helper"
msgstr "AUR-Helfer"
msgid "Resolve package conflicts automatically"
msgstr "Paketkonflikte automatisch auflösen"
msgid "Trim the package cache"
msgstr "Paket-Cache beschneiden"
msgid "Cached versions to keep"
msgstr "Behaltene Versionen im Cache"
msgid "Remove packages nothing needs any more"
msgstr "Nicht mehr benötigte Pakete entfernen"
msgid "Never update these packages"
msgstr "Diese Pakete nie aktualisieren"