diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-25 11:02:46 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-25 11:02:46 +1000 |
commit | f24c95aedec785985dfcd98ff3997152c193bd3e (patch) | |
tree | 9f8ac1a61cf686052f623b767e13d6d1a14e3683 /vendor/github.com | |
parent | 5628eae502ee3b4d3d72a8e4045713b637f7a764 (diff) | |
parent | 93ab892bdd1226f9a519a938c8b28590e71e54f3 (diff) |
Merge branch 'master' into feature/auto-updates
Diffstat (limited to 'vendor/github.com')
-rw-r--r-- | vendor/github.com/jesseduffield/gocui/gui.go | 28 | ||||
-rw-r--r-- | vendor/github.com/jesseduffield/gocui/keybinding.go | 3 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/LICENSE (renamed from vendor/github.com/Sirupsen/logrus/LICENSE) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/alt_exit.go (renamed from vendor/github.com/Sirupsen/logrus/alt_exit.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/doc.go (renamed from vendor/github.com/Sirupsen/logrus/doc.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/entry.go (renamed from vendor/github.com/Sirupsen/logrus/entry.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/exported.go (renamed from vendor/github.com/Sirupsen/logrus/exported.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/formatter.go (renamed from vendor/github.com/Sirupsen/logrus/formatter.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/hooks.go (renamed from vendor/github.com/Sirupsen/logrus/hooks.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/json_formatter.go (renamed from vendor/github.com/Sirupsen/logrus/json_formatter.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/logger.go (renamed from vendor/github.com/Sirupsen/logrus/logger.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/logrus.go (renamed from vendor/github.com/Sirupsen/logrus/logrus.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/terminal_bsd.go (renamed from vendor/github.com/Sirupsen/logrus/terminal_bsd.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/terminal_check_appengine.go (renamed from vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go (renamed from vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/terminal_linux.go (renamed from vendor/github.com/Sirupsen/logrus/terminal_linux.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/text_formatter.go (renamed from vendor/github.com/Sirupsen/logrus/text_formatter.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/sirupsen/logrus/writer.go (renamed from vendor/github.com/Sirupsen/logrus/writer.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/spkg/bom/LICENSE.md | 21 | ||||
-rw-r--r-- | vendor/github.com/spkg/bom/bom.go | 39 | ||||
-rw-r--r-- | vendor/github.com/spkg/bom/discard_go14.go | 12 | ||||
-rw-r--r-- | vendor/github.com/spkg/bom/discard_go15.go | 10 |
22 files changed, 103 insertions, 10 deletions
diff --git a/vendor/github.com/jesseduffield/gocui/gui.go b/vendor/github.com/jesseduffield/gocui/gui.go index 28a52d1cd..26ba79bd6 100644 --- a/vendor/github.com/jesseduffield/gocui/gui.go +++ b/vendor/github.com/jesseduffield/gocui/gui.go @@ -653,17 +653,31 @@ func (g *Gui) onKey(ev *termbox.Event) error { // execKeybindings executes the keybinding handlers that match the passed view // and event. The value of matched is true if there is a match and no errors. func (g *Gui) execKeybindings(v *View, ev *termbox.Event) (matched bool, err error) { - matched = false + var globalKb *keybinding for _, kb := range g.keybindings { if kb.handler == nil { continue } - if kb.matchKeypress(Key(ev.Key), ev.Ch, Modifier(ev.Mod)) && kb.matchView(v) { - if err := kb.handler(g, v); err != nil { - return false, err - } - matched = true + if !kb.matchKeypress(Key(ev.Key), ev.Ch, Modifier(ev.Mod)) { + continue + } + if kb.matchView(v) { + return g.execKeybinding(v, kb) + } + if kb.viewName == "" && (!v.Editable || kb.ch == 0) { + globalKb = kb } } - return matched, nil + if globalKb != nil { + return g.execKeybinding(v, globalKb) + } + return false, nil +} + +// execKeybinding executes a given keybinding +func (g *Gui) execKeybinding(v *View, kb *keybinding) (bool, error) { + if err := kb.handler(g, v); err != nil { + return false, err + } + return true, nil } diff --git a/vendor/github.com/jesseduffield/gocui/keybinding.go b/vendor/github.com/jesseduffield/gocui/keybinding.go index 7efdb75c6..82d1acc9f 100644 --- a/vendor/github.com/jesseduffield/gocui/keybinding.go +++ b/vendor/github.com/jesseduffield/gocui/keybinding.go @@ -38,9 +38,6 @@ func (kb *keybinding) matchView(v *View) bool { if v.Editable == true && kb.ch != 0 { return false } - if kb.viewName == "" { - return true - } return v != nil && kb.viewName == v.name } diff --git a/vendor/github.com/Sirupsen/logrus/LICENSE b/vendor/github.com/sirupsen/logrus/LICENSE index f090cb42f..f090cb42f 100644 --- a/vendor/github.com/Sirupsen/logrus/LICENSE +++ b/vendor/github.com/sirupsen/logrus/LICENSE diff --git a/vendor/github.com/Sirupsen/logrus/alt_exit.go b/vendor/github.com/sirupsen/logrus/alt_exit.go index 8af90637a..8af90637a 100644 --- a/vendor/github.com/Sirupsen/logrus/alt_exit.go +++ b/vendor/github.com/sirupsen/logrus/alt_exit.go diff --git a/vendor/github.com/Sirupsen/logrus/doc.go b/vendor/github.com/sirupsen/logrus/doc.go index da67aba06..da67aba06 100644 --- a/vendor/github.com/Sirupsen/logrus/doc.go +++ b/vendor/github.com/sirupsen/logrus/doc.go diff --git a/vendor/github.com/Sirupsen/logrus/entry.go b/vendor/github.com/sirupsen/logrus/entry.go index 473bd1a0d..473bd1a0d 100644 --- a/vendor/github.com/Sirupsen/logrus/entry.go +++ b/vendor/github.com/sirupsen/logrus/entry.go diff --git a/vendor/github.com/Sirupsen/logrus/exported.go b/vendor/github.com/sirupsen/logrus/exported.go index eb612a6f3..eb612a6f3 100644 --- a/vendor/github.com/Sirupsen/logrus/exported.go +++ b/vendor/github.com/sirupsen/logrus/exported.go diff --git a/vendor/github.com/Sirupsen/logrus/formatter.go b/vendor/github.com/sirupsen/logrus/formatter.go index 83c74947b..83c74947b 100644 --- a/vendor/github.com/Sirupsen/logrus/formatter.go +++ b/vendor/github.com/sirupsen/logrus/formatter.go diff --git a/vendor/github.com/Sirupsen/logrus/hooks.go b/vendor/github.com/sirupsen/logrus/hooks.go index 3f151cdc3..3f151cdc3 100644 --- a/vendor/github.com/Sirupsen/logrus/hooks.go +++ b/vendor/github.com/sirupsen/logrus/hooks.go diff --git a/vendor/github.com/Sirupsen/logrus/json_formatter.go b/vendor/github.com/sirupsen/logrus/json_formatter.go index dab17610f..dab17610f 100644 --- a/vendor/github.com/Sirupsen/logrus/json_formatter.go +++ b/vendor/github.com/sirupsen/logrus/json_formatter.go diff --git a/vendor/github.com/Sirupsen/logrus/logger.go b/vendor/github.com/sirupsen/logrus/logger.go index 342f7977d..342f7977d 100644 --- a/vendor/github.com/Sirupsen/logrus/logger.go +++ b/vendor/github.com/sirupsen/logrus/logger.go diff --git a/vendor/github.com/Sirupsen/logrus/logrus.go b/vendor/github.com/sirupsen/logrus/logrus.go index dd3899974..dd3899974 100644 --- a/vendor/github.com/Sirupsen/logrus/logrus.go +++ b/vendor/github.com/sirupsen/logrus/logrus.go diff --git a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go b/vendor/github.com/sirupsen/logrus/terminal_bsd.go index 4880d13d2..4880d13d2 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_bsd.go +++ b/vendor/github.com/sirupsen/logrus/terminal_bsd.go diff --git a/vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go index 3de08e802..3de08e802 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_check_appengine.go +++ b/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go diff --git a/vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go index 067047a12..067047a12 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_check_notappengine.go +++ b/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go diff --git a/vendor/github.com/Sirupsen/logrus/terminal_linux.go b/vendor/github.com/sirupsen/logrus/terminal_linux.go index f29a0097c..f29a0097c 100644 --- a/vendor/github.com/Sirupsen/logrus/terminal_linux.go +++ b/vendor/github.com/sirupsen/logrus/terminal_linux.go diff --git a/vendor/github.com/Sirupsen/logrus/text_formatter.go b/vendor/github.com/sirupsen/logrus/text_formatter.go index 3e5504030..3e5504030 100644 --- a/vendor/github.com/Sirupsen/logrus/text_formatter.go +++ b/vendor/github.com/sirupsen/logrus/text_formatter.go diff --git a/vendor/github.com/Sirupsen/logrus/writer.go b/vendor/github.com/sirupsen/logrus/writer.go index 7bdebedc6..7bdebedc6 100644 --- a/vendor/github.com/Sirupsen/logrus/writer.go +++ b/vendor/github.com/sirupsen/logrus/writer.go diff --git a/vendor/github.com/spkg/bom/LICENSE.md b/vendor/github.com/spkg/bom/LICENSE.md new file mode 100644 index 000000000..931b189e4 --- /dev/null +++ b/vendor/github.com/spkg/bom/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 John Jeffery + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/spkg/bom/bom.go b/vendor/github.com/spkg/bom/bom.go new file mode 100644 index 000000000..93b811c6d --- /dev/null +++ b/vendor/github.com/spkg/bom/bom.go @@ -0,0 +1,39 @@ +// Package bom is used to clean up UTF-8 Byte Order Marks. +package bom + +import ( + "bufio" + "io" +) + +const ( + bom0 = 0xef + bom1 = 0xbb + bom2 = 0xbf +) + +// Clean returns b with the 3 byte BOM stripped off the front if it is present. +// If the BOM is not present, then b is returned. +func Clean(b []byte) []byte { + if len(b) >= 3 && + b[0] == bom0 && + b[1] == bom1 && + b[2] == bom2 { + return b[3:] + } + return b +} + +// NewReader returns an io.Reader that will skip over initial UTF-8 byte order marks. +func NewReader(r io.Reader) io.Reader { + buf := bufio.NewReader(r) + b, err := buf.Peek(3) + if err != nil { + // not enough bytes + return buf + } + if b[0] == bom0 && b[1] == bom1 && b[2] == bom2 { + discardBytes(buf, 3) + } + return buf +} diff --git a/vendor/github.com/spkg/bom/discard_go14.go b/vendor/github.com/spkg/bom/discard_go14.go new file mode 100644 index 000000000..782cd0624 --- /dev/null +++ b/vendor/github.com/spkg/bom/discard_go14.go @@ -0,0 +1,12 @@ +// +build !go1.5 + +package bom + +import "bufio" + +func discardBytes(buf *bufio.Reader, n int) { + // cannot use the buf.Discard method as it was introduced in Go 1.5 + for i := 0; i < n; i++ { + buf.ReadByte() + } +} diff --git a/vendor/github.com/spkg/bom/discard_go15.go b/vendor/github.com/spkg/bom/discard_go15.go new file mode 100644 index 000000000..2d17d5c5e --- /dev/null +++ b/vendor/github.com/spkg/bom/discard_go15.go @@ -0,0 +1,10 @@ +// +build go1.5 + +package bom + +import "bufio" + +func discardBytes(buf *bufio.Reader, n int) { + // the Discard method was introduced in Go 1.5 + buf.Discard(n) +} |