Clean up reader history search

Factor the history search fields into a new class.
As a side effect, this shares the deduplication logic, so that token search
no longer returns duplicates.

Fixes #4795
This commit is contained in:
ridiculousfish
2018-08-11 14:30:10 -07:00
parent 1473f952d4
commit e51e854d8d
4 changed files with 240 additions and 249 deletions

View File

@@ -108,7 +108,7 @@ history_t *reader_get_history();
/// \param b the new buffer value
/// \param p the cursor position. If \c p is larger than the length of the command line, the cursor
/// is placed on the last character.
void reader_set_buffer(const wcstring &b, size_t p);
void reader_set_buffer(const wcstring &b, size_t p = -1);
/// Get the current cursor position in the command line. If interactive mode is uninitialized,
/// return (size_t)-1.
@@ -208,15 +208,10 @@ bool reader_exit_forced();
parser_test_error_bits_t reader_shell_test(const wcstring &);
/// Test whether the interactive reader is in search mode.
///
/// \return 0 if not in search mode, 1 if in search mode and -1 if not in interactive mode
int reader_search_mode();
bool reader_is_in_search_mode();
/// Test whether the interactive reader has visible pager contents.
///
/// \return 0 if it has pager contents, 1 if it does not have pager contents, and -1 if not in
/// interactive mode
int reader_has_pager_contents();
bool reader_has_pager_contents();
/// Given a command line and an autosuggestion, return the string that gets shown to the user.
/// Exposed for testing purposes only.