diff --git a/src/dlangui/widgets/editors.d b/src/dlangui/widgets/editors.d index c912c1b6..994b3059 100644 --- a/src/dlangui/widgets/editors.d +++ b/src/dlangui/widgets/editors.d @@ -1623,12 +1623,7 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction replaceMode = !replaceMode; return true; case SelectAll: - _selectionRange.start.line = 0; - _selectionRange.start.pos = 0; - _selectionRange.end = _content.lineEnd(_content.length - 1); - _caretPos = _selectionRange.end; - ensureCaretVisible(); - requestActionsUpdate(); + selectAll(); return true; case ToggleBookmark: if (_content.multiline) { @@ -1653,6 +1648,16 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction return super.handleAction(a); } + /// Select whole text + void selectAll() { + _selectionRange.start.line = 0; + _selectionRange.start.pos = 0; + _selectionRange.end = _content.lineEnd(_content.length - 1); + _caretPos = _selectionRange.end; + ensureCaretVisible(); + requestActionsUpdate(); + } + protected TextRange spaceBefore(TextPosition pos) { TextRange res = TextRange(pos, pos); dstring s = _content[pos.line];