work save

This commit is contained in:
royqh1979 2021-11-08 14:51:20 +08:00
parent f167e10c12
commit 93463c24ca
3 changed files with 14 additions and 8 deletions

View File

@ -1595,6 +1595,13 @@ void Editor::resetBreakpoints()
invalidate(); invalidate();
} }
bool Editor::notParsed()
{
if (!mParser)
return true;
return mParser->findFileIncludes(mFilename)==nullptr;
}
QChar Editor::getCurrentChar() QChar Editor::getCurrentChar()
{ {
if (lineText().length()<caretX()) if (lineText().length()<caretX())

View File

@ -167,6 +167,7 @@ public:
void exportAsRTF(const QString& rtfFilename); void exportAsRTF(const QString& rtfFilename);
void exportAsHTML(const QString& htmlFilename); void exportAsHTML(const QString& htmlFilename);
void resetBreakpoints(); void resetBreakpoints();
bool notParsed();
const PCppParser &parser(); const PCppParser &parser();

View File

@ -4774,24 +4774,22 @@ PSymbolUsageManager &MainWindow::symbolUsageManager()
static void updateEditorParser(QTabWidget* tabWidget, static void updateEditorParser(QTabWidget* tabWidget,
Editor* editor) { Editor* editor) {
qDebug()<<"update editors";
qDebug()<<pSettings->codeCompletion().clearWhenEditorHidden();
if (pSettings->codeCompletion().clearWhenEditorHidden()) { if (pSettings->codeCompletion().clearWhenEditorHidden()) {
for (int i=0;i<tabWidget->count();i++) { for (int i=0;i<tabWidget->count();i++) {
Editor * e = (Editor*)(tabWidget->widget(i)); Editor * e = (Editor*)(tabWidget->widget(i));
if (!e->inProject()) { if (!e->inProject()) {
if (e==editor) { if (e!=editor && e->parser() && !e->notParsed()) {
resetCppParser(e->parser());
e->reparse();
} else {
qDebug()<<"clear editor:"<<e->filename();
//e->initParser();
e->parser()->reset(); e->parser()->reset();
} }
} }
} }
} }
if (editor && editor->parser() && editor->notParsed()) {
resetCppParser(editor->parser());
editor->reparse();
}
} }
void MainWindow::on_EditorTabsLeft_currentChanged(int) void MainWindow::on_EditorTabsLeft_currentChanged(int)
{ {
Editor * editor = mEditorList->getEditor(-1,ui->EditorTabsLeft); Editor * editor = mEditorList->getEditor(-1,ui->EditorTabsLeft);