mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-03 22:50:35 +00:00
fixed a panic when a line is cut out(strg+k) and the next line
is empty.
This commit is contained in:
parent
4aeb4c78ac
commit
06c65d8404
1 changed files with 8 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package main
|
||||
|
||||
import "github.com/zyedidia/clipboard"
|
||||
import (
|
||||
"github.com/zyedidia/clipboard"
|
||||
)
|
||||
|
||||
// The Cursor struct stores the location of the cursor in the view
|
||||
// The complicated part about the cursor is storing its location.
|
||||
|
|
@ -340,6 +342,11 @@ func (c *Cursor) GetVisualX() int {
|
|||
if c.X > len(runes) {
|
||||
c.X = len(runes) - 1
|
||||
}
|
||||
|
||||
if c.X < 0 {
|
||||
c.X = 0
|
||||
}
|
||||
|
||||
return StringWidth(string(runes[:c.X]), tabSize)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue