@@ -108,6 +108,10 @@ public Sketch(Editor _editor, File file) throws IOException {
108
108
* in which case the load happens each time "run" is hit.
109
109
*/
110
110
protected void load () throws IOException {
111
+ load (false );
112
+ }
113
+
114
+ protected void load (boolean forceUpdate ) throws IOException {
111
115
data .load ();
112
116
113
117
for (SketchCode code : data .getCodes ()) {
@@ -117,7 +121,7 @@ protected void load() throws IOException {
117
121
118
122
// set the main file to be the current tab
119
123
if (editor != null ) {
120
- setCurrentCode (0 );
124
+ setCurrentCode (currentIndex , forceUpdate );
121
125
}
122
126
}
123
127
@@ -979,8 +983,12 @@ public void importLibrary(File jarPath) throws IOException {
979
983
* </OL>
980
984
*/
981
985
public void setCurrentCode (int which ) {
986
+ setCurrentCode (which , false );
987
+ }
988
+
989
+ public void setCurrentCode (int which , boolean forceUpdate ) {
982
990
// if current is null, then this is the first setCurrent(0)
983
- if ((currentIndex == which ) && (current != null )) {
991
+ if (! forceUpdate && (currentIndex == which ) && (current != null )) {
984
992
return ;
985
993
}
986
994
@@ -1065,11 +1073,8 @@ public void prepare() throws IOException {
1065
1073
//handleOpen(sketch);
1066
1074
//history.lastRecorded = historySaved;
1067
1075
1068
- // set current to null so that the tab gets updated
1069
- // http://dev.processing.org/bugs/show_bug.cgi?id=515
1070
- current = null ;
1071
1076
// nuke previous files and settings, just get things loaded
1072
- load ();
1077
+ load (true );
1073
1078
}
1074
1079
1075
1080
// // handle preprocessing the main file's code
0 commit comments