Skip to content

Commit b7fc883

Browse files
committed
Fix which-key dismissal and context popup floating
Changes: 1. Which-key window now disappears immediately when any key is pressed 2. Context edit popup now properly floats with border and background Which-Key Dismissal Fix: - Removed defer function (doesn't work with value receiver) - Set leaderActive = false immediately at start of handler - Window now vanishes as soon as you press an action key - More responsive UI feedback Context Popup Floating Fix: - Added proper border styling with RoundedBorder - Added dark background (#1a1a2e) for contrast - Added padding (1, 2) for visual separation - Border color (#4a4a6a) matches theme - Width automatically adjusts to content + 4 chars padding - Now clearly floats above/over content instead of displacing it The popup now visually pops out from the underlying content with a proper modal dialog appearance.
1 parent 8c0f495 commit b7fc883

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

internal/model/model.go

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,8 +1414,8 @@ func (m Model) handleLeaderKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
14141414
return m, nil
14151415
}
14161416

1417-
// Always exit leader mode after action
1418-
defer func() { m.leaderActive = false }()
1417+
// Exit leader mode immediately when any action key is pressed
1418+
m.leaderActive = false
14191419

14201420
// Global actions (available in any context)
14211421
switch key {
@@ -2382,8 +2382,6 @@ func (m Model) renderContextEditPopup() string {
23822382
return ""
23832383
}
23842384

2385-
var sb strings.Builder
2386-
23872385
// Title based on field type
23882386
var title string
23892387
var placeholder string
@@ -2409,13 +2407,25 @@ func (m Model) renderContextEditPopup() string {
24092407
}
24102408

24112409
// Build popup content
2412-
sb.WriteString(m.theme.Title.Render(title) + "\n")
2413-
sb.WriteString(m.theme.Dim.Render(strings.Repeat("─", 40)) + "\n\n")
2414-
sb.WriteString(m.theme.Normal.Render(placeholder) + "\n\n")
2415-
sb.WriteString(m.contextEditInput.View() + "\n\n")
2416-
sb.WriteString(m.theme.Dim.Render("Tab:autocomplete Enter:save Esc:cancel"))
2410+
var content strings.Builder
2411+
content.WriteString(m.theme.Title.Render(title) + "\n")
2412+
content.WriteString(m.theme.Dim.Render(strings.Repeat("─", 40)) + "\n\n")
2413+
content.WriteString(m.theme.Normal.Render(placeholder) + "\n\n")
2414+
content.WriteString(m.contextEditInput.View() + "\n\n")
2415+
content.WriteString(m.theme.Dim.Render("Tab:autocomplete Enter:save Esc:cancel"))
2416+
2417+
// Wrap content in a bordered box
2418+
contentStr := content.String()
2419+
2420+
// Style the popup with border and background
2421+
popupStyle := lipgloss.NewStyle().
2422+
Border(lipgloss.RoundedBorder()).
2423+
BorderForeground(lipgloss.Color("#4a4a6a")).
2424+
Background(lipgloss.Color("#1a1a2e")).
2425+
Padding(1, 2).
2426+
Width(lipgloss.Width(contentStr) + 4)
24172427

2418-
return sb.String()
2428+
return popupStyle.Render(contentStr)
24192429
}
24202430

24212431
func (m Model) renderHistory() string {

0 commit comments

Comments
 (0)