[Monodevelop-patches-list] r2192 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . Gui

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Jan 30 16:04:12 EST 2005


Author: jluke
Date: 2005-01-30 16:04:11 -0500 (Sun, 30 Jan 2005)
New Revision: 2192

Modified:
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
   trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
Log:
improve completion trigger


Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2005-01-30 19:55:22 UTC (rev 2191)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog	2005-01-30 21:04:11 UTC (rev 2192)
@@ -1,3 +1,9 @@
+2005-01-30  John Luke <john.luke at gmail.com>
+
+	* Gui/SourceEditorView.cs: only show completion if the
+	next char is not whitespace, ctl+space will override this
+	fixes bug# 60113
+
 2005-01-30  Todd Berman  <tberman at off.net>
 
 	* CodeCompletion/CompletionListWindow.cs: Small changes, make sure the

Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs	2005-01-30 19:55:22 UTC (rev 2191)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs	2005-01-30 21:04:11 UTC (rev 2192)
@@ -182,7 +182,8 @@
 				iter.BackwardChar ();
 			} while (iter.LineOffset != 0);
 
-			if (triggerIter.Equals (TextIter.Zero)) return;
+			if (triggerIter.Equals (TextIter.Zero))
+				return;
 			triggerIter.ForwardChar ();
 			
 //			CompletionWindow.ShowWindow (triggerChar, triggerIter, true, new CodeCompletionDataProvider (true), this);
@@ -325,7 +326,7 @@
 				
 			case '.':
 				bool retval = base.OnKeyPressEvent (evnt);
-				if (EnableCodeCompletion) {
+				if (EnableCodeCompletion && PeekCharIsWhitespace ()) {
 //					CompletionWindow.ShowWindow ((char)key, buf.GetIterAtMark (buf.InsertMark), false, new CodeCompletionDataProvider (), this);
 					CompletionListWindow.ShowWindow ((char)key, buf.GetIterAtMark (buf.InsertMark), new CodeCompletionDataProvider (), this);
 				}
@@ -612,6 +613,17 @@
 			offset = begin.Offset;
 			len = begin.CharsInLine;
 		}
+
+		bool PeekCharIsWhitespace ()
+		{
+			TextIter start = buf.GetIterAtMark (buf.InsertMark);
+			TextIter end = buf.GetIterAtLine (start.Line);
+			end.LineOffset = start.LineOffset + 1;
+			string text = buf.GetText (start, end, true);
+			if (text.Length == 1)
+				return System.Char.IsWhiteSpace (text[0]);
+			return true;
+		}
 #endregion
 	}
 }




More information about the Monodevelop-patches-list mailing list