[f-spot: 5/6] Make , work even with a zero-sized completion.



commit 95f7299f3cc643b2eb5c8d3c904b6ce115133353
Author: Joachim Breitner <mail joachim-breitner de>
Date:   Thu Jun 11 22:37:36 2009 +0200

    Make , work even with a zero-sized completion.
    
    When you press Tab at the end of an already complete tag, the selection
    is empty, but tag_completion_index is not -1. Therefore,
    FinishTagCompletion needs to add a comma independently of the state of
    the selection.

 src/Widgets/TagEntry.cs |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/Widgets/TagEntry.cs b/src/Widgets/TagEntry.cs
index 5bc74d9..8b4c9d0 100644
--- a/src/Widgets/TagEntry.cs
+++ b/src/Widgets/TagEntry.cs
@@ -215,13 +215,19 @@ namespace FSpot.Widgets {
 
 		void FinishTagCompletion ()
 		{
-			int sel_start, sel_end;
-			if (GetSelectionBounds (out sel_start, out sel_end) && tag_completion_index != -1) {
-				InsertText (", ", ref sel_end);
+			if (tag_completion_index == -1)
+				return;
+
+			int sel_start, sel_end, pos;
+			pos = Position;
+			if (GetSelectionBounds (out sel_start, out sel_end)) {
+				pos = sel_end;
 				SelectRegion (-1, -1);
-				Position = sel_end + 2;
-				ClearTagCompletions ();
 			}
+
+			InsertText (", ", ref pos);
+			Position = pos + 2;
+			ClearTagCompletions ();
 			
 		}
 



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