From c7181967d828b3491bca84698575845fcee1802a Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Tue, 20 May 2025 11:31:23 -0500 Subject: [PATCH 1/2] DevMode: remove mouse tracking as it caused the inability to copy/paste in the terminal --- go.mod | 1 - go.sum | 2 -- internal/dev/tui.go | 34 +++------------------------------- 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/go.mod b/go.mod index fd335441..1c33eb25 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,6 @@ require ( github.com/evanw/esbuild v0.25.0 github.com/fsnotify/fsnotify v1.7.0 github.com/google/uuid v1.6.0 - github.com/lrstanley/bubblezone v1.0.0 github.com/marcozac/go-jsonc v0.1.1 github.com/mattn/go-isatty v0.0.20 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c diff --git a/go.sum b/go.sum index 193d1076..9d42fe23 100644 --- a/go.sum +++ b/go.sum @@ -152,8 +152,6 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lrstanley/bubblezone v1.0.0 h1:bIpUaBilD42rAQwlg/4u5aTqVAt6DSRKYZuSdmkr8UA= -github.com/lrstanley/bubblezone v1.0.0/go.mod h1:kcTekA8HE/0Ll2bWzqHlhA2c513KDNLW7uDfDP4Mly8= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= diff --git a/internal/dev/tui.go b/internal/dev/tui.go index c1ef2109..bca1b0bd 100644 --- a/internal/dev/tui.go +++ b/internal/dev/tui.go @@ -15,8 +15,6 @@ import ( "github.com/charmbracelet/bubbles/viewport" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" - "github.com/google/uuid" - zone "github.com/lrstanley/bubblezone" "golang.org/x/term" ) @@ -62,15 +60,14 @@ type spinnerStartMsg struct{} type spinnerStopMsg struct{} type logItem struct { - id string timestamp time.Time message string raw string } -func (i logItem) Title() string { return zone.Mark(i.id, i.message) } +func (i logItem) Title() string { return i.message } func (i logItem) Description() string { return "" } -func (i logItem) FilterValue() string { return zone.Mark(i.id, i.message) } +func (i logItem) FilterValue() string { return i.message } type tickMsg time.Time type addLogMsg logItem @@ -213,28 +210,6 @@ func (m *model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.spinner = sm cmd = append(cmd, c) break - case tea.MouseMsg: - if !m.showhelp && !m.showagents && !m.logList.SettingFilter() && m.selectedLog == nil { - if msg.Button == tea.MouseButtonWheelUp { - m.logList.CursorUp() - } else if msg.Button == tea.MouseButtonWheelDown { - m.logList.CursorDown() - } else if msg.Button == tea.MouseButtonLeft && msg.Action == tea.MouseActionRelease { - // try and find the item that was clicked on - for i, listItem := range m.logList.VisibleItems() { - v, _ := listItem.(logItem) - if zone.Get(v.id).InBounds(msg) { - index := i - 1 - if index < 0 { - index = 0 - } - m.logList.Select(index) - break - } - } - } - } - break case tea.KeyMsg: if msg.Type == tea.KeyCtrlC { cmd = append(cmd, tea.Quit) @@ -406,7 +381,7 @@ func (m *model) View() string { view = " " } - return zone.Scan(fmt.Sprintf("%s\n%s\n%s", m.infoBox, view+statusMsgStyle.Render(m.statusMessage), m.logList.View())) + return fmt.Sprintf("%s\n%s\n%s", m.infoBox, view+statusMsgStyle.Render(m.statusMessage), m.logList.View()) } type Agent struct { @@ -509,11 +484,9 @@ func (d *DevModeUI) Start() { if !d.enabled { return } - zone.NewGlobal() d.program = tea.NewProgram( d.model, tea.WithoutSignalHandler(), - tea.WithMouseAllMotion(), ) d.wg.Add(1) go func() { @@ -536,7 +509,6 @@ func (d *DevModeUI) AddLog(log string, args ...any) { } raw := fmt.Sprintf(log, args...) d.program.Send(addLogMsg{ - id: uuid.New().String(), timestamp: time.Now(), raw: raw, message: strings.ReplaceAll(ansiColorStripper.ReplaceAllString(raw, ""), "\n", " "), From 8a5e59d317bfa14af0eb7ae6d25d88561ec63809 Mon Sep 17 00:00:00 2001 From: Jeff Haynie Date: Tue, 20 May 2025 11:35:43 -0500 Subject: [PATCH 2/2] fix nitpick --- internal/dev/tui.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/dev/tui.go b/internal/dev/tui.go index bca1b0bd..36d8a79e 100644 --- a/internal/dev/tui.go +++ b/internal/dev/tui.go @@ -568,7 +568,7 @@ func (d *DevModeUI) SetSpinner(spinning bool) { } } }() - } else { + } else if d.spinnerCtx != nil { d.spinnerCancel() d.spinnerCtx = nil d.program.Send(spinnerStopMsg{})