Bounds check delete regions in rope buffer

This commit is contained in:
Luke I. Wilson
2021-03-24 11:40:18 -05:00
parent 296fa8b4ac
commit 9133ab55d0
3 changed files with 28 additions and 4 deletions

View File

@ -302,6 +302,7 @@ func (t *TextEdit) getColumnWidth() int {
// If the returned string is empty, then nothing was selected. The slice returned may or may not
// be a copy of the buffer, so do not write to it.
func (t *TextEdit) GetSelectedBytes() []byte {
// TODO: there's a bug with copying text
if t.selectMode {
return t.Buffer.Slice(t.selection.StartLine, t.selection.StartCol, t.selection.EndLine, t.selection.EndCol)
}