diff --git a/NEWS.md b/NEWS.md index 3b624147..edf44de9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -19,6 +19,7 @@ Red Panda C++ Version 2.10 - fix: Can't correctly set project file's encoding back to 'UTF-8'/'ANSI' in the project options dialog/files setting page. - enhancement: Simplified chinese translations for encoding names. - fix: Crash when there are preprocessing directives like '#if 0/0' or '#if 0%0' + - enhancement: Pause autosave timer when autosave new files. Red Panda C++ Version 2.9 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 2706a65f..cefc045f 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -2421,7 +2421,6 @@ void MainWindow::prepareDebugger() void MainWindow::doAutoSave(Editor *e) { - if (!e || !e->canAutoSave()) return; QString filename = e->filename(); @@ -2432,7 +2431,12 @@ void MainWindow::doAutoSave(Editor *e) QString suffix = fileInfo.suffix(); switch(pSettings->editor().autoSaveStrategy()) { case assOverwrite: - e->save(); + if (e->isNew()) { + mAutoSaveTimer.stop(); + e->save(); + mAutoSaveTimer.start(pSettings->editor().autoSaveInterval()*60*1000); + } else + e->save(); return; case assAppendUnixTimestamp: filename = parent.filePath( @@ -2451,7 +2455,9 @@ void MainWindow::doAutoSave(Editor *e) } } if (e->isNew()) { + mAutoSaveTimer.stop(); e->saveAs(); + mAutoSaveTimer.start(pSettings->editor().autoSaveInterval()*60*1000); } else { e->saveFile(filename); e->setCanAutoSave(false);