diff --git a/packages/core/src/labels.ts b/packages/core/src/labels.ts index 6dce58b..c7ec096 100644 --- a/packages/core/src/labels.ts +++ b/packages/core/src/labels.ts @@ -18,6 +18,9 @@ export const LABEL_MAX_LENGTH = 100 /** `com.disnetdev.radial.labelGoal.labels` item-count ceiling. Same consequence. */ export const LABELS_MAX = 20 +/** A saved-view name as every writer keys it: trimmed, with runs of whitespace collapsed. */ +export const normalizeViewName = (value: string): string => value.replace(/\s+/g, ' ').trim() + /** * One label, as it should be written: outer whitespace gone, inner whitespace collapsed to single * spaces. `undefined` when nothing survives, so a caller can drop it. diff --git a/packages/sidecar/src/commands.ts b/packages/sidecar/src/commands.ts index 54fffd3..f84b4a4 100644 --- a/packages/sidecar/src/commands.ts +++ b/packages/sidecar/src/commands.ts @@ -8,6 +8,7 @@ import { joinRkey, normalizeArtifactTitle, normalizeLabels, + normalizeViewName, parseLabelList, spaceNonce, type Collection, @@ -302,7 +303,7 @@ function labelSet(args: string[]): string[] { /** `--name` for a saved view, bounded by the lexicon for the same reason labels are. */ function viewName(args: string[]): string { - const name = required(args, '--name').replace(/\s+/g, ' ').trim() + const name = normalizeViewName(required(args, '--name')) if (name === '') throw new Error('--name cannot be empty') if (name.length > LABEL_MAX_LENGTH) { throw new Error( diff --git a/packages/ui/src/lib/components/FilterBar.svelte b/packages/ui/src/lib/components/FilterBar.svelte index 28cd411..608bec1 100644 --- a/packages/ui/src/lib/components/FilterBar.svelte +++ b/packages/ui/src/lib/components/FilterBar.svelte @@ -1,11 +1,11 @@