diff --git a/src/browser.c b/src/browser.c index a369f476..e07d5bf2 100644 --- a/src/browser.c +++ b/src/browser.c @@ -359,7 +359,8 @@ void search_filename(bool forwards) #endif } - findfile(last_search, forwards); + if (response == 0 || response == -2) + findfile(last_search, forwards); } /* Search again without prompting for the last given search string, @@ -380,6 +381,18 @@ void research_filename(bool forwards) } } +/* Select the first file in the list -- called by ^W^Y. */ +void to_first_file(void) +{ + selected = 0; +} + +/* Select the last file in the list -- called by ^W^V. */ +void to_last_file(void) +{ + selected = list_length - 1; +} + /* Strip one element from the end of path, and return the stripped path. * The returned string is dynamically allocated, and should be freed. */ char *strip_last_component(const char *path) diff --git a/src/global.c b/src/global.c index 0e9b0618..a15f32c1 100644 --- a/src/global.c +++ b/src/global.c @@ -301,12 +301,6 @@ void flip_goto(void) void to_files(void) { } -void to_first_file(void) -{ -} -void to_last_file(void) -{ -} void goto_dir(void) { } diff --git a/src/prototypes.h b/src/prototypes.h index 3fe5cd8a..807c5a9b 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -191,6 +191,8 @@ typedef void (*functionptrtype)(void); #ifdef ENABLE_BROWSER void browser_refresh(void); char *browse_in(const char *inpath); +void to_first_file(void); +void to_last_file(void); #endif /* Most functions in chars.c. */ @@ -636,8 +638,6 @@ void flip_replace(void); void flip_goto(void); #ifdef ENABLE_BROWSER void to_files(void); -void to_first_file(void); -void to_last_file(void); void goto_dir(void); #endif #ifndef NANO_TINY