diff options
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-rw-r--r-- | vendor/github.com/jesseduffield/gocui/gui.go | 14 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
4 files changed, 18 insertions, 2 deletions
@@ -13,7 +13,7 @@ require ( github.com/golang/protobuf v1.3.2 // indirect github.com/google/go-cmp v0.3.1 // indirect github.com/integrii/flaggy v1.4.0 - github.com/jesseduffield/gocui v0.3.1-0.20200823073938-1a970a28d894 + github.com/jesseduffield/gocui v0.3.1-0.20200824095914-9ea1e384f70d github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe // indirect github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect @@ -96,6 +96,8 @@ github.com/jesseduffield/gocui v0.3.1-0.20200513110002-8cde0b9be542 h1:ezzJM/NZh github.com/jesseduffield/gocui v0.3.1-0.20200513110002-8cde0b9be542/go.mod h1:2RtZznzYKt8RLRwvFiSkXjU0Ei8WwHdubgnlaYH47dw= github.com/jesseduffield/gocui v0.3.1-0.20200823073938-1a970a28d894 h1:HEIHfYk0RQ7wxG2ibPGZCYDrL9j6Qzf6jXPdkT8ujlE= github.com/jesseduffield/gocui v0.3.1-0.20200823073938-1a970a28d894/go.mod h1:2RtZznzYKt8RLRwvFiSkXjU0Ei8WwHdubgnlaYH47dw= +github.com/jesseduffield/gocui v0.3.1-0.20200824095914-9ea1e384f70d h1:8vOu04nW4gmaP/z0A4BsSsytiNkntYH3Z/qj1vbbCf4= +github.com/jesseduffield/gocui v0.3.1-0.20200824095914-9ea1e384f70d/go.mod h1:2RtZznzYKt8RLRwvFiSkXjU0Ei8WwHdubgnlaYH47dw= github.com/jesseduffield/termbox-go v0.0.0-20200130214842-1d31d1faa3c9 h1:iBBk1lhFwjwJw//J2m1yyz9S368GeXQTpMVACTyQMh0= github.com/jesseduffield/termbox-go v0.0.0-20200130214842-1d31d1faa3c9/go.mod h1:anMibpZtqNxjDbxrcDEAwSdaJ37vyUeM1f/M4uekib4= github.com/jesseduffield/termbox-go v0.0.0-20200405031649-4dc645f7e8ba h1:hWBdYchM9nZ2+GldroQQ627ISOC83iRDdpfwY+uyJeI= diff --git a/vendor/github.com/jesseduffield/gocui/gui.go b/vendor/github.com/jesseduffield/gocui/gui.go index 1426fc277..35efa49da 100644 --- a/vendor/github.com/jesseduffield/gocui/gui.go +++ b/vendor/github.com/jesseduffield/gocui/gui.go @@ -833,6 +833,20 @@ func (g *Gui) onKey(ev *termbox.Event) error { } } } + + newCx := mx - v.x0 - 1 + newCy := my - v.y0 - 1 + // if view is editable don't go further than the furthest character for that line + if v.Editable && newCy >= 0 && newCy <= len(v.lines)-1 { + lastCharForLine := len(v.lines[newCy]) + if lastCharForLine < newCx { + newCx = lastCharForLine + } + } + if err := v.SetCursor(newCx, newCy); err != nil { + return err + } + if err := v.SetCursor(mx-v.x0-1, my-v.y0-1); err != nil { return err } diff --git a/vendor/modules.txt b/vendor/modules.txt index 863583aeb..3205beebf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -99,7 +99,7 @@ github.com/hashicorp/hcl/json/token github.com/integrii/flaggy # github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 github.com/jbenet/go-context/io -# github.com/jesseduffield/gocui v0.3.1-0.20200823073938-1a970a28d894 +# github.com/jesseduffield/gocui v0.3.1-0.20200824095914-9ea1e384f70d ## explicit github.com/jesseduffield/gocui # github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe |