GNOME #576156 -- Extended grapheme clusters should not apply to cursor movement

Index: pango1.0-1.24.2/pango/break.c
===================================================================
--- pango1.0-1.24.2.orig/pango/break.c	(revision 2830)
+++ pango1.0-1.24.2/pango/break.c	(working copy)
@@ -669,15 +669,6 @@
 	  case G_UNICODE_OTHER_LETTER:
 	    if (makes_hangul_syllable)
 	      GB_type = GB_InHangulSyllable;
-	    else if ((wc & 0x0E00) == 0x0E00)
-	      {
-	        /* Thai and Lao stuff hardcoded in UAX#29 */
-		if ((wc >= 0x0E40 && wc <= 0x0E44) || (wc >= 0x0EC0 && wc <= 0x0EC4))
-		  GB_type = GB_Prepend; /* Prepend */
-		else if (wc == 0x0E30 || wc == 0x0E32 || wc == 0x0E33 || wc == 0x0E45 ||
-			 wc == 0x0EB0 || wc == 0x0EB2 || wc == 0x0EB3)
-		  GB_type = GB_Extend; /* Exceptions in the Extend definition */
-	      }
 	    break;
 
 	  case G_UNICODE_MODIFIER_LETTER:
@@ -716,14 +707,29 @@
 	  is_grapheme_boundary = FALSE; /* Rule GB9 */
 	else if (GB_type == GB_SpacingMark)
 	  is_grapheme_boundary = FALSE; /* Rule GB9a */
-	else if (prev_GB_type == GB_Prepend)
-	  is_grapheme_boundary = FALSE; /* Rule GB9b */
 	else
 	  is_grapheme_boundary = TRUE;  /* Rule GB10 */
 
+	attrs[i].is_cursor_position = is_grapheme_boundary;
+
+	/* For Thai and Lao, Rules GB9 and GB9b do not apply to cursor
+	 * positioning, but to word boundary */
+	if ((wc & 0x0E00) == 0x0E00)
+	  {
+	    /* Thai and Lao stuff hardcoded in UAX#29 */
+	    if ((wc >= 0x0E40 && wc <= 0x0E44) || (wc >= 0x0EC0 && wc <= 0x0EC4))
+	      GB_type = GB_Prepend; /* Prepend */
+	    else if (wc == 0x0E30 || wc == 0x0E32 || wc == 0x0E33 || wc == 0x0E45 ||
+	             wc == 0x0EB0 || wc == 0x0EB2 || wc == 0x0EB3)
+	      GB_type = GB_Extend; /* Exceptions in the Extend definition */
+	  }
+	if (prev_GB_type == GB_Prepend)
+	  is_grapheme_boundary = FALSE; /* Rule GB9 */
+	else if (GB_type == GB_Extend)
+	  is_grapheme_boundary = FALSE; /* Rule GB9b */
+
 	prev_GB_type = GB_type;
 
-	attrs[i].is_cursor_position = is_grapheme_boundary;
 	/* If this is a grapheme boundary, we have to decide if backspace
 	 * deletes a character or the whole grapheme cluster */
 	if (is_grapheme_boundary)
@@ -917,9 +923,9 @@
       attrs[i].is_line_break = FALSE;
       attrs[i].is_mandatory_break = FALSE;
 
-      if (attrs[i].is_cursor_position) /* If it's not a grapheme boundary,
-					* it's not a line break either
-					*/
+      if (is_grapheme_boundary) /* If it's not a grapheme boundary,
+				 * it's not a line break either
+				 */
 	{
 	  /* space followed by a combining mark is handled
 	   * specially; (rule 7a from TR 14)
