Use mouse consts in termenv

This commit is contained in:
Christian Rocha 2020-06-25 12:42:31 -04:00
parent f3fd9decc9
commit 8d26b4ebd7
No known key found for this signature in database
GPG Key ID: D6CC7A16E5878018
5 changed files with 13 additions and 11 deletions

View File

@ -9,7 +9,7 @@ require (
github.com/charmbracelet/bubbletea v0.9.1-0.20200623143446-d6cf9e69b6f2
github.com/fogleman/ease v0.0.0-20170301025033-8da417bf1776
github.com/mattn/go-runewidth v0.0.9
github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0
github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 // indirect
)

View File

@ -14,6 +14,8 @@ github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m
github.com/muesli/termenv v0.5.3-0.20200617122104-66d435cfe924/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=
github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0 h1:IASsj5pQ478TEN9TLiuhP+ugUQEotZ1QdzQvcJUQ1dM=
github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=
github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04 h1:Wr876oXlAk6avTWi0daXAriOr+r5fqIuyDmtNc/KwY0=
github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=
github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03 h1:pd4YKIqCB0U7O2I4gWHgEUA2mCEOENmco0l/bM957bU=
github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03/go.mod h1:Z9+Ul5bCbBKnbCvdOWbLqTHhJiYV414CURZJba6L8qA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

4
go.mod
View File

@ -3,8 +3,8 @@ module github.com/charmbracelet/bubbletea
go 1.13
require (
github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0
github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04
github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
golang.org/x/sys v0.0.0-20200620081246-981b61492c35 // indirect
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 // indirect
)

8
go.sum
View File

@ -4,8 +4,8 @@ github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tW
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0 h1:IASsj5pQ478TEN9TLiuhP+ugUQEotZ1QdzQvcJUQ1dM=
github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=
github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04 h1:Wr876oXlAk6avTWi0daXAriOr+r5fqIuyDmtNc/KwY0=
github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=
github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03 h1:pd4YKIqCB0U7O2I4gWHgEUA2mCEOENmco0l/bM957bU=
github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03/go.mod h1:Z9+Ul5bCbBKnbCvdOWbLqTHhJiYV414CURZJba6L8qA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@ -15,6 +15,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200620081246-981b61492c35 h1:wb/9mP8eUAmHfkM8RmpeLq6nUA7c2i5+bQOtcDftjaE=
golang.org/x/sys v0.0.0-20200620081246-981b61492c35/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 h1:5/PjkGUjvEU5Gl6BxmvKRPpqo2uNMv4rcHBMwzk/st8=
golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

8
tea.go
View File

@ -210,7 +210,7 @@ func (p *Program) ExitAltScreen() {
func (p *Program) EnableMouseCellMotion() {
p.mtx.Lock()
defer p.mtx.Unlock()
fmt.Fprintf(p.output, te.CSI+"?1002h")
fmt.Fprintf(p.output, te.CSI+te.EnableMouseCellMotionSeq)
}
// DisableMouseCellMotino disables Mouse Cell Motion tracking. If you've
@ -219,7 +219,7 @@ func (p *Program) EnableMouseCellMotion() {
func (p *Program) DisableMouseCellMotion() {
p.mtx.Lock()
defer p.mtx.Unlock()
fmt.Fprintf(p.output, te.CSI+"?1002l")
fmt.Fprintf(p.output, te.CSI+te.DisableMouseCellMotionSeq)
}
// EnableMouseAllMotion enables mouse click, release, wheel and motion events,
@ -228,7 +228,7 @@ func (p *Program) DisableMouseCellMotion() {
func (p *Program) EnableMouseAllMotion() {
p.mtx.Lock()
defer p.mtx.Unlock()
fmt.Fprintf(p.output, te.CSI+"?1003h")
fmt.Fprintf(p.output, te.CSI+te.EnableMouseAllMotionSeq)
}
// DisableMouseAllMotion disables All Motion mouse tracking. If you've enabled
@ -237,5 +237,5 @@ func (p *Program) EnableMouseAllMotion() {
func (p *Program) DisableMouseAllMotion() {
p.mtx.Lock()
defer p.mtx.Unlock()
fmt.Fprintf(p.output, te.CSI+"?1003l")
fmt.Fprintf(p.output, te.CSI+te.DisableMouseAllMotionSeq)
}