Allow deleting or replacing selections

This commit is contained in:
2025-06-12 14:03:25 +03:00
parent 5d64673519
commit 12649af8e3
2 changed files with 66 additions and 11 deletions
+12
View File
@@ -63,6 +63,18 @@ func (buffer *Buffer) Save() error {
return nil
}
func (buffer *Buffer) GetSelectionEdges() (int, int) {
if buffer.Selection == nil {
return -1, -1
}
if buffer.Selection.selectionStart < buffer.Selection.selectionEnd {
return buffer.Selection.selectionStart, buffer.Selection.selectionEnd
} else {
return buffer.Selection.selectionEnd, buffer.Selection.selectionStart
}
}
func (buffer *Buffer) GetSelectedText() string {
if buffer.Selection == nil {
return ""