@@ -7,7 +7,7 @@ import 'vs/css!./renameInputField';
77import { DisposableStore } from 'vs/base/common/lifecycle' ;
88import { ContentWidgetPositionPreference , ICodeEditor , IContentWidget , IContentWidgetPosition } from 'vs/editor/browser/editorBrowser' ;
99import { Position } from 'vs/editor/common/core/position' ;
10- import { IRange , Range } from 'vs/editor/common/core/range' ;
10+ import { IRange } from 'vs/editor/common/core/range' ;
1111import { ScrollType } from 'vs/editor/common/editorCommon' ;
1212import { localize } from 'vs/nls' ;
1313import { IContextKey , IContextKeyService , RawContextKey } from 'vs/platform/contextkey/common/contextkey' ;
@@ -16,6 +16,7 @@ import { IColorTheme, IThemeService } from 'vs/platform/theme/common/themeServic
1616import { EditorOption } from 'vs/editor/common/config/editorOptions' ;
1717import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding' ;
1818import { toggleClass } from 'vs/base/browser/dom' ;
19+ import { CancellationToken } from 'vs/base/common/cancellation' ;
1920
2021export const CONTEXT_RENAME_INPUT_VISIBLE = new RawContextKey < boolean > ( 'renameInputVisible' , false ) ;
2122
@@ -149,7 +150,7 @@ export class RenameInputField implements IContentWidget {
149150 }
150151 }
151152
152- getInput ( where : IRange , value : string , selectionStart : number , selectionEnd : number , supportPreview : boolean ) : Promise < RenameInputFieldResult | boolean > {
153+ getInput ( where : IRange , value : string , selectionStart : number , selectionEnd : number , supportPreview : boolean , token : CancellationToken ) : Promise < RenameInputFieldResult | boolean > {
153154
154155 toggleClass ( this . _domNode ! , 'preview' , supportPreview ) ;
155156
@@ -185,14 +186,7 @@ export class RenameInputField implements IContentWidget {
185186 } ) ;
186187 } ;
187188
188- let onCursorChanged = ( ) => {
189- const editorPosition = this . _editor . getPosition ( ) ;
190- if ( ! editorPosition || ! Range . containsPosition ( where , editorPosition ) ) {
191- this . cancelInput ( true ) ;
192- }
193- } ;
194-
195- disposeOnDone . add ( this . _editor . onDidChangeCursorSelection ( onCursorChanged ) ) ;
189+ token . onCancellationRequested ( ( ) => this . cancelInput ( true ) ) ;
196190 disposeOnDone . add ( this . _editor . onDidBlurEditorWidget ( ( ) => this . cancelInput ( false ) ) ) ;
197191
198192 this . _show ( ) ;
0 commit comments