browser: make the keystrokes ^W^Y and ^W^V work again

The functions to_first_file() and to_last_file() can get called from
do_statusbar_input(), which is called indirectly from do_prompt(),
and are expected to make the corresponding adjustment.

This fixes https://savannah.gnu.org/bugs/?61273.

Bug existed since version 5.0, commit 07c1ac90.
master
Benno Schulenberg 2021-10-04 11:31:22 +02:00
parent 2f216281e7
commit 508301a2ef
3 changed files with 16 additions and 9 deletions

View File

@ -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)

View File

@ -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)
{
}

View File

@ -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