From 8d26b4ebd7c984ea732144f563c1cf6bffe33a5b Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Thu, 25 Jun 2020 12:42:31 -0400 Subject: [PATCH] Use mouse consts in termenv --- examples/go.mod | 2 +- examples/go.sum | 2 ++ go.mod | 4 ++-- go.sum | 8 ++++---- tea.go | 8 ++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/examples/go.mod b/examples/go.mod index 7e68404..5487454 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -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 ) diff --git a/examples/go.sum b/examples/go.sum index ed73e95..d2eb307 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -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= diff --git a/go.mod b/go.mod index 2805146..cac4c3e 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index fc282bd..cd438d5 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/tea.go b/tea.go index 5fa570b..a48a8dc 100644 --- a/tea.go +++ b/tea.go @@ -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) }