[gtksourceview/gtksourcecompletion] Fixed removing of scan regions



commit d1c4dc299bb590c14879c313a92116e079d0832e
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Wed Sep 23 00:21:18 2009 +0200

    Fixed removing of scan regions

 .../words/gtksourcecompletionwordsbuffer.c         |   38 ++++++++++---------
 1 files changed, 20 insertions(+), 18 deletions(-)
---
diff --git a/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c b/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
index 26c5f3d..56c5dcf 100644
--- a/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
+++ b/gtksourceview/completion-providers/words/gtksourcecompletionwordsbuffer.c
@@ -370,32 +370,34 @@ remove_scan_regions (GtkSourceCompletionWordsBuffer *buffer,
 	{
 		ScanRegion *region = REGION_FROM_LIST (item);
 		
-		if (region->start >= start && region->end <= end)
+		if (region->start >= start)
 		{
-			GList *remove = item;
-			scan_region_free (region);
+			if (region->end <= end)
+			{
+				/* Region fully within removed region */
+				GList *remove = item;
+				scan_region_free (region);
 
-			item = g_list_previous (item);
+				item = g_list_previous (item);
 			
-			/* Remove whole thing */
-			buffer->priv->scan_regions = 
-				g_list_delete_link (buffer->priv->scan_regions,
-				                    remove);
+				/* Remove whole thing */
+				buffer->priv->scan_regions = 
+					g_list_delete_link (buffer->priv->scan_regions,
+						            remove);
+			}
+			else if (region->start <= end)
+			{
+				/* Top part of region in removed region */
+				region->start = end;
+			}
 		}
-		else if (region->start >= start)
+		else if (region->end <= end && region->end > start)
 		{
-			/* Start in region */
+			/* Bottom part of region in removed region */
 			region->end = start;
 		}
-		else if (region->end <= end)
-		{
-			/* End in region */
-			region->start = start;
-			region->end -= span;
-		}
-		else if (region->start > start)
+		else if (region->end >= end)
 		{
-			region->start -= span;
 			region->end -= span;
 		}
 	}



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