summaryrefslogtreecommitdiffhomepage
path: root/internal/tui/components
diff options
context:
space:
mode:
authorEd Zynda <[email protected]>2025-05-16 18:56:39 +0300
committerGitHub <[email protected]>2025-05-16 10:56:39 -0500
commitc92f7c6630c5a4d010ea0c80380f2dbb6dd7e3e1 (patch)
treecbfa8e2770a653d9a3e29963e99f79bd430e9e4e /internal/tui/components
parent4a444e9c9b7674c6b07a1a012a6467e45c3af1ec (diff)
downloadopencode-c92f7c6630c5a4d010ea0c80380f2dbb6dd7e3e1.tar.gz
opencode-c92f7c6630c5a4d010ea0c80380f2dbb6dd7e3e1.zip
fix: Show correct file paths in permission window (#25)
* Fix paths in permission window to show relative paths * Fix paths in permission window to show actual file paths
Diffstat (limited to 'internal/tui/components')
-rw-r--r--internal/tui/components/dialog/permission.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/tui/components/dialog/permission.go b/internal/tui/components/dialog/permission.go
index d0468d307..5e5b09e1b 100644
--- a/internal/tui/components/dialog/permission.go
+++ b/internal/tui/components/dialog/permission.go
@@ -6,6 +6,7 @@ import (
"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
+ "github.com/sst/opencode/internal/config"
"github.com/sst/opencode/internal/diff"
"github.com/sst/opencode/internal/llm/tools"
"github.com/sst/opencode/internal/permission"
@@ -13,6 +14,7 @@ import (
"github.com/sst/opencode/internal/tui/styles"
"github.com/sst/opencode/internal/tui/theme"
"github.com/sst/opencode/internal/tui/util"
+ "path/filepath"
"strings"
)
@@ -204,10 +206,19 @@ func (p *permissionDialogCmp) renderHeader() string {
Render(fmt.Sprintf(": %s", p.permission.ToolName))
pathKey := baseStyle.Foreground(t.TextMuted()).Bold(true).Render("Path")
+
+ // Get the current working directory to display relative path
+ relativePath := p.permission.Path
+ if filepath.IsAbs(relativePath) {
+ if cwd, err := filepath.Rel(config.WorkingDirectory(), relativePath); err == nil {
+ relativePath = cwd
+ }
+ }
+
pathValue := baseStyle.
Foreground(t.Text()).
Width(p.width - lipgloss.Width(pathKey)).
- Render(fmt.Sprintf(": %s", p.permission.Path))
+ Render(fmt.Sprintf(": %s", relativePath))
headerParts := []string{
lipgloss.JoinHorizontal(