Author: phlamethrower
Date: Sun Sep 10 16:56:23 2006
New Revision: 2943
URL:
http://svn.semichrome.net?rev=2943&view=rev
Log:
Fix some caret/scrolling issues after pasting into textarea
Modified:
trunk/netsurf/desktop/textinput.c
Modified: trunk/netsurf/desktop/textinput.c
URL:
http://svn.semichrome.net/trunk/netsurf/desktop/textinput.c?rev=2943&...
==============================================================================
--- trunk/netsurf/desktop/textinput.c (original)
+++ trunk/netsurf/desktop/textinput.c Sun Sep 10 16:56:23 2006
@@ -1220,19 +1220,30 @@
utf8 = ++p;
}
+// textarea->gadget->caret_inline_container = inline_container;
+ textarea->gadget->caret_text_box = text_box;
+ textarea->gadget->caret_box_offset = char_offset;
+
if (update) {
int box_x, box_y;
/* reflow textarea preserving width and height */
textarea_reflow(bw, textarea, inline_container);
+ /* reflowing may have broken our caret offset */
+ if(textarea->gadget->caret_box_offset > text_box->length)
+ char_offset = textarea->gadget->caret_box_offset = text_box->length;
nsfont_width(text_box->style, text_box->text,
char_offset, &pixel_offset);
+ textarea->gadget->caret_pixel_offset = pixel_offset;
+
+ box_coords(textarea, &box_x, &box_y);
+ box_x += textarea->scroll_x;
+ box_y += textarea->scroll_y;
+ ensure_caret_visible(textarea);
box_x -= textarea->scroll_x;
box_y -= textarea->scroll_y;
-
- box_coords(textarea, &box_x, &box_y);
browser_window_place_caret(bw,
box_x + inline_container->x + text_box->x +
@@ -1244,14 +1255,9 @@
browser_window_textarea_move_caret,
textarea);
- textarea->gadget->caret_pixel_offset = pixel_offset;
-
browser_redraw_box(bw->current_content, textarea);
- }
-
-// textarea->gadget->caret_inline_container = inline_container;
- textarea->gadget->caret_text_box = text_box;
- textarea->gadget->caret_box_offset = char_offset;
+
+ }
return success;
}