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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public dstring getSelectedText(){
|
||||||
|
dstring selectionText = concatDStrings(_content.rangeText(_selectionRange));
|
||||||
|
return selectionText;
|
||||||
|
}
|
||||||
|
|
||||||
protected bool removeRangeText(TextRange range) {
|
protected bool removeRangeText(TextRange range) {
|
||||||
if (range.empty)
|
if (range.empty)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1310,13 +1315,13 @@ class EditWidgetBase : ScrollWidgetBase, EditableContentListener, MenuItemAction
|
||||||
return true;
|
return true;
|
||||||
case Copy:
|
case Copy:
|
||||||
if (!_selectionRange.empty) {
|
if (!_selectionRange.empty) {
|
||||||
dstring selectionText = concatDStrings(_content.rangeText(_selectionRange));
|
dstring selectionText = getSelectedText();
|
||||||
platform.setClipboardText(selectionText);
|
platform.setClipboardText(selectionText);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case Cut:
|
case Cut:
|
||||||
if (!_selectionRange.empty) {
|
if (!_selectionRange.empty) {
|
||||||
dstring selectionText = concatDStrings(_content.rangeText(_selectionRange));
|
dstring selectionText = getSelectedText();
|
||||||
platform.setClipboardText(selectionText);
|
platform.setClipboardText(selectionText);
|
||||||
if (readOnly)
|
if (readOnly)
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue