Skip to content
Permalink
Browse files

Merge branch 'feature/help-search' into csboling-dev

  • Loading branch information
csboling committed Oct 6, 2019
2 parents 2b6f587 + 00ed6df commit 6ddf2c77ea65d6f17219e98ed85ebf54b2c1b2ed
Showing with 15 additions and 0 deletions.
  1. +15 −0 module/help_mode.c
@@ -875,6 +875,7 @@ typedef enum {
static search_mode_t search_mode;
static search_state_t search_state;
static search_result_t search_result;
static int prev_hit;

static bool dirty;

@@ -962,9 +963,15 @@ void process_help_keys(uint8_t k, uint8_t m, bool is_held_key) {
switch (search_mode) {
case SEARCH_MODE_FWD: {
if (search_result == SEARCH_RESULT_HIT) {
prev_hit = search_state.line;
if (search_state.line < help_length[page_no]) {
search_state.line++;
}
else {
search_result = SEARCH_RESULT_MISS;
dirty = true;
return;
}
}
for (int p = page_no; p < HELP_PAGES; p++) {
if (text_search_forward(&search_state,
@@ -978,15 +985,22 @@ void process_help_keys(uint8_t k, uint8_t m, bool is_held_key) {
}
search_state.line = 0;
}
search_state.line = prev_hit;
search_result = SEARCH_RESULT_MISS;
dirty = true;
return;
}
case SEARCH_MODE_REV: {
if (search_result == SEARCH_RESULT_HIT) {
prev_hit = search_state.line;
if (search_state.line > 0) {
search_state.line--;
}
else {
search_result = SEARCH_RESULT_MISS;
dirty = true;
return;
}
}
for (int p = page_no; p >= 0; p--) {
if (text_search_reverse(&search_state,
@@ -1002,6 +1016,7 @@ void process_help_keys(uint8_t k, uint8_t m, bool is_held_key) {
search_state.line = help_length[p-1];
}
}
search_state.line = prev_hit;
search_result = SEARCH_RESULT_MISS;
dirty = true;
return;

0 comments on commit 6ddf2c7

Please sign in to comment.