summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-09-23 21:48:22 +0000
committerJames Bursa <james@netsurf-browser.org>2003-09-23 21:48:22 +0000
commit6da97decbfa7acdf612c5f1ef883fabf0d333ec1 (patch)
tree737e474efab21eca43f39b24d9cccadebd3330cb /desktop
parent29952cfc1f7b4db4ca8f999d1c52813b8a49ab01 (diff)
downloadnetsurf-6da97decbfa7acdf612c5f1ef883fabf0d333ec1.tar.gz
netsurf-6da97decbfa7acdf612c5f1ef883fabf0d333ec1.tar.bz2
[project @ 2003-09-23 21:48:22 by bursa]
Textarea related fixes. svn path=/import/netsurf/; revision=312
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 8e8aa061d..718bdb161 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -643,6 +643,9 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
box_coords(textarea, &actual_x, &actual_y);
+ /* box_dump(textarea, 0); */
+ LOG(("key %i at %i in '%.*s'", key, char_offset, (int) text_box->length, text_box->text));
+
if (32 <= key && key != 127) {
/* normal character insertion */
text_box->text = xrealloc(text_box->text, text_box->length + 2);
@@ -666,6 +669,9 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
} else if (inline_container->prev) {
/* merge with previous paragraph */
struct box *prev_container = inline_container->prev;
+ struct box *t;
+ for (t = inline_container->children; t; t = t->next)
+ t->parent = prev_container;
prev_container->last->next = inline_container->children;
inline_container->children->prev = prev_container->last;
prev_container->last = inline_container->last;
@@ -745,7 +751,22 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
return;
}
- box_dump(textarea, 0);
+ /* for (struct box *ic = textarea->children; ic; ic = ic->next) {
+ assert(ic->type == BOX_INLINE_CONTAINER);
+ assert(ic->parent == textarea);
+ if (ic->next) assert(ic->next->prev == ic);
+ if (ic->prev) assert(ic->prev->next == ic);
+ if (!ic->next) assert(textarea->last == ic);
+ for (struct box *t = ic->children; t; t = t->next) {
+ assert(t->type == BOX_INLINE);
+ assert(t->text);
+ assert(t->font);
+ assert(t->parent == ic);
+ if (t->next) assert(t->next->prev == t);
+ if (t->prev) assert(t->prev->next == t);
+ if (!t->next) assert(ic->last == t);
+ }
+ } */
/* reflow textarea preserving width and height */
width = textarea->width;
@@ -754,6 +775,25 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
textarea->width = width;
textarea->height = height;
+ /* box_dump(textarea, 0); */
+
+ /* for (struct box *ic = textarea->children; ic; ic = ic->next) {
+ assert(ic->type == BOX_INLINE_CONTAINER);
+ assert(ic->parent == textarea);
+ if (ic->next) assert(ic->next->prev == ic);
+ if (ic->prev) assert(ic->prev->next == ic);
+ if (!ic->next) assert(textarea->last == ic);
+ for (struct box *t = ic->children; t; t = t->next) {
+ assert(t->type == BOX_INLINE);
+ assert(t->text);
+ assert(t->font);
+ assert(t->parent == ic);
+ if (t->next) assert(t->next->prev == t);
+ if (t->prev) assert(t->prev->next == t);
+ if (!t->next) assert(ic->last == t);
+ }
+ } */
+
if (text_box->length < char_offset) {
/* the text box has been split and the caret is in the second part */
char_offset -= (text_box->length + 1); /* +1 for the space */