- fix: select all shouldn't set file's modified flag

- enhancement: add (return)type info for functions/varaibles/typedefs in the class browser panel
This commit is contained in:
Roy Qu 2022-06-23 13:05:10 +08:00
parent 20690b7e51
commit 895a927ee0
6 changed files with 18 additions and 7 deletions

View File

@ -3,6 +3,8 @@ Red Panda C++ Version 1.1.2
- enhancement: auto add "/" to folder when completing #include headers - enhancement: auto add "/" to folder when completing #include headers
- enhancement: add the option "Set Encoding for the Executable" to project's compiler options - enhancement: add the option "Set Encoding for the Executable" to project's compiler options
- fix: can't correctly compile when link params are seperated by line breaks - fix: can't correctly compile when link params are seperated by line breaks
- fix: select all shouldn't set file's modified flag
- enhancement: add (return)type info for functions/varaibles/typedefs in the class browser panel
Red Panda C++ Version 1.1.1 Red Panda C++ Version 1.1.1
- enhancement: adjust the appearance of problem case's input/output/expected control - enhancement: adjust the appearance of problem case's input/output/expected control

View File

@ -319,8 +319,7 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement &
oldEditor->beginUndoBlock(); oldEditor->beginUndoBlock();
oldEditor->addLeftTopToUndo(); oldEditor->addLeftTopToUndo();
oldEditor->addCaretToUndo(); oldEditor->addCaretToUndo();
oldEditor->selectAll(); oldEditor->replaceAll(newContents.join(oldEditor->lineBreak()));
oldEditor->setSelText(newContents.join(oldEditor->lineBreak()));
oldEditor->setTopLine(topLine); oldEditor->setTopLine(topLine);
oldEditor->setLeftChar(leftChar); oldEditor->setLeftChar(leftChar);
oldEditor->setCaretXY(oldXY); oldEditor->setCaretXY(oldXY);

View File

@ -4276,12 +4276,12 @@ void Editor::reformat()
beginUndoBlock(); beginUndoBlock();
addLeftTopToUndo(); addLeftTopToUndo();
addCaretToUndo(); addCaretToUndo();
selectAll();
SynEditorOptions oldOptions = getOptions(); SynEditorOptions oldOptions = getOptions();
SynEditorOptions newOptions = oldOptions; SynEditorOptions newOptions = oldOptions;
newOptions.setFlag(SynEditorOption::eoAutoIndent,false); newOptions.setFlag(SynEditorOption::eoAutoIndent,false);
setOptions(newOptions); setOptions(newOptions);
setSelText(QString::fromUtf8(newContent)); replaceAll(QString::fromUtf8(newContent));
setCaretXY(mOldCaret); setCaretXY(mOldCaret);
setTopLine(oldTopLine); setTopLine(oldTopLine);
setOptions(oldOptions); setOptions(oldOptions);

View File

@ -6670,8 +6670,7 @@ void MainWindow::on_btnReplace_clicked()
BufferCoord coord=editor->caretXY(); BufferCoord coord=editor->caretXY();
int topLine = editor->topLine(); int topLine = editor->topLine();
int leftChar = editor->leftChar(); int leftChar = editor->leftChar();
editor->selectAll(); editor->replaceAll(contents.join(editor->lineBreak()));
editor->setSelText(contents.join(editor->lineBreak()));
editor->setCaretXY(coord); editor->setCaretXY(coord);
editor->setTopLine(topLine); editor->setTopLine(topLine);
editor->setLeftChar(leftChar); editor->setLeftChar(leftChar);

View File

@ -270,6 +270,11 @@ public:
void endUndoBlock(); void endUndoBlock();
void addCaretToUndo(); void addCaretToUndo();
void addLeftTopToUndo(); void addLeftTopToUndo();
void replaceAll(const QString& text) {
mUndoList->AddChange(SynChangeReason::crSelection,mBlockBegin,mBlockEnd,"", activeSelectionMode());
selectAll();
setSelText(text);
}
//Commands //Commands
virtual void cutToClipboard() { commandProcessor(SynEditorCommand::ecCut);} virtual void cutToClipboard() { commandProcessor(SynEditorCommand::ecCut);}
@ -280,7 +285,6 @@ public:
virtual void zoomIn() { commandProcessor(SynEditorCommand::ecZoomIn);} virtual void zoomIn() { commandProcessor(SynEditorCommand::ecZoomIn);}
virtual void zoomOut() { commandProcessor(SynEditorCommand::ecZoomOut);} virtual void zoomOut() { commandProcessor(SynEditorCommand::ecZoomOut);}
virtual void selectAll() { virtual void selectAll() {
mUndoList->AddChange(SynChangeReason::crSelection,mBlockBegin,mBlockEnd,"", activeSelectionMode());
commandProcessor(SynEditorCommand::ecSelectAll); commandProcessor(SynEditorCommand::ecSelectAll);
} }
virtual void tab() { commandProcessor(SynEditorCommand::ecTab);} virtual void tab() { commandProcessor(SynEditorCommand::ecTab);}

View File

@ -143,6 +143,13 @@ QVariant ClassBrowserModel::data(const QModelIndex &index, int role) const
return QVariant(); return QVariant();
if (role == Qt::DisplayRole) { if (role == Qt::DisplayRole) {
if (node->statement) { if (node->statement) {
if (!(node->statement->type.isEmpty()) &&
((node->statement->kind == StatementKind::skFunction)
|| (node->statement->kind == StatementKind::skVariable)
|| (node->statement->kind == StatementKind::skTypedef)
)) {
return node->statement->command + node->statement->args + " : " + node->statement->type;
}
return node->statement->command + node->statement->args; return node->statement->command + node->statement->args;
} }
} else if (role == Qt::ForegroundRole) { } else if (role == Qt::ForegroundRole) {