[gtkhtml] Wrong cursor position after paste of text with <div></div>
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkhtml] Wrong cursor position after paste of text with <div></div>
- Date: Tue, 2 Jul 2013 17:13:46 +0000 (UTC)
commit 9f2f6a0e3bf2763ff3c80ba4525feb3d3889ca67
Author: Milan Crha <mcrha redhat com>
Date: Tue Jul 2 19:11:37 2013 +0200
Wrong cursor position after paste of text with <div></div>
The <div /> is placed as DISPLAY_BLOCK, which adds one more character
for cursor positioning, which was not counted with, thus after paste
the cursor was positioned before the end of the pasted text.
gtkhtml/htmlcluev.c | 18 ++++++++++++++++++
gtkhtml/htmlcluev.h | 1 +
2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtkhtml/htmlcluev.c b/gtkhtml/htmlcluev.c
index b302770..d250b24 100644
--- a/gtkhtml/htmlcluev.c
+++ b/gtkhtml/htmlcluev.c
@@ -935,6 +935,20 @@ html_cluev_real_get_direction (HTMLObject *o)
return HTML_CLUEV (o)->dir;
}
+static guint
+get_recursive_length (HTMLObject *self)
+{
+ HTMLClueV *cluev = HTML_CLUEV (self);
+ guint len;
+
+ len = (* HTML_OBJECT_CLASS (parent_class)->get_recursive_length) (self);
+
+ if (cluev->display == DISPLAY_BLOCK)
+ len++;
+
+ return len;
+}
+
static void
html_cluev_destroy (HTMLObject *self)
{
@@ -984,6 +998,7 @@ html_cluev_class_init (HTMLClueVClass *klass,
object_class->get_left_margin = get_left_margin;
object_class->get_right_margin = get_right_margin;
object_class->get_direction = html_cluev_real_get_direction;
+ object_class->get_recursive_length = get_recursive_length;
object_class->destroy = html_cluev_destroy;
clue_class->get_left_clear = get_left_clear;
@@ -1027,6 +1042,7 @@ html_cluev_init (HTMLClueV *cluev,
cluev->border_width = 0;
cluev->border_color = NULL;
cluev->background_color = NULL;
+ cluev->display = DISPLAY_INLINE;
}
HTMLObject *
@@ -1064,6 +1080,7 @@ html_cluev_set_style (HTMLClueV *cluev,
cluev->background_color = style->bg_color;
if (cluev->background_color)
html_color_ref (cluev->background_color);
+ cluev->display = style->display;
} else {
if (cluev->border_color)
html_color_unref (cluev->border_color);
@@ -1075,5 +1092,6 @@ html_cluev_set_style (HTMLClueV *cluev,
cluev->border_width = 0;
cluev->border_color = NULL;
cluev->background_color = NULL;
+ cluev->display = DISPLAY_INLINE;
}
}
diff --git a/gtkhtml/htmlcluev.h b/gtkhtml/htmlcluev.h
index 58e7f7c..81a35d2 100644
--- a/gtkhtml/htmlcluev.h
+++ b/gtkhtml/htmlcluev.h
@@ -44,6 +44,7 @@ struct _HTMLClueV {
HTMLColor *background_color;
HTMLDirection dir;
+ HTMLDisplayType display;
};
struct _HTMLClueVClass {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]