Skip to content
Myr

Use mouse consts in termenv

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent f3fd9de · Browse files · 5 files+13 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+13 added−11 removed

  • other:+13 added−11 removed

5 files+13 added−11 removed

modified:examples/go.mod+1 added-1 removed
7 unmodified lines
8 github.com/charmbracelet/bubbles v0.3.1-0.20200623160017-c9196e5407ad9 github.com/charmbracelet/bubbletea v0.9.1-0.20200623143446-d6cf9e69b6f210 github.com/fogleman/ease v0.0.0-20170301025033-8da417bf177611 github.com/mattn/go-runewidth v0.0.912 github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c012 github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c0413 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect14 golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 // indirect15)
modified:examples/go.sum+2 added
12 unmodified lines
13github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=14github.com/muesli/termenv v0.5.3-0.20200617122104-66d435cfe924/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=15github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0 h1:IASsj5pQ478TEN9TLiuhP+ugUQEotZ1QdzQvcJUQ1dM=16github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=17github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04 h1:Wr876oXlAk6avTWi0daXAriOr+r5fqIuyDmtNc/KwY0=18github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=19github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03 h1:pd4YKIqCB0U7O2I4gWHgEUA2mCEOENmco0l/bM957bU=20github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03/go.mod h1:Z9+Ul5bCbBKnbCvdOWbLqTHhJiYV414CURZJba6L8qA=21golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=22golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM=
13 unmodified lines
modified:go.mod+2 added-2 removed
1 unmodified line
23go 1.1345require (6 github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c06 github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c047 github.com/pkg/term v0.0.0-20200520122047-c3ffed290a038 golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf99 golang.org/x/sys v0.0.0-20200620081246-981b61492c35 // indirect9 golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 // indirect10)
modified:go.sum+4 added-4 removed
2 unmodified lines
3github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=4github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=5github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=6github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=7github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0 h1:IASsj5pQ478TEN9TLiuhP+ugUQEotZ1QdzQvcJUQ1dM=8github.com/muesli/termenv v0.5.3-0.20200617154346-da5de72b61c0/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=7github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04 h1:Wr876oXlAk6avTWi0daXAriOr+r5fqIuyDmtNc/KwY0=8github.com/muesli/termenv v0.5.3-0.20200625163851-04b5c30e4c04/go.mod h1:O1/I6sw+6KcrgAmcs6uiUVr7Lui+DNVbHTzt9Lm/PlI=9github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03 h1:pd4YKIqCB0U7O2I4gWHgEUA2mCEOENmco0l/bM957bU=10github.com/pkg/term v0.0.0-20200520122047-c3ffed290a03/go.mod h1:Z9+Ul5bCbBKnbCvdOWbLqTHhJiYV414CURZJba6L8qA=11golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=12golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM=
1 unmodified line
14golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=15golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=16golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=17golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=18golang.org/x/sys v0.0.0-20200620081246-981b61492c35 h1:wb/9mP8eUAmHfkM8RmpeLq6nUA7c2i5+bQOtcDftjaE=19golang.org/x/sys v0.0.0-20200620081246-981b61492c35/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=18golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4 h1:5/PjkGUjvEU5Gl6BxmvKRPpqo2uNMv4rcHBMwzk/st8=19golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=20golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
modified:tea.go+4 added-4 removed
208 unmodified lines
209// button is pressed.210func (p *Program) EnableMouseCellMotion() {211 p.mtx.Lock()212 defer p.mtx.Unlock()213 fmt.Fprintf(p.output, te.CSI+"?1002h")213 fmt.Fprintf(p.output, te.CSI+te.EnableMouseCellMotionSeq)214}215216// DisableMouseCellMotino disables Mouse Cell Motion tracking. If you've217// enabled Cell Motion mouse trakcing be sure to call this as your program is218// exiting or your users will be very upset!219func (p *Program) DisableMouseCellMotion() {220 p.mtx.Lock()221 defer p.mtx.Unlock()222 fmt.Fprintf(p.output, te.CSI+"?1002l")222 fmt.Fprintf(p.output, te.CSI+te.DisableMouseCellMotionSeq)223}224225// EnableMouseAllMotion enables mouse click, release, wheel and motion events,226// regardless of whether a button is pressed. Many modern terminals support227// this, but not all.228func (p *Program) EnableMouseAllMotion() {229 p.mtx.Lock()230 defer p.mtx.Unlock()231 fmt.Fprintf(p.output, te.CSI+"?1003h")231 fmt.Fprintf(p.output, te.CSI+te.EnableMouseAllMotionSeq)232}233234// DisableMouseAllMotion disables All Motion mouse tracking. If you've enabled235// All Motion mouse tracking be sure you call this as your program is exiting236// or your users will be very upset!237func (p *Program) DisableMouseAllMotion() {238 p.mtx.Lock()239 defer p.mtx.Unlock()240 fmt.Fprintf(p.output, te.CSI+"?1003l")240 fmt.Fprintf(p.output, te.CSI+te.DisableMouseAllMotionSeq)241}