@@ -227,14 +227,35 @@ define(function (require, exports, module) {
227227
228228 // Show file-exclusion UI *unless* search scope is just a single file
229229 if ( ! scope || scope . isDirectory ) {
230- var exclusionsContext = {
231- label : FindUtils . labelForScope ( scope ) ,
232- promise : candidateFilesPromise
233- } ;
230+ var oldModalBarHeight = _findBar . _modalBar . height ( ) ,
231+ exclusionsContext = {
232+ label : FindUtils . labelForScope ( scope ) ,
233+ promise : candidateFilesPromise
234+ } ;
234235
235236 filterPicker = FileFilters . createFilterPicker ( exclusionsContext ) ;
236237 // TODO: include in FindBar? (and disable it when FindBar is disabled)
237238 _findBar . _modalBar . getRoot ( ) . find ( ".scope-group" ) . append ( filterPicker ) ;
239+
240+ // Appending FilterPicker can change height of modal bar, so resize editor.
241+ // Preserve scroll position of the current full editor across the editor refresh, adjusting for the
242+ // height of the modal bar so the code doesn't appear to shift if possible.
243+ //
244+ // TODO: This is an isolated fix for #8242.
245+ // 1. If we keep this code, then this is done in a couple places in ModalBar,
246+ // so this code should be a utility function
247+ // 2. Another solution is to pass this info FindBar.open
248+ // 3. Also could make exclusion part of dialog a fixed height
249+ var fullEditor = EditorManager . getCurrentFullEditor ( ) ,
250+ scrollPos ;
251+ if ( fullEditor ) {
252+ scrollPos = fullEditor . getScrollPos ( ) ;
253+ scrollPos . y -= oldModalBarHeight ; // modalbar already showing, adjust for old height
254+ }
255+ EditorManager . resizeEditor ( ) ;
256+ if ( fullEditor ) {
257+ fullEditor . _codeMirror . scrollTo ( scrollPos . x , scrollPos . y + _findBar . _modalBar . height ( ) ) ;
258+ }
238259 }
239260
240261 handleQueryChange ( ) ;
0 commit comments