- enhancement: if there's no selection when copy/cut, select currect line by default
This commit is contained in:
parent
5eec4ea504
commit
0e0f954bec
1
NEWS.md
1
NEWS.md
|
@ -2,6 +2,7 @@ Red Panda C++ Version 0.13.2
|
|||
- fix: "delete and exit" button in the environtment / page option page doesn't work correctly
|
||||
- fix: crash when closing the options dialog under Ubuntu 20.04 LTS ( no memory leak now)
|
||||
- enhancement: can add non-code file in templates
|
||||
- enhancement: if there's no selection when copy/cut, select currect line by default
|
||||
|
||||
Red Panda C++ Version 0.13.1
|
||||
- enhancement: suppoort localization info in project templates
|
||||
|
|
|
@ -2054,6 +2054,12 @@ void SynEdit::doDeleteLine()
|
|||
}
|
||||
}
|
||||
|
||||
void SynEdit::doSelecteLine()
|
||||
{
|
||||
setBlockBegin(BufferCoord{1,mCaretY});
|
||||
setBlockEnd(BufferCoord{lineText().length()+1,mCaretY});
|
||||
}
|
||||
|
||||
void SynEdit::doDuplicateLine()
|
||||
{
|
||||
if (!mReadOnly && (mLines->count() > 0)) {
|
||||
|
@ -2823,7 +2829,11 @@ void SynEdit::doAddChar(QChar AChar)
|
|||
|
||||
void SynEdit::doCutToClipboard()
|
||||
{
|
||||
if (mReadOnly || !selAvail())
|
||||
if (mReadOnly)
|
||||
return;
|
||||
if (!selAvail())
|
||||
doSelecteLine();
|
||||
if (!selAvail())
|
||||
return;
|
||||
mUndoList->BeginBlock();
|
||||
auto action = finally([this] {
|
||||
|
@ -2836,7 +2846,10 @@ void SynEdit::doCutToClipboard()
|
|||
void SynEdit::doCopyToClipboard()
|
||||
{
|
||||
if (!selAvail())
|
||||
doSelecteLine();
|
||||
if (!selAvail()) {
|
||||
return;
|
||||
}
|
||||
bool ChangeTrim = (mActiveSelectionMode == SynSelectionMode::smColumn) &&
|
||||
mOptions.testFlag(eoTrimTrailingSpaces);
|
||||
QString sText;
|
||||
|
@ -5539,12 +5552,11 @@ void SynEdit::ExecuteCommand(SynEditorCommand Command, QChar AChar, void *pData)
|
|||
}
|
||||
break;
|
||||
case SynEditorCommand::ecCut:
|
||||
if (!mReadOnly && selAvail())
|
||||
if (!mReadOnly)
|
||||
doCutToClipboard();
|
||||
break;
|
||||
case SynEditorCommand::ecCopy:
|
||||
if (selAvail())
|
||||
doCopyToClipboard();
|
||||
doCopyToClipboard();
|
||||
break;
|
||||
case SynEditorCommand::ecPaste:
|
||||
if (!mReadOnly)
|
||||
|
|
|
@ -555,6 +555,7 @@ private:
|
|||
void doDeleteLastWord();
|
||||
void doDeleteFromBOL();
|
||||
void doDeleteLine();
|
||||
void doSelecteLine();
|
||||
void doDuplicateLine();
|
||||
void doMoveSelUp();
|
||||
void doMoveSelDown();
|
||||
|
|
Loading…
Reference in New Issue