[gnumeric] Fixed multi-line item edit selection. [#621235]



commit 1d7e0826ac7a3fd1b48a2aebb9820636c792bc54
Author: Jean Brefort <jean brefort normalesup org>
Date:   Fri Jun 11 16:29:10 2010 +0200

    Fixed multi-line item edit selection. [#621235]

 ChangeLog       |    5 +++++
 NEWS            |    1 +
 src/item-edit.c |   19 +++++++++++++++++++
 3 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index accf3be..eee5858 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-11  Jean Brefort  <jean brefort normalesup org>
+
+	* src/item-edit.c (item_edit_draw):	Fixed multi-line item edit
+	selection. [#621235]
+
 2010-06-10 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/func-builtin.c (help_if): remove inconsistent period
diff --git a/NEWS b/NEWS
index 3f45118..e296b6d 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ Andreas:
 Jean:
 	* Do not ungrab a not grabbed item. [#620369]
 	* Always update the right series entry. [#620719]
+	* Fixed multi-line item edit selection. [#621235]
 
 Morten:
 	* Make sure windows for help commands show up on right screen.
diff --git a/src/item-edit.c b/src/item-edit.c
index 58fd502..612fc7d 100644
--- a/src/item-edit.c
+++ b/src/item-edit.c
@@ -145,6 +145,25 @@ item_edit_draw (GocItem const *item, cairo_t *cr)
 		y = PANGO_PIXELS (pos.y);
 		h = PANGO_PIXELS (pos.height);
 		pango_layout_index_to_pos (ie->layout, end, &pos);
+		if (PANGO_PIXELS (pos.y) != y) {
+			PangoLayoutLine *line;
+			int x_pos, line_no;
+			PangoRectangle rect;
+			pango_layout_index_to_line_x (ie->layout, start, 0, &line_no, &x_pos);
+			line = pango_layout_get_line (ie->layout, line_no);
+			pango_layout_line_get_extents (line, NULL, &rect);
+			while (PANGO_PIXELS (pos.y) > y) {
+				w = PANGO_PIXELS (rect.x + rect.width) - x;
+				gdk_draw_rectangle (drawable, ie->gc, TRUE, left + x, top + y, w, h);
+				line = pango_layout_get_line (ie->layout, line_no);
+				if (!line)
+					break; /* this should not happen */
+				pango_layout_line_get_extents (line, NULL, &rect);
+				x = PANGO_PIXELS (rect.x);
+				h = PANGO_PIXELS (rect.height);
+				y += h; /* seems that PANGO_PIXELS (rect.y) gives some negative insanity */
+			}
+		}
 		w = PANGO_PIXELS (pos.x) - x;
 		if (w < 0) {
 			x += w;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]