Skip to content

Commit

Permalink
Added changes a view changes from jesseduffield fork (#23)
Browse files Browse the repository at this point in the history
Added changes a view changes from jesseduffield fork
  • Loading branch information
mjarkk authored May 19, 2019
2 parents 6a2a164 + 68c8f54 commit 5e449e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
}
Expand Down
2 changes: 1 addition & 1 deletion keybinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +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.Editable && kb.ch != 0 {
if v == nil || (v.Editable && kb.ch != 0) {
return false
}
return kb.viewName == v.name
Expand Down

0 comments on commit 5e449e9

Please sign in to comment.