Use rope substring instead of report

This commit is contained in:
Zachary Yedidia
2016-05-07 10:57:40 -04:00
parent 8670a03973
commit 29ae840413
4 changed files with 14 additions and 13 deletions

View File

@@ -102,9 +102,9 @@ func (c *Cursor) DeleteSelection() {
// GetSelection returns the cursor's selection
func (c *Cursor) GetSelection() string {
if c.curSelection[0] > c.curSelection[1] {
return string([]rune(c.v.Buf.Text)[c.curSelection[1]:c.curSelection[0]])
return c.v.Buf.Substr(c.curSelection[1], c.curSelection[0])
}
return string([]rune(c.v.Buf.Text)[c.curSelection[0]:c.curSelection[1]])
return c.v.Buf.Substr(c.curSelection[0], c.curSelection[1])
}
// SelectLine selects the current line