53abadbce7223b379a077e2ed6b863ff3e6cbaaa

Author
Ayman Bagabas <ayman.bagabas@gmail.com>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

feat: use bubblezone for better mouse support

Diff

  1diff --git a/go.mod b/go.mod
  2index 01e41a039390be81fce59442798c6df03a9e1724..0b84d26e1cdf6596d1e7061b8322470d47353f18 100755
  3--- a/go.mod
  4+++ b/go.mod
  5@@ -6,7 +6,7 @@ require (
  6 	github.com/alecthomas/chroma v0.10.0
  7 	github.com/caarlos0/env/v6 v6.9.1
  8 	github.com/charmbracelet/bubbles v0.11.0
  9-	github.com/charmbracelet/bubbletea v0.21.0
 10+	github.com/charmbracelet/bubbletea v0.22.0
 11 	github.com/charmbracelet/glamour v0.5.1-0.20220727183416-a99aac852791
 12 	github.com/charmbracelet/lipgloss v0.5.0
 13 	github.com/charmbracelet/wish v0.5.0
 14@@ -27,6 +27,7 @@ require (
 15 	github.com/gobwas/glob v0.2.3
 16 	github.com/gogs/git-module v1.6.1
 17 	github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
 18+	github.com/lrstanley/bubblezone v0.0.0-20220716194435-3cb8c52f6a8f
 19 	github.com/muesli/mango-cobra v1.2.0
 20 	github.com/muesli/roff v0.1.0
 21 	github.com/spf13/cobra v1.5.0
 22diff --git a/go.sum b/go.sum
 23index 895546613e726d6ee7e24de875ba2ddaddfcd75b..7f16699365bfcda0afa0e8616eb40d18346c99ad 100644
 24--- a/go.sum
 25+++ b/go.sum
 26@@ -29,10 +29,9 @@ github.com/caarlos0/sshmarshal v0.1.0/go.mod h1:7Pd/0mmq9x/JCzKauogNjSQEhivBclCQ
 27 github.com/charmbracelet/bubbles v0.11.0 h1:fBLyY0PvJnd56Vlu5L84JJH6f4axhgIJ9P3NET78f0Q=
 28 github.com/charmbracelet/bubbles v0.11.0/go.mod h1:bbeTiXwPww4M031aGi8UK2HT9RDWoiNibae+1yCMtcc=
 29 github.com/charmbracelet/bubbletea v0.20.0/go.mod h1:zpkze1Rioo4rJELjRyGlm9T2YNou1Fm4LIJQSa5QMEM=
 30-github.com/charmbracelet/bubbletea v0.21.0 h1:f3y+kanzgev5PA916qxmDybSHU3N804uOnKnhRPXTcI=
 31 github.com/charmbracelet/bubbletea v0.21.0/go.mod h1:GgmJMec61d08zXsOhqRC/AiOx4K4pmz+VIcRIm1FKr4=
 32-github.com/charmbracelet/glamour v0.5.0 h1:wu15ykPdB7X6chxugG/NNfDUbyyrCLV9XBalj5wdu3g=
 33-github.com/charmbracelet/glamour v0.5.0/go.mod h1:9ZRtG19AUIzcTm7FGLGbq3D5WKQ5UyZBbQsMQN0XIqc=
 34+github.com/charmbracelet/bubbletea v0.22.0 h1:E1BTNSE3iIrq0G0X6TjGAmrQ32cGCbFDPcIuImikrUc=
 35+github.com/charmbracelet/bubbletea v0.22.0/go.mod h1:aoVIwlNlr5wbCB26KhxfrqAn0bMp4YpJcoOelbxApjs=
 36 github.com/charmbracelet/glamour v0.5.1-0.20220727183416-a99aac852791 h1:FVfu61RRIkiQCsS0KSjLkZOMf0XF5RxQqXJraTDGp/M=
 37 github.com/charmbracelet/glamour v0.5.1-0.20220727183416-a99aac852791/go.mod h1:HXz79SMFnF9arKxqeoHWxmo1BhplAH7wehlRhKQIL94=
 38 github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
 39@@ -102,6 +101,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
 40 github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
 41 github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
 42 github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
 43+github.com/lrstanley/bubblezone v0.0.0-20220716194435-3cb8c52f6a8f h1:FjWlbnOxKSZpFlNhsx6xFy/OnkdYTAYTuoulojPdZ9o=
 44+github.com/lrstanley/bubblezone v0.0.0-20220716194435-3cb8c52f6a8f/go.mod h1:CxaUrg7Y6DmnquTpb1Rgxib+u+NcRxrDi8m/mR1poTM=
 45 github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
 46 github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
 47 github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
 48@@ -117,8 +118,6 @@ github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4
 49 github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
 50 github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 h1:Pijfgr7ZuvX7QIQiEwLdRVr3RoMG+i0SbBO1Qu+7yVk=
 51 github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo=
 52-github.com/microcosm-cc/bluemonday v1.0.17 h1:Z1a//hgsQ4yjC+8zEkV8IWySkXnsxmdSY642CTFQb5Y=
 53-github.com/microcosm-cc/bluemonday v1.0.17/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM=
 54 github.com/microcosm-cc/bluemonday v1.0.19 h1:OI7hoF5FY4pFz2VA//RN8TfM0YJ2dJcl4P4APrCWy6c=
 55 github.com/microcosm-cc/bluemonday v1.0.19/go.mod h1:QNzV2UbLK2/53oIIwTOyLUSABMkjZ4tqiyC1g/DyqxE=
 56 github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
 57diff --git a/server/session.go b/server/session.go
 58index de6f2d4c3d33a0fb2feb01181c8b5d6d04a3dc12..96aeba4a919ecf6afa290219cb4efdd74b2da904 100644
 59--- a/server/session.go
 60+++ b/server/session.go
 61@@ -12,6 +12,7 @@ import (
 62 	"github.com/charmbracelet/soft-serve/ui/styles"
 63 	bm "github.com/charmbracelet/wish/bubbletea"
 64 	"github.com/gliderlabs/ssh"
 65+	zone "github.com/lrstanley/bubblezone"
 66 )
 67 
 68 // SessionHandler is the soft-serve bubbletea ssh session handler.
 69@@ -38,6 +39,7 @@ func SessionHandler(ac *appCfg.Config) bm.ProgramHandler {
 70 			KeyMap: keymap.DefaultKeyMap(),
 71 			Width:  pty.Window.Width,
 72 			Height: pty.Window.Height,
 73+			Zone:   zone.New(),
 74 		}
 75 		m := ui.New(
 76 			ac,
 77diff --git a/ui/common/common.go b/ui/common/common.go
 78index f18d0298b00422d343f382682c031b15301e02c0..8a5cb451a92824ba6289b438c0b03919bfbeba0a 100644
 79--- a/ui/common/common.go
 80+++ b/ui/common/common.go
 81@@ -4,6 +4,7 @@ import (
 82 	"github.com/aymanbagabas/go-osc52"
 83 	"github.com/charmbracelet/soft-serve/ui/keymap"
 84 	"github.com/charmbracelet/soft-serve/ui/styles"
 85+	zone "github.com/lrstanley/bubblezone"
 86 )
 87 
 88 // Common is a struct all components should embed.
 89@@ -13,6 +14,7 @@ type Common struct {
 90 	KeyMap *keymap.KeyMap
 91 	Width  int
 92 	Height int
 93+	Zone   *zone.Manager
 94 }
 95 
 96 // SetSize sets the width and height of the common struct.
 97diff --git a/ui/ui.go b/ui/ui.go
 98index c87c69adec4cbe3c5429a1309da094e29b122907..2e0db8c8009d6d2048e76d2585216df9d6dcdc55 100644
 99--- a/ui/ui.go
100+++ b/ui/ui.go
101@@ -267,7 +267,9 @@ func (ui *UI) View() string {
102 	if ui.showFooter {
103 		view = lipgloss.JoinVertical(lipgloss.Left, view, ui.footer.View())
104 	}
105-	return ui.common.Styles.App.Render(view)
106+	return ui.common.Zone.Scan(
107+		ui.common.Styles.App.Render(view),
108+	)
109 }
110 
111 func (ui *UI) setRepoCmd(rn string) tea.Cmd {