From 2c5003e3fc94766cf848962ea0ffe94875c35d2b Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Wed, 23 Apr 2025 12:08:45 +0200 Subject: remove edit/normal mode --- internal/tui/components/dialog/commands.go | 2 -- internal/tui/components/dialog/help.go | 2 +- internal/tui/components/dialog/init.go | 12 +++--------- internal/tui/components/dialog/permission.go | 14 +++++--------- internal/tui/components/dialog/session.go | 4 ++-- 5 files changed, 11 insertions(+), 23 deletions(-) (limited to 'internal/tui/components/dialog') diff --git a/internal/tui/components/dialog/commands.go b/internal/tui/components/dialog/commands.go index 7b25caeb0..de8506650 100644 --- a/internal/tui/components/dialog/commands.go +++ b/internal/tui/components/dialog/commands.go @@ -190,7 +190,6 @@ func (c *commandDialogCmp) View() string { styles.BaseStyle.Width(maxWidth).Render(""), styles.BaseStyle.Width(maxWidth).Render(lipgloss.JoinVertical(lipgloss.Left, commandItems...)), styles.BaseStyle.Width(maxWidth).Render(""), - styles.BaseStyle.Width(maxWidth).Padding(0, 1).Foreground(styles.ForgroundDim).Render("↑/k: up ↓/j: down enter: select esc: cancel"), ) return styles.BaseStyle.Padding(1, 2). @@ -244,4 +243,3 @@ func NewCommandDialogCmp() CommandDialog { selectedCommandID: "", } } - diff --git a/internal/tui/components/dialog/help.go b/internal/tui/components/dialog/help.go index 644b294cb..0d7e46da8 100644 --- a/internal/tui/components/dialog/help.go +++ b/internal/tui/components/dialog/help.go @@ -62,7 +62,7 @@ func (h *helpCmp) render() string { var ( pairs []string width int - rows = 14 - 2 + rows = 10 - 2 ) for i := 0; i < len(bindings); i += rows { var ( diff --git a/internal/tui/components/dialog/init.go b/internal/tui/components/dialog/init.go index 6098ca755..3c81be349 100644 --- a/internal/tui/components/dialog/init.go +++ b/internal/tui/components/dialog/init.go @@ -46,8 +46,8 @@ func (k initDialogKeyMap) ShortHelp() []key.Binding { key.WithHelp("enter", "confirm"), ), key.NewBinding( - key.WithKeys("esc"), - key.WithHelp("esc", "cancel"), + key.WithKeys("esc", "q"), + key.WithHelp("esc/q", "cancel"), ), key.NewBinding( key.WithKeys("y", "n"), @@ -114,6 +114,7 @@ func (m InitDialogCmp) View() string { Padding(1, 1). Render("Would you like to initialize this project?") + maxWidth = min(maxWidth, m.width-10) yesStyle := styles.BaseStyle noStyle := styles.BaseStyle @@ -144,12 +145,6 @@ func (m InitDialogCmp) View() string { Padding(1, 0). Render(buttons) - help := styles.BaseStyle. - Width(maxWidth). - Padding(0, 1). - Foreground(styles.ForgroundDim). - Render("tab/←/→: toggle y/n: yes/no enter: confirm esc: cancel") - content := lipgloss.JoinVertical( lipgloss.Left, title, @@ -158,7 +153,6 @@ func (m InitDialogCmp) View() string { question, buttons, styles.BaseStyle.Width(maxWidth).Render(""), - help, ) return styles.BaseStyle.Padding(1, 2). diff --git a/internal/tui/components/dialog/permission.go b/internal/tui/components/dialog/permission.go index 16b63815c..8096fd960 100644 --- a/internal/tui/components/dialog/permission.go +++ b/internal/tui/components/dialog/permission.go @@ -64,15 +64,15 @@ var permissionsKeys = permissionsMapping{ ), Allow: key.NewBinding( key.WithKeys("a"), - key.WithHelp("a", "allow"), + key.WithHelp("a", "[a]llow"), ), AllowSession: key.NewBinding( - key.WithKeys("A"), - key.WithHelp("A", "allow for session"), + key.WithKeys("s"), + key.WithHelp("s", "allow for [s]ession"), ), Deny: key.NewBinding( key.WithKeys("d"), - key.WithHelp("d", "deny"), + key.WithHelp("d", "[d]eny"), ), Tab: key.NewBinding( key.WithKeys("tab"), @@ -375,9 +375,6 @@ func (p *permissionDialogCmp) render() string { contentFinal = p.renderDefaultContent() } - // Add help text - helpText := styles.BaseStyle.Width(p.width - 4).Padding(0, 1).Foreground(styles.ForgroundDim).Render("←/→/tab: switch options a: allow A: allow for session d: deny enter/space: confirm") - content := lipgloss.JoinVertical( lipgloss.Top, title, @@ -385,8 +382,7 @@ func (p *permissionDialogCmp) render() string { headerContent, contentFinal, buttons, - styles.BaseStyle.Render(strings.Repeat(" ", p.width - 4)), - helpText, + styles.BaseStyle.Render(strings.Repeat(" ", p.width-4)), ) return styles.BaseStyle. diff --git a/internal/tui/components/dialog/session.go b/internal/tui/components/dialog/session.go index 060875f91..2b26dacd1 100644 --- a/internal/tui/components/dialog/session.go +++ b/internal/tui/components/dialog/session.go @@ -122,6 +122,8 @@ func (s *sessionDialogCmp) View() string { } } + maxWidth = max(30, min(maxWidth, s.width-15)) // Limit width to avoid overflow + // Limit height to avoid taking up too much screen space maxVisibleSessions := min(10, len(s.sessions)) @@ -169,7 +171,6 @@ func (s *sessionDialogCmp) View() string { styles.BaseStyle.Width(maxWidth).Render(""), styles.BaseStyle.Width(maxWidth).Render(lipgloss.JoinVertical(lipgloss.Left, sessionItems...)), styles.BaseStyle.Width(maxWidth).Render(""), - styles.BaseStyle.Width(maxWidth).Padding(0, 1).Foreground(styles.ForgroundDim).Render("↑/k: up ↓/j: down enter: select esc: cancel"), ) return styles.BaseStyle.Padding(1, 2). @@ -223,4 +224,3 @@ func NewSessionDialogCmp() SessionDialog { selectedSessionID: "", } } - -- cgit v1.2.3