mirror of https://github.com/buggins/dlangui.git
add selectAll method to editors
This commit is contained in:
parent
8c1ae8988e
commit
8d84223099
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue