on main help sign in
fix(ui): editor: show yolo prompt correctly
7b19142Ayman Bagabas
internal/ui/model/ui.go+10−5
@@ -151,7 +151,7 @@ func New(com *common.Common) *UI {
151 ui.focus = uiFocusEditor
151 ui.focus = uiFocusEditor
152 }
152 }
153
153
154− ui.setEditorPrompt()
154+ ui.setEditorPrompt(false)
155 ui.randomizePlaceholders()
155 ui.randomizePlaceholders()
156 ui.textarea.Placeholder = ui.readyPlaceholder
156 ui.textarea.Placeholder = ui.readyPlaceholder
157 ui.help.Styles = com.Styles.Help
157 ui.help.Styles = com.Styles.Help
@@ -390,7 +390,9 @@ func (m *UI) handleKeyPressMsg(msg tea.KeyPressMsg) (cmds []tea.Cmd) {
390
390
391 // Command dialog messages
391 // Command dialog messages
392 case dialog.ToggleYoloModeMsg:
392 case dialog.ToggleYoloModeMsg:
393− m.com.App.Permissions.SetSkipRequests(!m.com.App.Permissions.SkipRequests())
393+ yolo := !m.com.App.Permissions.SkipRequests()
394+ m.com.App.Permissions.SetSkipRequests(yolo)
395+ m.setEditorPrompt(yolo)
394 m.dialog.CloseDialog(dialog.CommandsID)
396 m.dialog.CloseDialog(dialog.CommandsID)
395 case dialog.SwitchSessionsMsg:
397 case dialog.SwitchSessionsMsg:
396 cmds = append(cmds, m.listSessions)
398 cmds = append(cmds, m.listSessions)
@@ -927,8 +929,8 @@ type layout struct {
927
929
928// setEditorPrompt configures the textarea prompt function based on whether
930// setEditorPrompt configures the textarea prompt function based on whether
929// yolo mode is enabled.
931// yolo mode is enabled.
930−func (m *UI) setEditorPrompt() {
932+func (m *UI) setEditorPrompt(yolo bool) {
931− if m.com.App.Permissions.SkipRequests() {
933+ if yolo {
932 m.textarea.SetPromptFunc(4, m.yoloPromptFunc)
934 m.textarea.SetPromptFunc(4, m.yoloPromptFunc)
933 return
935 return
934 }
936 }
@@ -940,7 +942,10 @@ func (m *UI) setEditorPrompt() {
940func (m *UI) normalPromptFunc(info textarea.PromptInfo) string {
942func (m *UI) normalPromptFunc(info textarea.PromptInfo) string {
941 t := m.com.Styles
943 t := m.com.Styles
942 if info.LineNumber == 0 {
944 if info.LineNumber == 0 {
945+ if info.Focused {
943− return " > "
946+ return " > "
947+ }
948+ return "::: "
944 }
949 }
945 if info.Focused {
950 if info.Focused {
946 return t.EditorPromptNormalFocused.Render()
951 return t.EditorPromptNormalFocused.Render()
internal/ui/styles/styles.go+2−2
@@ -828,9 +828,9 @@ func DefaultStyles() Styles {
828 // Editor
828 // Editor
829 s.EditorPromptNormalFocused = lipgloss.NewStyle().Foreground(greenDark).SetString("::: ")
829 s.EditorPromptNormalFocused = lipgloss.NewStyle().Foreground(greenDark).SetString("::: ")
830 s.EditorPromptNormalBlurred = s.EditorPromptNormalFocused.Foreground(fgMuted)
830 s.EditorPromptNormalBlurred = s.EditorPromptNormalFocused.Foreground(fgMuted)
831− s.EditorPromptYoloIconFocused = lipgloss.NewStyle().Foreground(charmtone.Oyster).Background(charmtone.Citron).Bold(true).SetString(" ! ")
831+ s.EditorPromptYoloIconFocused = lipgloss.NewStyle().MarginRight(1).Foreground(charmtone.Oyster).Background(charmtone.Citron).Bold(true).SetString(" ! ")
832 s.EditorPromptYoloIconBlurred = s.EditorPromptYoloIconFocused.Foreground(charmtone.Pepper).Background(charmtone.Squid)
832 s.EditorPromptYoloIconBlurred = s.EditorPromptYoloIconFocused.Foreground(charmtone.Pepper).Background(charmtone.Squid)
833− s.EditorPromptYoloDotsFocused = lipgloss.NewStyle().Foreground(charmtone.Zest).SetString(":::")
833+ s.EditorPromptYoloDotsFocused = lipgloss.NewStyle().MarginRight(1).Foreground(charmtone.Zest).SetString(":::")
834 s.EditorPromptYoloDotsBlurred = s.EditorPromptYoloDotsFocused.Foreground(charmtone.Squid)
834 s.EditorPromptYoloDotsBlurred = s.EditorPromptYoloDotsFocused.Foreground(charmtone.Squid)
835
835
836 // Logo colors
836 // Logo colors