Prevent panic if mouse y coordinate is below 0

See #7
This commit is contained in:
Zachary Yedidia
2016-04-18 11:54:32 -04:00
parent 119c310045
commit fa7808b4ae

View File

@@ -327,6 +327,9 @@ func (v *View) MoveToMouseClick(x, y int) {
if y >= len(v.buf.lines) {
y = len(v.buf.lines) - 1
}
if y < 0 {
y = 0
}
if x < 0 {
x = 0
}