- 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: 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: 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
- 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->addLeftTopToUndo();
oldEditor->addCaretToUndo();
oldEditor->selectAll();
oldEditor->setSelText(newContents.join(oldEditor->lineBreak()));
oldEditor->replaceAll(newContents.join(oldEditor->lineBreak()));
oldEditor->setTopLine(topLine);
oldEditor->setLeftChar(leftChar);
oldEditor->setCaretXY(oldXY);

View File

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

View File

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

View File

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

View File

@ -143,6 +143,13 @@ QVariant ClassBrowserModel::data(const QModelIndex &index, int role) const
return QVariant();
if (role == Qt::DisplayRole) {
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;
}
} else if (role == Qt::ForegroundRole) {