diff options
-rw-r--r-- | !NetSurf/Resources/CSS,f79 | 2 | ||||
-rw-r--r-- | desktop/browser.c | 63 |
2 files changed, 56 insertions, 9 deletions
diff --git a/!NetSurf/Resources/CSS,f79 b/!NetSurf/Resources/CSS,f79 index 96480100a..6a9db5a95 100644 --- a/!NetSurf/Resources/CSS,f79 +++ b/!NetSurf/Resources/CSS,f79 @@ -39,7 +39,7 @@ center { text-align: center; } small { font-size: smaller; } big { font-size: larger; } select, input { background-color: #eeb; color: #000; width: 10em; height: 2em; } -textarea { background-color: #eeb; color: #000; } +textarea { background-color: #eeb; color: #000; text-align: left; } input[type=button], input[type=image], input[type=reset], input[type=submit], button { background-color: #ddd; color: #000; width: auto; height: auto; } diff --git a/desktop/browser.c b/desktop/browser.c index b408d38ae..b94a35958 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -819,20 +819,67 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void text_box->width = UNKNOWN_WIDTH; char_offset--; } - } else if (key == 28 && char_offset != text_box->length) { + } else if (key == 28) { /* Right cursor -> */ - char_offset++; - } else if (key == 29 && char_offset != 0) { + if (char_offset == text_box->length && + inline_container->next) { + if (inline_container->next->children) { + /* move to start of next box (if it exists) */ + text_box = inline_container->next->children; + } + char_offset = 0; + inline_container=inline_container->next; + } + else if (char_offset != text_box->length) { + char_offset++; + } + else { + return; + } + } else if (key == 29) { /* Left cursor <- */ - char_offset--; + if (char_offset == 0 && inline_container->prev) { + if (inline_container->prev->children) { + /* move to end of previous box */ + text_box = inline_container->prev->children; + } + inline_container=inline_container->prev; + char_offset = text_box->length; + } + else if (char_offset != 0) { + char_offset--; + } + else { + return; + } } else if (key == 30) { /* Up Cursor */ - /* TODO */ - return; + if (inline_container->prev) { + if (inline_container->prev->children) { + text_box = inline_container->prev->children; + } + inline_container = inline_container->prev; + if (char_offset > text_box->length) { + char_offset = text_box->length; + } + } + else { + return; + } } else if (key == 31) { /* Down cursor */ - /* TODO */ - return; + if (inline_container->next) { + if (inline_container->next->children) { + text_box = inline_container->next->children; + } + inline_container = inline_container->next; + if (char_offset > text_box->length) { + char_offset = text_box->length; + } + } + else { + return; + } } else { return; } |