- enhancement: If no selection, Ctrl+C (Copy) auto selects the current line and put the cursor to the beginning.
This commit is contained in:
parent
cf7296af8c
commit
3a0d3f684a
1
NEWS.md
1
NEWS.md
|
@ -16,6 +16,7 @@ Red Panda C++ Version 2.17
|
|||
- fix: Cpu info window is auto openned, when debug using gdb-server.
|
||||
- enhancement: Shift+Up in the first line will expand selection to the beginning of the line.
|
||||
- enhancement: Shift+Down in the last line will expand selection to the end of the line.
|
||||
- enhancement: If no selection, Ctrl+C (Copy) auto selects the current line and put the cursor to the beginning.
|
||||
|
||||
|
||||
Red Panda C++ Version 2.16
|
||||
|
|
|
@ -184,7 +184,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
|||
setCaretPosition(1,1);
|
||||
mCanAutoSave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isNew && parentPageControl) {
|
||||
resetBookmarks();
|
||||
resetBreakpoints();
|
||||
|
@ -1455,6 +1455,7 @@ void Editor::copyToClipboard()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch(pSettings->editor().copyWithFormatAs()) {
|
||||
case 1: //HTML
|
||||
copyAsHTML();
|
||||
|
@ -1485,8 +1486,9 @@ void Editor::cutToClipboard()
|
|||
|
||||
void Editor::copyAsHTML()
|
||||
{
|
||||
if (!selAvail())
|
||||
return;
|
||||
if (!selAvail()) {
|
||||
doSelectLine();
|
||||
}
|
||||
QSynedit::HTMLExporter exporter(tabWidth(), pCharsetInfoManager->getDefaultSystemEncoding());
|
||||
|
||||
exporter.setTitle(QFileInfo(mFilename).fileName());
|
||||
|
|
|
@ -606,7 +606,7 @@ void MainWindow::updateEditorActions(const Editor *e)
|
|||
ui->actionConvert_to_UTF_8->setEnabled(e->encodingOption()!=ENCODING_UTF8 && e->fileEncoding()!=ENCODING_UTF8);
|
||||
ui->actionConvert_to_UTF_8_BOM->setEnabled(e->encodingOption()!=ENCODING_UTF8_BOM && e->fileEncoding()!=ENCODING_UTF8_BOM);
|
||||
|
||||
ui->actionCopy->setEnabled(e->selAvail());
|
||||
ui->actionCopy->setEnabled(true);
|
||||
ui->actionCut->setEnabled(true);
|
||||
ui->actionFoldAll->setEnabled(e->document()->count()>0);
|
||||
ui->actionIndent->setEnabled(!e->readOnly());
|
||||
|
|
|
@ -2189,13 +2189,15 @@ void QSynEdit::doDeleteLine()
|
|||
}
|
||||
}
|
||||
|
||||
void QSynEdit::doSelecteLine()
|
||||
void QSynEdit::doSelectLine()
|
||||
{
|
||||
setBlockBegin(BufferCoord{1,mCaretY});
|
||||
BufferCoord ptBegin=BufferCoord{1,mCaretY};
|
||||
BufferCoord ptEnd;
|
||||
if (mCaretY==mDocument->count())
|
||||
setBlockEnd(BufferCoord{lineText().length()+1,mCaretY});
|
||||
ptEnd = BufferCoord{lineText().length()+1,mCaretY};
|
||||
else
|
||||
setBlockEnd(BufferCoord{1,mCaretY+1});
|
||||
ptEnd = BufferCoord{1,mCaretY+1};
|
||||
setCaretAndSelection(ptBegin,ptBegin,ptEnd);
|
||||
}
|
||||
|
||||
void QSynEdit::doDuplicateLine()
|
||||
|
@ -2954,7 +2956,7 @@ void QSynEdit::doCutToClipboard()
|
|||
addCaretToUndo();
|
||||
addSelectionToUndo();
|
||||
if (!selAvail()) {
|
||||
doSelecteLine();
|
||||
doSelectLine();
|
||||
}
|
||||
internalDoCopyToClipboard(selText());
|
||||
setSelectedTextEmpty();
|
||||
|
@ -2966,14 +2968,10 @@ void QSynEdit::doCopyToClipboard()
|
|||
{
|
||||
bool selected=selAvail();
|
||||
if (!selected)
|
||||
doSelecteLine();
|
||||
doSelectLine();
|
||||
QString sText;
|
||||
sText = selText();
|
||||
internalDoCopyToClipboard(sText);
|
||||
if (!selected) {
|
||||
setBlockBegin(caretXY());
|
||||
setBlockEnd(caretXY());
|
||||
}
|
||||
}
|
||||
|
||||
void QSynEdit::internalDoCopyToClipboard(const QString &s)
|
||||
|
|
|
@ -468,6 +468,8 @@ protected:
|
|||
virtual void onEndFirstPaintLock();
|
||||
virtual void onBeginFirstPaintLock();
|
||||
|
||||
protected:
|
||||
void doSelectLine();
|
||||
private:
|
||||
void beginEditingWithoutUndo();
|
||||
void endEditingWithoutUndo();
|
||||
|
@ -588,7 +590,7 @@ private:
|
|||
void doDeleteToWordEnd();
|
||||
void doDeleteFromBOL();
|
||||
void doDeleteLine();
|
||||
void doSelecteLine();
|
||||
|
||||
void doDuplicateLine();
|
||||
void doMoveSelUp();
|
||||
void doMoveSelDown();
|
||||
|
|
Loading…
Reference in New Issue