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();
}
bool Editor::notParsed()
{
if (!mParser)
return true;
return mParser->findFileIncludes(mFilename)==nullptr;
}
QChar Editor::getCurrentChar()
{
if (lineText().length()<caretX())

View File

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

View File

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