File tree Expand file tree Collapse file tree
src/vs/editor/contrib/find Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,6 +262,13 @@ export class FindModelBoundToEditorModel {
262262
263263 private _moveToPrevMatch ( before : Position , isRecursed : boolean = false ) : void {
264264 if ( ! this . _state . canNavigateBack ( ) ) {
265+ // we are beyond the first matched find result
266+ // instead of doing nothing, we should refocus the first item
267+ const nextMatchRange = this . _decorations . matchAfterPosition ( before ) ;
268+
269+ if ( nextMatchRange ) {
270+ this . _setCurrentFindMatch ( nextMatchRange ) ;
271+ }
265272 return ;
266273 }
267274 if ( this . _decorations . getCount ( ) < MATCHES_LIMIT ) {
@@ -350,6 +357,13 @@ export class FindModelBoundToEditorModel {
350357
351358 private _moveToNextMatch ( after : Position ) : void {
352359 if ( ! this . _state . canNavigateForward ( ) ) {
360+ // we are beyond the last matched find result
361+ // instead of doing nothing, we should refocus the last item
362+ const prevMatchRange = this . _decorations . matchBeforePosition ( after ) ;
363+
364+ if ( prevMatchRange ) {
365+ this . _setCurrentFindMatch ( prevMatchRange ) ;
366+ }
353367 return ;
354368 }
355369 if ( this . _decorations . getCount ( ) < MATCHES_LIMIT ) {
You can’t perform that action at this time.
0 commit comments