src/file.cpp

changeset 470
e41b6e1e3299
parent 467
59549731151a
child 471
fc58b67d445c
--- a/src/file.cpp	Wed Aug 21 10:54:33 2013 +0300
+++ b/src/file.cpp	Wed Aug 21 11:09:39 2013 +0300
@@ -130,10 +130,16 @@
 	// file as something else.
 	if (this == LDFile::current()) {
 		// If we closed the last file, create a blank one.
-		if (g_loadedFiles.size() == 0)
+		if (countExplicitFiles() == 0)
 			newFile();
-		else
-			LDFile::setCurrent (g_loadedFiles[0]);
+		else {
+			// Find the first explicit file loaded
+			int idx = 0;
+			while (g_loadedFiles[idx]->implicit())
+				idx++;
+			
+			LDFile::setCurrent (g_loadedFiles[idx]);
+		}
 	}
 	
 	g_win->updateFileList();

mercurial