mirror of https://github.com/buggins/dlangui.git
new method to get selected text
public getter method to get current selected text from the editor. used to avoid code duplication but more important for me i need it for get the selection so i can prefill search panel textbox in dlangide.
This commit is contained in:
parent
d47825e6aa
commit
56cc745320
|
@ -1111,6 +1111,11 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
|
|||
return true;
|
||||
}
|
||||
|
||||
public dstring getSelectedText(){
|
||||
dstring selectionText = concatDStrings(_content.rangeText(_selectionRange));
|
||||
return selectionText;
|
||||
}
|
||||
|
||||
protected bool removeRangeText(TextRange range) {
|
||||
if (range.empty)
|
||||
return false;
|
||||
|
@ -1310,13 +1315,13 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
|
|||
return true;
|
||||
case Copy:
|
||||
if (!_selectionRange.empty) {
|
||||
dstring selectionText = concatDStrings(_content.rangeText(_selectionRange));
|
||||
dstring selectionText = getSelectedText();
|
||||
platform.setClipboardText(selectionText);
|
||||
}
|
||||
return true;
|
||||
case Cut:
|
||||
if (!_selectionRange.empty) {
|
||||
dstring selectionText = concatDStrings(_content.rangeText(_selectionRange));
|
||||
dstring selectionText = getSelectedText();
|
||||
platform.setClipboardText(selectionText);
|
||||
if (readOnly)
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue