From 1433f7a13ede0c819ec4f8fd4027ad3df8daa94f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 5 Jun 2026 10:26:16 +0300 Subject: Add 'ask edit' subcommand and collapse multi-line task descriptions - ask edit opens $EDITOR and creates a task from the (multi-line) content, reusing the shared internal/editor package - collapse newlines in list output and fish completion so multi-line descriptions render on one line and don't break completion Bump version to 0.40.0 Amp-Thread-ID: https://ampcode.com/threads/T-019e96a1-9c8e-73d6-95b4-b55cb12cc762 Co-authored-by: Amp --- internal/askcli/command_complete_uuids_test.go | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'internal/askcli/command_complete_uuids_test.go') diff --git a/internal/askcli/command_complete_uuids_test.go b/internal/askcli/command_complete_uuids_test.go index 0859acc..2c1b5fd 100644 --- a/internal/askcli/command_complete_uuids_test.go +++ b/internal/askcli/command_complete_uuids_test.go @@ -255,3 +255,31 @@ func TestTruncateDescription_Unicode(t *testing.T) { t.Fatalf("truncateDescription = %q, want %q", got, "日本語…") } } + +func TestTruncateDescription_CollapsesNewlines(t *testing.T) { + // Multi-line descriptions must collapse to a single line so the + // tab-separated completion output is not broken into bogus entries. + got := truncateDescription("first line\nsecond line\n\nfourth", 100) + if got != "first line second line fourth" { + t.Fatalf("truncateDescription = %q, want single-line collapse", got) + } + if strings.ContainsAny(got, "\r\n") { + t.Fatalf("truncateDescription left a newline in %q", got) + } +} + +func TestOneLineDescription(t *testing.T) { + cases := map[string]string{ + "plain": "plain", + "a\nb": "a b", + "a\r\nb": "a b", + "a\n\n\nb": "a b", + " leading\n indented ": "leading indented", + "keep internal spaces": "keep internal spaces", + } + for in, want := range cases { + if got := oneLineDescription(in); got != want { + t.Fatalf("oneLineDescription(%q) = %q, want %q", in, got, want) + } + } +} -- cgit v1.2.3