Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions internal/tui/core/workspace/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ func TestResolveWorkspacePath(t *testing.T) {
if resolved != filepath.Clean(base) {
t.Fatalf("expected base directory for empty requested path, got %q", resolved)
}

// Empty base falls back to os.Getwd().
resolved, err = ResolveWorkspacePath("", ".")
if err != nil {
t.Fatalf("ResolveWorkspacePath(empty base) error = %v", err)
}
cwd, _ := os.Getwd()
if resolved != filepath.Clean(cwd) {
t.Fatalf("expected current directory for empty base, got %q", resolved)
}
}

func TestResolveWorkspacePathErrors(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions internal/tui/services/file_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func ResolveWorkspaceDirectory(workdir string) string {
if workdir == "" {
return ""
}
if strings.ContainsRune(workdir, '\x00') {
return ""
}
absolute, err := filepath.Abs(workdir)
if err != nil {
return ""
Expand Down
10 changes: 9 additions & 1 deletion internal/tui/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"regexp"
goruntime "runtime"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -2481,7 +2482,14 @@ func TestWorkspaceCommandAndFileReferenceFlow(t *testing.T) {
if !strings.Contains(menu, shellMenuTitle) || !strings.Contains(menu, workspaceCommandUsage) {
t.Fatalf("expected shell hint menu, got %q", menu)
}
if strings.Count(menu, "\n") > 3 {
// Shell menu should stay reasonably compact (title + one item row + padding).
// Allow extra newlines on Windows where long paths with non-ASCII characters
// may cause lipgloss to wrap the description line.
maxShellMenuLines := 4
if goruntime.GOOS == "windows" {
maxShellMenuLines = 6
}
if strings.Count(menu, "\n") > maxShellMenuLines {
t.Fatalf("expected compact shell menu, got %q", menu)
}
}
Expand Down
Loading