diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-03-18 22:06:42 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-03-18 22:06:42 -0700 |
commit | 890f9b6142cfa336d4ca77be3ff884086199e7e7 (patch) | |
tree | 5fa2203d6f0b1b6caed0a03c1fd562616e801b19 /100trace_browser.cc | |
parent | 797edfd041c2a8025c6273cea92a1a1ac481d5cc (diff) | |
download | mu-890f9b6142cfa336d4ca77be3ff884086199e7e7.tar.gz |
3800
Diffstat (limited to '100trace_browser.cc')
-rw-r--r-- | 100trace_browser.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/100trace_browser.cc b/100trace_browser.cc index ba48513b..42a4d848 100644 --- a/100trace_browser.cc +++ b/100trace_browser.cc @@ -60,6 +60,8 @@ //: `right-arrow`: move cursor right. //: `ctrl-a` or `home`: move cursor to start of search pattern. //: `ctrl-e` or `end`: move cursor to end of search pattern. +//: `ctrl-u`: clear search pattern before cursor +//: `ctrl-k`: clear search pattern at and after cursor :(before "End Primitive Recipe Declarations") _BROWSE_TRACE, @@ -331,6 +333,24 @@ bool start_search_editor(search_direction dir) { tb_present(); } } + else if (key == TB_KEY_CTRL_K) { + int old_pattern_size = SIZE(pattern); + pattern.erase(col-/*slash*/1, SIZE(pattern) - (col-/*slash*/1)); + for (int x = col; x < old_pattern_size+/*slash*/1; ++x) + tb_change_cell(x, bottom_screen_line, ' ', TB_WHITE, TB_BLACK); + tb_set_cursor(col, bottom_screen_line); + tb_present(); + } + else if (key == TB_KEY_CTRL_U) { + int old_pattern_size = SIZE(pattern); + pattern.erase(0, col-/*slash*/1); + for (int x = /*slash*/1; x < SIZE(pattern)+/*skip slash*/1; ++x) + tb_change_cell(x, bottom_screen_line, pattern.at(x-/*slash*/1), TB_WHITE, TB_BLACK); + for (int x = SIZE(pattern)+/*slash*/1; x < old_pattern_size+/*skip slash*/1; ++x) + tb_change_cell(x, bottom_screen_line, ' ', TB_WHITE, TB_BLACK); + tb_set_cursor(/*start of pattern skipping slash*/1, bottom_screen_line); + tb_present(); + } else if (key < 128) { // ascii only // update pattern char c = static_cast<char>(key); |