From f0af9339e94ac26e56f8e75f898d63a1c44ab233 Mon Sep 17 00:00:00 2001 From: mjarkk Date: Sat, 18 May 2019 21:11:36 +0200 Subject: [PATCH 1/2] Added changes --- gui.go | 10 +++++++++- keybinding.go | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gui.go b/gui.go index 209686da..1b3d8d77 100644 --- a/gui.go +++ b/gui.go @@ -573,6 +573,14 @@ func corner(v *View, directions byte) rune { // drawFrameCorners draws the corners of the view. func (g *Gui) drawFrameCorners(v *View, fgColor, bgColor Attribute) error { if v.y0 == v.y1 { + if !g.SupportOverlaps && v.x0 >= 0 && v.x1 >= 0 && v.y0 >= 0 && v.x0 < g.maxX && v.x1 < g.maxX && v.y0 < g.maxY { + if err := g.SetRune(v.x0, v.y0, '╶', fgColor, bgColor); err != nil { + return err + } + if err := g.SetRune(v.x1, v.y0, '╴', fgColor, bgColor); err != nil { + return err + } + } return nil } @@ -726,7 +734,7 @@ func (g *Gui) execKeybindings(v *View, ev *termbox.Event) (matched bool, err err if kb.matchView(v) { return g.execKeybinding(v, kb) } - if kb.viewName == "" && (!v.Editable || kb.ch == 0) { + if kb.viewName == "" && ((v != nil && !v.Editable) || kb.ch == 0) { globalKb = kb } } diff --git a/keybinding.go b/keybinding.go index 2f9082ab..d1e739cf 100644 --- a/keybinding.go +++ b/keybinding.go @@ -35,6 +35,9 @@ func (kb *keybinding) matchKeypress(key Key, ch rune, mod Modifier) bool { // matchView returns if the keybinding matches the current view. func (kb *keybinding) matchView(v *View) bool { // if the user is typing in a field, ignore char keys + if v == nil { + return false + } if v.Editable && kb.ch != 0 { return false } From 68c8f545361763d41ea0dc3be71e5b5140a84a37 Mon Sep 17 00:00:00 2001 From: mjarkk Date: Sat, 18 May 2019 22:29:40 +0200 Subject: [PATCH 2/2] Fixed a sugestion --- keybinding.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/keybinding.go b/keybinding.go index d1e739cf..fb8aff3d 100644 --- a/keybinding.go +++ b/keybinding.go @@ -35,10 +35,7 @@ func (kb *keybinding) matchKeypress(key Key, ch rune, mod Modifier) bool { // matchView returns if the keybinding matches the current view. func (kb *keybinding) matchView(v *View) bool { // if the user is typing in a field, ignore char keys - if v == nil { - return false - } - if v.Editable && kb.ch != 0 { + if v == nil || (v.Editable && kb.ch != 0) { return false } return kb.viewName == v.name