summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-04-18 10:05:52 +0200
committerStefan Haller <stefan@haller-berlin.de>2024-04-18 10:10:30 +0200
commit9f8ae76189e61c0133ea6891ddcb30db09645b40 (patch)
tree4a5e0721e07aa0fa2ec2258c66da4d42bf7f9e1c
parent8a77e51576e70fe0d4d769df62df282f7259c3e6 (diff)
Bump gocui
In Gui.onWorker we only make the minimum possible change to get things to compile after the API-breaking change of the gocui update; we'll make this cleaner later in this branch.
-rw-r--r--go.mod8
-rw-r--r--go.sum15
-rw-r--r--pkg/gui/gui.go9
-rw-r--r--vendor/github.com/gdamore/encoding/CODE_OF_CONDUCT.md73
-rw-r--r--vendor/github.com/gdamore/encoding/README.md9
-rw-r--r--vendor/github.com/gdamore/encoding/SECURITY.md12
-rw-r--r--vendor/github.com/gdamore/encoding/charmap.go5
-rw-r--r--vendor/github.com/jesseduffield/gocui/escape.go21
-rw-r--r--vendor/github.com/jesseduffield/gocui/gui.go49
-rw-r--r--vendor/github.com/jesseduffield/gocui/gui_others.go18
-rw-r--r--vendor/github.com/jesseduffield/gocui/gui_windows.go10
-rw-r--r--vendor/github.com/jesseduffield/gocui/keybinding.go4
-rw-r--r--vendor/github.com/jesseduffield/gocui/view.go4
-rw-r--r--vendor/golang.org/x/sys/unix/mmap_nomremap.go2
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_zos_s390x.go8
-rw-r--r--vendor/golang.org/x/sys/windows/syscall_windows.go82
-rw-r--r--vendor/golang.org/x/sys/windows/types_windows.go24
-rw-r--r--vendor/golang.org/x/sys/windows/zsyscall_windows.go126
-rw-r--r--vendor/modules.txt8
19 files changed, 392 insertions, 95 deletions
diff --git a/go.mod b/go.mod
index 8993d7504..2768d0815 100644
--- a/go.mod
+++ b/go.mod
@@ -16,7 +16,7 @@ require (
github.com/integrii/flaggy v1.4.0
github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68
github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d
- github.com/jesseduffield/gocui v0.3.1-0.20240309085756-86e0d5a312de
+ github.com/jesseduffield/gocui v0.3.1-0.20240418080333-8cd33929c513
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
@@ -47,7 +47,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/fatih/color v1.9.0 // indirect
- github.com/gdamore/encoding v1.0.0 // indirect
+ github.com/gdamore/encoding v1.0.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.0.0 // indirect
github.com/go-logfmt/logfmt v0.5.0 // indirect
@@ -73,8 +73,8 @@ require (
github.com/xanzy/ssh-agent v0.2.1 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/net v0.7.0 // indirect
- golang.org/x/sys v0.18.0 // indirect
- golang.org/x/term v0.18.0 // indirect
+ golang.org/x/sys v0.19.0 // indirect
+ golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
)
diff --git a/go.sum b/go.sum
index ee6c9cfbb..e9b355692 100644
--- a/go.sum
+++ b/go.sum
@@ -87,8 +87,9 @@ github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI
github.com/fsmiamoto/git-todo-parser v0.0.5 h1:Bhzd/vz/6Qm3udfkd6NO9fWfD3TpwR9ucp3N75/J5I8=
github.com/fsmiamoto/git-todo-parser v0.0.5/go.mod h1:B+AgTbNE2BARvJqzXygThzqxLIaEWvwr2sxKYYb0Fas=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
-github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
+github.com/gdamore/encoding v1.0.1 h1:YzKZckdBL6jVt2Gc+5p82qhrGiqMdG/eNs6Wy0u3Uhw=
+github.com/gdamore/encoding v1.0.1/go.mod h1:0Z0cMFinngz9kS1QfMjCP8TY7em3bZYeeklsSDPivEo=
github.com/gdamore/tcell/v2 v2.7.4 h1:sg6/UnTM9jGpZU+oFYAsDahfchWAFW8Xx2yFinNSAYU=
github.com/gdamore/tcell/v2 v2.7.4/go.mod h1:dSXtXTSK0VsW1biw65DZLZ2NKr7j0qP/0J7ONmsraWg=
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
@@ -187,8 +188,8 @@ github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68 h1:EQP2Tv8T
github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68/go.mod h1:+LLj9/WUPAP8LqCchs7P+7X0R98HiFujVFANdNaxhGk=
github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d h1:bO+OmbreIv91rCe8NmscRwhFSqkDJtzWCPV4Y+SQuXE=
github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o=
-github.com/jesseduffield/gocui v0.3.1-0.20240309085756-86e0d5a312de h1:2ww1SWgakihE8hFxZ7L3agVeGpA6qwW5vdnhFUXKMQo=
-github.com/jesseduffield/gocui v0.3.1-0.20240309085756-86e0d5a312de/go.mod h1:XtEbqCbn45keRXEu+OMZkjN5gw6AEob59afsgHjokZ8=
+github.com/jesseduffield/gocui v0.3.1-0.20240418080333-8cd33929c513 h1:Y1bw5iItrsDCumATc/rklIJ/6K+68ieiWZJedhrNuXo=
+github.com/jesseduffield/gocui v0.3.1-0.20240418080333-8cd33929c513/go.mod h1:XtEbqCbn45keRXEu+OMZkjN5gw6AEob59afsgHjokZ8=
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10 h1:jmpr7KpX2+2GRiE91zTgfq49QvgiqB0nbmlwZ8UnOx0=
github.com/jesseduffield/kill v0.0.0-20220618033138-bfbe04675d10/go.mod h1:aA97kHeNA+sj2Hbki0pvLslmE4CbDyhBeSSTUUnOuVo=
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5 h1:CDuQmfOjAtb1Gms6a1p5L2P8RhbLUq5t8aL7PiQd2uY=
@@ -469,14 +470,14 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
-golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
+golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
-golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
-golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
+golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
+golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 8a17bb2c2..67ae7f2ab 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -956,8 +956,13 @@ func (gui *Gui) onUIThread(f func() error) {
})
}
-func (gui *Gui) onWorker(f func(gocui.Task)) {
- gui.g.OnWorker(f)
+func (gui *Gui) onWorker(f func(t gocui.Task)) {
+ gui.g.OnWorker(func(t gocui.Task) error {
+ // Hack: adapt to the changed signature in the simplest possible way.
+ // We'll make this cleaner in subsequent commits in this branch.
+ f(t)
+ return nil
+ })
}
func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map[string]boxlayout.Dimensions {
diff --git a/vendor/github.com/gdamore/encoding/CODE_OF_CONDUCT.md b/vendor/github.com/gdamore/encoding/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..65527da08
--- /dev/null
+++ b/vendor/github.com/gdamore/encoding/CODE_OF_CONDUCT.md
@@ -0,0 +1,73 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at garrett@damore.org. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
diff --git a/vendor/github.com/gdamore/encoding/README.md b/vendor/github.com/gdamore/encoding/README.md
index 3db2b4c58..2ce29a9f3 100644
--- a/vendor/github.com/gdamore/encoding/README.md
+++ b/vendor/github.com/gdamore/encoding/README.md
@@ -1,10 +1,11 @@
## encoding
-[![Linux Status](https://img.shields.io/travis/gdamore/encoding.svg?label=linux)](https://travis-ci.org/gdamore/encoding)
-[![Windows Status](https://img.shields.io/appveyor/ci/gdamore/encoding.svg?label=windows)](https://ci.appveyor.com/project/gdamore/encoding)
-[![Apache License](https://img.shields.io/badge/license-APACHE2-blue.svg)](https://github.com/gdamore/encoding/blob/master/LICENSE)
+
+[![Linux](https://img.shields.io/github/actions/workflow/status/gdamore/encoding/linux.yml?branch=main&logoColor=grey&logo=linux&label=)](https://github.com/gdamore/encoding/actions/workflows/linux.yml)
+[![Windows](https://img.shields.io/github/actions/workflow/status/gdamore/encoding/windows.yml?branch=main&logoColor=grey&logo=windows&label=)](https://github.com/gdamore/encoding/actions/workflows/windows.yml)
+[![Apache License](https://img.shields.io/github/license/gdamore/encoding.svg?logoColor=silver&logo=opensourceinitiative&color=blue&label=)](https://github.com/gdamore/encoding/blob/master/LICENSE)
+[![Coverage](https://img.shields.io/codecov/c/github/gdamore/encoding?logoColor=grey&logo=codecov&label=)](https://codecov.io/gh/gdamore/encoding)
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/gdamore/encoding)
-[![Go Report Card](http://goreportcard.com/badge/gdamore/encoding)](http://goreportcard.com/report/gdamore/encoding)
Package encoding provides a number of encodings that are missing from the
standard Go [encoding]("https://godoc.org/golang.org/x/text/encoding") package.
diff --git a/vendor/github.com/gdamore/encoding/SECURITY.md b/vendor/github.com/gdamore/encoding/SECURITY.md
new file mode 100644
index 000000000..b9f64966f
--- /dev/null
+++ b/vendor/github.com/gdamore/encoding/SECURITY.md
@@ -0,0 +1,12 @@
+# Security Policy
+
+We take security very seriously in mangos, since you may be using it in
+Internet-facing applications.
+
+## Reporting a Vulnerability
+
+To report a vulnerability, please contact us on our discord.
+You may also send an email to garrett@damore.org, or info@staysail.tech.
+
+We will keep the reporter updated on any status updates on a regular basis,
+and will respond within two business days for any reported security issue.
diff --git a/vendor/github.com/gdamore/encoding/charmap.go b/vendor/github.com/gdamore/encoding/charmap.go
index db1c33ef7..e8089c453 100644
--- a/vendor/github.com/gdamore/encoding/charmap.go
+++ b/vendor/github.com/gdamore/encoding/charmap.go
@@ -1,4 +1,4 @@
-// Copyright 2015 Garrett D'Amore
+// Copyright 2024 Garrett D'Amore
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
@@ -52,7 +52,6 @@ const (
// direction takes about 100 nsec/op. (The larger cost for conversion
// from UTF-8 is most likely due to the need to convert the UTF-8 byte stream
// to a rune before conversion.
-//
type Charmap struct {
transform.NopResetter
bytes map[rune]byte
@@ -177,7 +176,7 @@ func (d *cmapEncoder) Transform(dst, src []byte, atEOF bool) (int, int, error) {
if r == utf8.RuneError && sz == 1 {
// If its inconclusive due to insufficient data in
// in the source, report it
- if !atEOF && !utf8.FullRune(src[nsrc:]) {
+ if atEOF && !utf8.FullRune(src[nsrc:]) {
e = transform.ErrShortSrc
break
}
diff --git a/vendor/github.com/jesseduffield/gocui/escape.go b/vendor/github.com/jesseduffield/gocui/escape.go
index 64c6b4448..b52c21495 100644
--- a/vendor/github.com/jesseduffield/gocui/escape.go
+++ b/vendor/github.com/jesseduffield/gocui/escape.go
@@ -322,27 +322,6 @@ func (ei *escapeInterpreter) csiColor(param []string) (color Attribute, skip int
}
}
-// splitFgBg splits foreground and background color according to ANSI sequence.
-//
-// num (number of segments in ansi) is used to determine if it's 256 mode or rgb mode (3 - 256-color, 5 - rgb-color)
-func splitFgBg(params []string, num int) [][]string {
- var out [][]string
- var current []string
- for _, p := range params {
- if len(current) == num && (p == "48" || p == "38") {
- out = append(out, current)
- current = []string{}
- }
- current = append(current, p)
- }
-
- if len(current) > 0 {
- out = append(out, current)
- }
-
- return out
-}
-
func getFontEffect(f int) Attribute {
switch fontEffect(f) {
case bold:
diff --git a/vendor/github.com/jesseduffield/gocui/gui.go b/vendor/github.com/jesseduffield/gocui/gui.go
index 889839c45..e2593b985 100644
--- a/vendor/github.com/jesseduffield/gocui/gui.go
+++ b/vendor/github.com/jesseduffield/gocui/gui.go
@@ -172,6 +172,8 @@ type Gui struct {
NextSearchMatchKey interface{}
PrevSearchMatchKey interface{}
+ ErrorHandler func(error) error
+
screen tcell.Screen
suspendedMutex sync.Mutex
suspended bool
@@ -661,7 +663,7 @@ func (g *Gui) updateAsyncAux(f func(*Gui) error, task Task) {
// consider itself 'busy` as it runs the code. Don't use for long-running
// background goroutines where you wouldn't want lazygit to be considered busy
// (i.e. when you wouldn't want a loader to be shown to the user)
-func (g *Gui) OnWorker(f func(Task)) {
+func (g *Gui) OnWorker(f func(Task) error) {
task := g.NewTask()
go func() {
g.onWorkerAux(f, task)
@@ -669,7 +671,7 @@ func (g *Gui) OnWorker(f func(Task)) {
}()
}
-func (g *Gui) onWorkerAux(f func(Task), task Task) {
+func (g *Gui) onWorkerAux(f func(Task) error, task Task) {
panicking := true
defer func() {
if panicking && Screen != nil {
@@ -677,9 +679,15 @@ func (g *Gui) onWorkerAux(f func(Task), task Task) {
}
}()
- f(task)
+ err := f(task)
panicking = false
+
+ if err != nil {
+ g.Update(func(g *Gui) error {
+ return err
+ })
+ }
}
// A Manager is in charge of GUI's layout and can be used to build widgets.
@@ -745,19 +753,27 @@ func (g *Gui) MainLoop() error {
}
}
+func (g *Gui) handleError(err error) error {
+ if err != nil && !IsQuit(err) && g.ErrorHandler != nil {
+ return g.ErrorHandler(err)
+ }
+
+ return err
+}
+
func (g *Gui) processEvent() error {
select {
case ev := <-g.gEvents:
task := g.NewTask()
defer func() { task.Done() }()
- if err := g.handleEvent(&ev); err != nil {
+ if err := g.handleError(g.handleEvent(&ev)); err != nil {
return err
}
case ev := <-g.userEvents:
defer func() { ev.task.Done() }()
- if err := ev.f(g); err != nil {
+ if err := g.handleError(ev.f(g)); err != nil {
return err
}
}
@@ -777,11 +793,11 @@ func (g *Gui) processRemainingEvents() error {
for {
select {
case ev := <-g.gEvents:
- if err := g.handleEvent(&ev); err != nil {
+ if err := g.handleError(g.handleEvent(&ev)); err != nil {
return err
}
case ev := <-g.userEvents:
- err := ev.f(g)
+ err := g.handleError(ev.f(g))
ev.task.Done()
if err != nil {
return err
@@ -815,17 +831,6 @@ func (g *Gui) onResize() {
// g.screen.Sync()
}
-func (g *Gui) clear(fg, bg Attribute) (int, int) {
- st := getTcellStyle(oldStyle{fg: fg, bg: bg, outputMode: g.outputMode})
- w, h := Screen.Size()
- for row := 0; row < h; row++ {
- for col := 0; col < w; col++ {
- Screen.SetContent(col, row, ' ', nil, st)
- }
- }
- return w, h
-}
-
// drawFrameEdges draws the horizontal and vertical edges of a view.
func (g *Gui) drawFrameEdges(v *View, fgColor, bgColor Attribute) error {
runeH, runeV := '─', '│'
@@ -1397,7 +1402,7 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) (matched bool, err error)
var matchingParentViewKb *keybinding
// if we're searching, and we've hit n/N/Esc, we ignore the default keybinding
- if v != nil && v.IsSearching() && Modifier(ev.Mod) == ModNone {
+ if v != nil && v.IsSearching() && ev.Mod == ModNone {
if eventMatchesKey(ev, g.NextSearchMatchKey) {
return true, v.gotoNextMatch()
} else if eventMatchesKey(ev, g.PrevSearchMatchKey) {
@@ -1417,7 +1422,7 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) (matched bool, err error)
if kb.handler == nil {
continue
}
- if !kb.matchKeypress(Key(ev.Key), ev.Ch, Modifier(ev.Mod)) {
+ if !kb.matchKeypress(ev.Key, ev.Ch, ev.Mod) {
continue
}
if g.matchView(v, kb) {
@@ -1435,7 +1440,7 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) (matched bool, err error)
}
if g.currentView != nil && g.currentView.Editable && g.currentView.Editor != nil {
- matched := g.currentView.Editor.Edit(g.currentView, Key(ev.Key), ev.Ch, Modifier(ev.Mod))
+ matched := g.currentView.Editor.Edit(g.currentView, ev.Key, ev.Ch, ev.Mod)
if matched {
return true, nil
}
@@ -1550,7 +1555,7 @@ func (g *Gui) matchView(v *View, kb *keybinding) bool {
if v == nil {
return false
}
- if v.Editable == true && kb.ch != 0 {
+ if v.Editable && kb.ch != 0 {
return false
}
if kb.viewName != v.name {
diff --git a/vendor/github.com/jesseduffield/gocui/gui_others.go b/vendor/github.com/jesseduffield/gocui/gui_others.go
index 578686fd6..f0de7822a 100644
--- a/vendor/github.com/jesseduffield/gocui/gui_others.go
+++ b/vendor/github.com/jesseduffield/gocui/gui_others.go
@@ -46,16 +46,14 @@ func (g *Gui) getTermWindowSize() (int, int, error) {
return termw, termh, nil
}
- select {
- case signal := <-signalCh:
- switch signal {
- // when the terminal window size is changed
- case syscall.SIGWINCH:
- continue
- // ctrl + c to cancel
- case syscall.SIGINT:
- return 0, 0, errors.New("stop to get term window size")
- }
+ signal := <-signalCh
+ switch signal {
+ // when the terminal window size is changed
+ case syscall.SIGWINCH:
+ continue
+ // ctrl + c to cancel
+ case syscall.SIGINT:
+ return 0, 0, errors.New("stop to get term window size")
}
}
}
diff --git a/vendor/github.com/jesseduffield/gocui/gui_windows.go b/vendor/github.com/jesseduffield/gocui/gui_windows.go
index f643fdb33..56c54570c 100644
--- a/vendor/github.com/jesseduffield/gocui/gui_windows.go
+++ b/vendor/github.com/jesseduffield/gocui/gui_windows.go
@@ -13,10 +13,12 @@ import (
"unsafe"
)
-type wchar uint16
-type short int16
-type dword uint32
-type word uint16
+type (
+ wchar uint16
+ short int16
+ dword uint32
+ word uint16
+)
type coord struct {
x short
diff --git a/vendor/github.com/jesseduffield/gocui/keybinding.go b/vendor/github.com/jesseduffield/gocui/keybinding.go
index e2b931d7e..0d2cecc68 100644
--- a/vendor/github.com/jesseduffield/gocui/keybinding.go
+++ b/vendor/github.com/jesseduffield/gocui/keybinding.go
@@ -105,7 +105,7 @@ func newKeybinding(viewname string, key Key, ch rune, mod Modifier, handler func
func eventMatchesKey(ev *GocuiEvent, key interface{}) bool {
// assuming ModNone for now
- if Modifier(ev.Mod) != ModNone {
+ if ev.Mod != ModNone {
return false
}
@@ -114,7 +114,7 @@ func eventMatchesKey(ev *GocuiEvent, key interface{}) bool {
return false
}
- return k == Key(ev.Key) && ch == ev.Ch
+ return k == ev.Key && ch == ev.Ch
}
// matchKeypress returns if the keybinding matches the keypress.
diff --git a/vendor/github.com/jesseduffield/gocui/view.go b/vendor/github.com/jesseduffield/gocui/view.go
index 6bfc4c487..a84e1b0ce 100644
--- a/vendor/github.com/jesseduffield/gocui/view.go
+++ b/vendor/github.com/jesseduffield/gocui/view.go
@@ -767,7 +767,7 @@ func (v *View) writeString(s string) {
// parseInput parses char by char the input written to the View. It returns nil
// while processing ESC sequences. Otherwise, it returns a cell slice that
// contains the processed data.
-func (v *View) parseInput(ch rune, x int, y int) (bool, []cell) {
+func (v *View) parseInput(ch rune, x int, _ int) (bool, []cell) {
cells := []cell{}
moveCursor := true
@@ -1283,7 +1283,7 @@ func (v *View) Word(x, y int) (string, error) {
} else {
nr = nr + x
}
- return string(str[nl:nr]), nil
+ return str[nl:nr], nil
}
// indexFunc allows to split lines by words taking into account spaces
diff --git a/vendor/golang.org/x/sys/unix/mmap_nomremap.go b/vendor/golang.org/x/sys/unix/mmap_nomremap.go
index 4b68e5978..7f602ffd2 100644
--- a/vendor/golang.org/x/sys/unix/mmap_nomremap.go
+++ b/vendor/golang.org/x/sys/unix/mmap_nomremap.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris
+//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris || zos
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
index b473038c6..27c41b6f0 100644
--- a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
+++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go
@@ -1520,6 +1520,14 @@ func (m *mmapper) Munmap(data []byte) (err error) {
return nil
}
+func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
+ return mapper.Mmap(fd, offset, length, prot, flags)
+}
+
+func Munmap(b []byte) (err error) {
+ return mapper.Munmap(b)
+}
+
func Read(fd int, p []byte) (n int, err error) {
n, err = read(fd, p)
if raceenabled {
diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go
index 6395a031d..6525c62f3 100644
--- a/vendor/golang.org/x/sys/windows/syscall_windows.go
+++ b/vendor/golang.org/x/sys/windows/syscall_windows.go
@@ -165,6 +165,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW
//sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW
//sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error)
+//sys DisconnectNamedPipe(pipe Handle) (err error)
//sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error)
//sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW
//sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState
@@ -348,8 +349,19 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost
//sys GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32)
//sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error)
+//sys ClearCommBreak(handle Handle) (err error)
+//sys ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error)
+//sys EscapeCommFunction(handle Handle, dwFunc uint32) (err error)
+//sys GetCommState(handle Handle, lpDCB *DCB) (err error)
+//sys GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error)
//sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
+//sys PurgeComm(handle Handle, dwFlags uint32) (err error)
+//sys SetCommBreak(handle Handle) (err error)
+//sys SetCommMask(handle Handle, dwEvtMask uint32) (err error)
+//sys SetCommState(handle Handle, lpDCB *DCB) (err error)
//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error)
+//sys SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error)
+//sys WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error)
//sys GetActiveProcessorCount(groupNumber uint16) (ret uint32)
//sys GetMaximumProcessorCount(groupNumber uint16) (ret uint32)
//sys EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) = user32.EnumWindows
@@ -1834,3 +1846,73 @@ func ResizePseudoConsole(pconsole Handle, size Coord) error {
// accept arguments that can be casted to uintptr, and Coord can't.
return resizePseudoConsole(pconsole, *((*uint32)(unsafe.Pointer(&size))))
}
+
+// DCB constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-dcb.
+const (
+ CBR_110 = 110
+ CBR_300 = 300
+ CBR_600 = 600
+ CBR_1200 = 1200
+ CBR_2400 = 2400
+ CBR_4800 = 4800
+ CBR_9600 = 9600
+ CBR_14400 = 14400
+ CBR_19200 = 19200
+ CBR_38400 = 38400
+ CBR_57600 = 57600
+ CBR_115200 = 115200
+ CBR_128000 = 128000
+ CBR_256000 = 256000
+
+ DTR_CONTROL_DISABLE = 0x00000000
+ DTR_CONTROL_ENABLE = 0x00000010
+ DTR_CONTROL_HANDSHAKE = 0x00000020
+
+ RTS_CONTROL_DISABLE = 0x00000000
+ RTS_CONTROL_ENABLE = 0x00001000
+ RTS_CONTROL_HANDSHAKE = 0x00002000
+ RTS_CONTROL_TOGGLE = 0x00003000
+
+ NOPARITY = 0
+ ODDPARITY = 1
+ EVENPARITY = 2
+ MARKPARITY = 3
+ SPACEPARITY = 4
+
+ ONESTOPBIT = 0
+ ONE5STOPBITS = 1
+ TWOSTOPBITS = 2
+)
+
+// EscapeCommFunction constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-escapecommfunction.
+const (
+ SETXOFF = 1
+ SETXON = 2
+ SETRTS = 3
+ CLRRTS = 4
+ SETDTR = 5
+ CLRDTR = 6
+ SETBREAK = 8
+ CLRBREAK = 9
+)
+
+// PurgeComm constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-purgecomm.
+const (
+ PURGE_TXABORT = 0x0001
+ PURGE_RXABORT = 0x0002
+ PURGE_TXCLEAR = 0x0004
+ PURGE_RXCLEAR = 0x0008
+)
+
+// SetCommMask constants. See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setcommmask.
+const (
+ EV_RXCHAR = 0x0001
+ EV_RXFLAG = 0x0002
+ EV_TXEMPTY = 0x0004
+ EV_CTS = 0x0008
+ EV_DSR = 0x0010
+ EV_RLSD = 0x0020
+ EV_BREAK = 0x0040
+ EV_ERR = 0x0080
+ EV_RING = 0x0100
+)
diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go
index 359780f6a..d8cb71db0 100644
--- a/vendor/golang.org/x/sys/windows/types_windows.go
+++ b/vendor/golang.org/x/sys/windows/types_windows.go
@@ -3380,3 +3380,27 @@ type BLOB struct {
Size uint32
BlobData *byte
}
+
+type ComStat struct {
+ Flags uint32
+ CBInQue uint32
+ CBOutQue uint32
+}
+
+type DCB struct {
+ DCBlength uint32
+ BaudRate uint32
+ Flags uint32
+ wReserved uint16
+ XonLim uint16
+ XoffLim uint16
+ ByteSize uint8
+ Parity uint8
+ StopBits uint8
+ XonChar byte
+ XoffChar byte
+ ErrorChar byte
+ EofChar byte
+ EvtChar byte
+ wReserved1 uint16
+}
diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go
index e8791c82c..5c6035ddf 100644
--- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go
+++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go
@@ -188,6 +188,8 @@ var (
procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
procCancelIo = modkernel32.NewProc("CancelIo")
procCancelIoEx = modkernel32.NewProc("CancelIoEx")
+ procClearCommBreak = modkernel32.NewProc("ClearCommBreak")
+ procClearCommError = modkernel32.NewProc("ClearCommError")
procCloseHandle = modkernel32.NewProc("CloseHandle")
procClosePseudoConsole = modkernel32.NewProc("ClosePseudoConsole")
procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe")
@@ -212,7 +214,9 @@ var (
procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList")