Clean up tokenizer implementation

Rather than storing a bunch of "next_foo" fields, simply populate the
tok_t directly.
This commit is contained in:
ridiculousfish
2018-02-23 14:30:15 -08:00
parent e9a4875a6b
commit 6673fe5457
7 changed files with 122 additions and 130 deletions

View File

@@ -1744,13 +1744,14 @@ static void handle_token_history(history_search_direction_t dir, bool reset = fa
tok_t token;
while (tok.next(&token)) {
if (token.type != TOK_STRING) continue;
if (token.text.find(data->search_buff) == wcstring::npos) continue;
wcstring text = tok.text_of(token);
if (text.find(data->search_buff) == wcstring::npos) continue;
if (token.offset >= current_pos) continue;
auto found = find(data->search_prev.begin(), data->search_prev.end(), token.text);
auto found = find(data->search_prev.begin(), data->search_prev.end(), text);
if (found == data->search_prev.end()) {
data->token_history_pos = token.offset;
str = token.text;
str = text;
}
}
}