mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-14 05:06:54 +03:00
UICodeEditor copy and cut with multiple cursors.
This commit is contained in:
@@ -512,6 +512,8 @@ class EE_API TextDocument {
|
||||
|
||||
void selectAllMatches();
|
||||
|
||||
String getAllSelectedText() const;
|
||||
|
||||
protected:
|
||||
friend class UndoStack;
|
||||
|
||||
|
||||
@@ -777,6 +777,19 @@ String TextDocument::getText() const {
|
||||
return getText( getDocRange() );
|
||||
}
|
||||
|
||||
String TextDocument::getAllSelectedText() const {
|
||||
String text;
|
||||
for ( size_t i = 0; i < mSelection.size(); ++i ) {
|
||||
String sel( getSelectedText( i ) );
|
||||
if ( !sel.empty() ) {
|
||||
text += std::move( sel );
|
||||
if ( i != mSelection.size() - 1 )
|
||||
text += "\n";
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
String TextDocument::getSelectedText() const {
|
||||
return getText( getSelection() );
|
||||
}
|
||||
|
||||
@@ -2393,11 +2393,11 @@ void UICodeEditor::unindent() {
|
||||
}
|
||||
|
||||
void UICodeEditor::copy() {
|
||||
getUISceneNode()->getWindow()->getClipboard()->setText( mDoc->getSelectedText().toUtf8() );
|
||||
getUISceneNode()->getWindow()->getClipboard()->setText( mDoc->getAllSelectedText().toUtf8() );
|
||||
}
|
||||
|
||||
void UICodeEditor::cut() {
|
||||
getUISceneNode()->getWindow()->getClipboard()->setText( mDoc->getSelectedText().toUtf8() );
|
||||
getUISceneNode()->getWindow()->getClipboard()->setText( mDoc->getAllSelectedText().toUtf8() );
|
||||
mDoc->deleteSelection();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user