From de349a423e0f00935ab0b87ddc1127360612ae35 Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 24 Jun 2026 11:17:45 -0400 Subject: [PATCH] fix(config-settings): list values accept comma and/or whitespace separators Previously list rows (Extra secret, OK codes) split on spaces only, so 'KOPIA, TEST' produced the malformed token 'KOPIA,'. Collapse any run of commas/whitespace to a single space before splitting, so 'A,B', 'A, B' and 'A B' all yield the same entries. --- docs/fish-config.md | 4 +++- functions/__config_settings_set_value.fish | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/fish-config.md b/docs/fish-config.md index 24944c1..c58b1ba 100644 --- a/docs/fish-config.md +++ b/docs/fish-config.md @@ -1378,7 +1378,9 @@ Add -i (interactive confirmation) to destructive commands: Toggle rows use ← → (or h/l) along an OFF ← DEFAULT → ON scale; DEFAULT erases the variable so the master switch / built-in default applies. Value rows (the path/int/list settings on the Sponge and Paths pages) use Enter to - edit inline; ← / h clears the value back to its default. Changes apply + edit inline; ← / h clears the value back to its default. List rows (e.g. + Extra secret, OK codes) accept values separated by commas and/or whitespace + — "A, B", "A,B" and "A B" all yield the same two entries. Changes apply immediately. Always available regardless of the __fish_config_opinionated master state. diff --git a/functions/__config_settings_set_value.fish b/functions/__config_settings_set_value.fish index e223071..46ddfd1 100644 --- a/functions/__config_settings_set_value.fish +++ b/functions/__config_settings_set_value.fish @@ -38,7 +38,11 @@ function __config_settings_set_value else switch $type case list - set -U -- $varname (string split -n ' ' -- $value) 2>/dev/null + # Accept commas and/or whitespace as separators: collapse any run + # of them to a single space, then split (dropping empties). So + # "A,B", "A, B", "A B" and "A B" all yield the same two tokens. + set -U -- $varname \ + (string split -n ' ' -- (string replace -ra '[,\s]+' ' ' -- $value)) 2>/dev/null case '*' # -- (before the name) guards typed input that begins with a dash set -U -- $varname $value 2>/dev/null