@@ -150,6 +150,11 @@ define(function (require, exports, module) {
150
150
151
151
// Disable the cache to make reloads work
152
152
disableCache ( ) . always ( function ( ) {
153
+ // Remove all menus to assure every part of Brackets is reloaded
154
+ _ . forEach ( Menus . getAllMenus ( ) , function ( value , key ) {
155
+ Menus . removeMenu ( key ) ;
156
+ } ) ;
157
+
153
158
window . location . href = href ;
154
159
} ) ;
155
160
} ) ;
@@ -174,32 +179,32 @@ define(function (require, exports, module) {
174
179
href += "?" + params . toString ( ) ;
175
180
}
176
181
177
- browserReload ( href ) ;
182
+ // Give Mac native menus extra time to update shortcut highlighting.
183
+ // Prevents the menu highlighting from getting messed up after reload.
184
+ window . setTimeout ( function ( ) {
185
+ browserReload ( href ) ;
186
+ } , 100 ) ;
178
187
}
179
188
180
189
function handleReloadWithoutUserExts ( ) {
181
190
var href = window . location . href ,
182
191
params = new UrlParams ( ) ;
183
192
184
- // Give Mac native menus extra time to update shortcut highlighting prior
185
- // to removing menus, or else the highlights get messed up after the reload.
193
+ params . parse ( ) ;
194
+
195
+ if ( ! params . get ( "reloadWithoutUserExts" ) ) {
196
+ params . put ( "reloadWithoutUserExts" , true ) ;
197
+ }
198
+
199
+ if ( href . indexOf ( "?" ) !== - 1 ) {
200
+ href = href . substring ( 0 , href . indexOf ( "?" ) ) ;
201
+ }
202
+
203
+ href += "?" + params . toString ( ) ;
204
+
205
+ // Give Mac native menus extra time to update shortcut highlighting.
206
+ // Prevents the menu highlighting from getting messed up after reload.
186
207
window . setTimeout ( function ( ) {
187
- // Remove all menus to assure extension menus and menu items are removed
188
- _ . forEach ( Menus . getAllMenus ( ) , function ( value , key ) {
189
- Menus . removeMenu ( key ) ;
190
- } ) ;
191
-
192
- params . parse ( ) ;
193
-
194
- if ( ! params . get ( "reloadWithoutUserExts" ) ) {
195
- params . put ( "reloadWithoutUserExts" , true ) ;
196
- }
197
-
198
- if ( href . indexOf ( "?" ) !== - 1 ) {
199
- href = href . substring ( 0 , href . indexOf ( "?" ) ) ;
200
- }
201
-
202
- href += "?" + params . toString ( ) ;
203
208
browserReload ( href ) ;
204
209
} , 100 ) ;
205
210
}
0 commit comments