summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2017-09-09 20:23:32 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2017-09-10 14:53:15 (GMT)
commit43cdd742212ae0b47080717bfab028b1c78fbebc (patch)
tree78a23a181cb33cb7d802d3e814faf21f409736f6
parent3a02a4ea484685e5fce9c6c77f521670959d926b (diff)
downloadnetsurf-43cdd742212ae0b47080717bfab028b1c78fbebc.tar.gz
netsurf-43cdd742212ae0b47080717bfab028b1c78fbebc.tar.bz2
Treeview: Add keypress handling to the search bar.
-rw-r--r--desktop/treeview.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/desktop/treeview.c b/desktop/treeview.c
index a460f4d..ba1056e 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -3281,7 +3281,7 @@ bool treeview_keypress(treeview *tree, uint32_t key)
assert(tree != NULL);
- /* Pass to textarea, if editing in progress */
+ /* Pass to any textarea, if editing in progress */
if (tree->edit.textarea != NULL) {
switch (key) {
case NS_KEY_ESCAPE:
@@ -3294,6 +3294,23 @@ bool treeview_keypress(treeview *tree, uint32_t key)
default:
return textarea_keypress(tree->edit.textarea, key);
}
+ } else if (tree->search.active == true) {
+ switch (key) {
+ case NS_KEY_ESCAPE:
+ textarea_set_text(tree->search.textarea, "");
+ textarea_set_caret(tree->search.textarea, 0);
+ r.x0 = tree_g.window_padding + tree_g.icon_size;
+ r.x1 = 600;
+ r.y0 = 0;
+ r.y1 = tree_g.line_height;
+ cw_invalidate_area(tree, &r);
+ return true;
+ case NS_KEY_NL:
+ case NS_KEY_CR:
+ return true;
+ default:
+ return textarea_keypress(tree->search.textarea, key);
+ }
}
/* Keypress to be handled by treeview */