summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index b94a35958..3aea8f8d4 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -822,7 +822,8 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
} else if (key == 28) {
/* Right cursor -> */
if (char_offset == text_box->length &&
- inline_container->next) {
+ text_box == inline_container->last &&
+ inline_container->next) {
if (inline_container->next->children) {
/* move to start of next box (if it exists) */
text_box = inline_container->next->children;
@@ -830,6 +831,10 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
char_offset = 0;
inline_container=inline_container->next;
}
+ else if (char_offset == text_box->length && text_box->next) {
+ text_box = text_box->next;
+ char_offset == 0;
+ }
else if (char_offset != text_box->length) {
char_offset++;
}
@@ -838,7 +843,9 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
}
} else if (key == 29) {
/* Left cursor <- */
- if (char_offset == 0 && inline_container->prev) {
+ if (char_offset == 0 &&
+ text_box == inline_container->children &&
+ inline_container->prev) {
if (inline_container->prev->children) {
/* move to end of previous box */
text_box = inline_container->prev->children;
@@ -846,6 +853,10 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
inline_container=inline_container->prev;
char_offset = text_box->length;
}
+ else if (char_offset == 0 && text_box->next) {
+ text_box = text_box->next;
+ char_offset = text_box->length;
+ }
else if (char_offset != 0) {
char_offset--;
}
@@ -854,7 +865,8 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
}
} else if (key == 30) {
/* Up Cursor */
- if (inline_container->prev) {
+ if (text_box == inline_container->children &&
+ inline_container->prev) {
if (inline_container->prev->children) {
text_box = inline_container->prev->children;
}
@@ -863,12 +875,19 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
char_offset = text_box->length;
}
}
+ else if (text_box->prev) {
+ text_box = text_box->prev;
+ if (char_offset > text_box->length) {
+ char_offset = text_box->length;
+ }
+ }
else {
return;
}
} else if (key == 31) {
/* Down cursor */
- if (inline_container->next) {
+ if (text_box == inline_container->last &&
+ inline_container->next) {
if (inline_container->next->children) {
text_box = inline_container->next->children;
}
@@ -877,6 +896,12 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
char_offset = text_box->length;
}
}
+ else if (text_box->next) {
+ text_box = text_box->next;
+ if (char_offset > text_box->length) {
+ char_offset = text_box->length;
+ }
+ }
else {
return;
}