summaryrefslogtreecommitdiff
path: root/src/mainwin.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-06-05 01:15:01 (GMT)
committerMarius Kintel <marius@kintel.net>2013-06-05 01:15:01 (GMT)
commit3e024822e6820bf29cdf555cfac180880d6fc962 (patch)
tree598ef2d22521c9e4e3711f1e8e28cee713f0614c /src/mainwin.cc
parent85c83fbc04f4918159a598793cee47cdafabf8c4 (diff)
Fixed a bug where a file was loaded twice when auto reload was on
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r--src/mainwin.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc
index eedd3a5..7cebd7e 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -511,7 +511,8 @@ MainWindow::openFile(const QString &new_filename)
}
#endif
setFileName(actual_filename);
-
+
+ fileChangedOnDisk(); // force cached autoReloadId to update
refreshDocument();
updateRecentFiles();
if (actual_filename.isEmpty()) {
@@ -627,10 +628,17 @@ void MainWindow::compile(bool reload, bool forcedone)
// Reload checks the timestamp of the toplevel file and refreshes if necessary,
if (reload) {
+ // Refresh files if it has changed on disk
if (fileChangedOnDisk() && checkEditorModified()) {
shouldcompiletoplevel = true;
refreshDocument();
}
+ // If the file hasn't changed, we might still need to compile it
+ // if we haven't yet compiled the current text.
+ else {
+ QString current_doc = editor->toPlainText();
+ if (current_doc != last_compiled_doc) shouldcompiletoplevel = true;
+ }
}
else {
shouldcompiletoplevel = true;
@@ -1052,7 +1060,10 @@ void MainWindow::actionShowLibraryFolder()
void MainWindow::actionReload()
{
- if (checkEditorModified()) refreshDocument();
+ if (checkEditorModified()) {
+ fileChangedOnDisk(); // force cached autoReloadId to update
+ refreshDocument();
+ }
}
void MainWindow::hideEditor()
contact: Jan Huwald // Impressum