Add the ability to close splits and change splits using the mouse

This commits adds split navigation with the mouse and the ability to
close splits. You can now also open a file directly with the hsplit
and vsplit commands.
This commit is contained in:
Zachary Yedidia
2016-07-01 18:12:37 -04:00
parent d2b11c2f98
commit 4a15a1d3c8
4 changed files with 112 additions and 13 deletions

View File

@@ -281,11 +281,17 @@ func main() {
case *tcell.EventMouse:
if e.Buttons() == tcell.Button1 {
_, h := screen.Size()
_, y := e.Position()
x, y := e.Position()
if y == h-1 && messenger.message != "" {
clipboard.WriteAll(messenger.message)
continue
}
for _, v := range tabs[curTab].views {
if x >= v.x && x < v.x+v.width && y >= v.y && y < v.y+v.height {
tabs[curTab].curView = v.Num
}
}
}
}