diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-11-07 21:20:04 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2019-11-07 21:20:04 +0000 |
commit | 0dbc6e5ecdc3a4ec97fd65876051577e53fc1873 (patch) | |
tree | d746f4dbfd9a59032497b5f655cbb5b68362c9a6 /content | |
parent | 570f2dc03608d525ef02102ff0ca8225d57b40ed (diff) | |
download | netsurf-0dbc6e5ecdc3a4ec97fd65876051577e53fc1873.tar.gz netsurf-0dbc6e5ecdc3a4ec97fd65876051577e53fc1873.tar.bz2 |
fix keypress entry on text area
accidentaly broken in commit fca421e2047a55f3cf575c92943c1116ec58da3c
Diffstat (limited to 'content')
-rw-r--r-- | content/handlers/html/box_textarea.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/content/handlers/html/box_textarea.c b/content/handlers/html/box_textarea.c index 8b4fdf954..e253e168d 100644 --- a/content/handlers/html/box_textarea.c +++ b/content/handlers/html/box_textarea.c @@ -43,24 +43,32 @@ nserror box_textarea_keypress(html_content *html, struct box *box, uint32_t key) struct form_control *gadget = box->gadget; struct textarea *ta = gadget->data.text.ta; struct form* form = box->gadget->form; - struct content *c = (struct content *) html; + struct content *c = (struct content *)html; nserror res = NSERROR_OK; assert(ta != NULL); - if (gadget->type != GADGET_TEXTAREA) { - switch (key) { - case NS_KEY_NL: - case NS_KEY_CR: - if (form) { - res = form_submit(content_get_url(c), - html->bw, - form, - NULL); - } - break; + if (gadget->type == GADGET_TEXTAREA) { + if (textarea_keypress(ta, key)) { + return NSERROR_OK; + } else { + return NSERROR_INVALID; + } + } + + /* non textarea input */ + switch (key) { + case NS_KEY_NL: + case NS_KEY_CR: + if (form) { + res = form_submit(content_get_url(c), + html->bw, + form, + NULL); + } + break; - case NS_KEY_TAB: + case NS_KEY_TAB: { struct form_control *next_input; /* Find next text entry field that is actually @@ -79,9 +87,9 @@ nserror box_textarea_keypress(html_content *html, struct box *box, uint32_t key) textarea_set_caret(next_input->data.text.ta, 0); } } - break; + break; - case NS_KEY_SHIFT_TAB: + case NS_KEY_SHIFT_TAB: { struct form_control *prev_input; /* Find previous text entry field that is actually @@ -100,15 +108,14 @@ nserror box_textarea_keypress(html_content *html, struct box *box, uint32_t key) textarea_set_caret(prev_input->data.text.ta, 0); } } - break; + break; - default: - /* Pass to textarea widget */ - if (!textarea_keypress(ta, key)) { - res = NSERROR_INVALID; - } - break; + default: + /* Pass to textarea widget */ + if (!textarea_keypress(ta, key)) { + res = NSERROR_INVALID; } + break; } return res; |