[Monodevelop-patches-list] r2165 - in trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor: . CodeCompletion
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Wed Jan 26 11:05:18 EST 2005
Author: alexmipe
Date: 2005-01-26 11:05:18 -0500 (Wed, 26 Jan 2005)
New Revision: 2165
Modified:
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs
trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ListWindow.cs
Log:
Closes bug #71686. Check bug page for other improvements.
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-01-26 02:08:22 UTC (rev 2164)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2005-01-26 16:05:18 UTC (rev 2165)
@@ -1,3 +1,9 @@
+2005-01-26 Alexandre Gomes <alexmipego at gmail.com>
+
+ * CodeCompletion/CompletationListWindow.cs:
+ * CodeCompletion/ListWindow.cs: Closes bug #71686. Also makes
+ list sorted case-isensitive.
+
2005-01-25 Todd Berman <tberman at off.net>
* Gui/SourceEditorDisplayBinding.cs: Use new
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs 2005-01-26 02:08:22 UTC (rev 2164)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionListWindow.cs 2005-01-26 16:05:18 UTC (rev 2165)
@@ -1,4 +1,3 @@
-
using System;
using System.Collections;
@@ -25,7 +24,7 @@
{
ICompletionData d1 = x as ICompletionData;
ICompletionData d2 = y as ICompletionData;
- return String.Compare (d1.Text[0], d2.Text[0]);
+ return String.Compare (d1.Text[0], d2.Text[0], true);
}
}
@@ -44,6 +43,23 @@
public static void ShowWindow (char firstChar, TextIter trigIter, ICompletionDataProvider provider, SourceEditorView ctrl)
{
wnd.ShowListWindow (firstChar, trigIter, provider, ctrl);
+
+ // makes control-space in midle of words to work
+ TextBuffer buf = wnd.control.Buffer;
+ string text = buf.GetText (trigIter, buf.GetIterAtMark (buf.InsertMark), false);
+ if (text.Length == 0)
+ return;
+
+ wnd.PartialWord = text;
+ //if there is only one matching result we take it by default
+ if (wnd.IsUniqueMatch)
+ {
+ wnd.Hide ();
+ }
+
+ wnd.updateWord ();
+
+ wnd.PartialWord = wnd.CompleteWord;
}
void ShowListWindow (char firstChar, TextIter trigIter, ICompletionDataProvider provider, SourceEditorView ctrl)
@@ -88,11 +104,7 @@
wnd.Hide ();
if ((ka & ListWindow.KeyAction.Complete) != 0) {
- TextIter offsetIter = wnd.control.Buffer.GetIterAtMark (wnd.triggeringMark);
- TextIter endIter = wnd.control.Buffer.GetIterAtOffset (offsetIter.Offset + wnd.PartialWord.Length);
- wnd.control.Buffer.MoveMark (wnd.control.Buffer.InsertMark, offsetIter);
- wnd.control.Buffer.Delete (ref offsetIter, ref endIter);
- wnd.control.Buffer.InsertAtCursor (wnd.CompleteWord);
+ wnd.updateWord ();
}
if ((ka & ListWindow.KeyAction.Ignore) != 0)
@@ -101,6 +113,15 @@
return false;
}
+ void updateWord ()
+ {
+ TextIter offsetIter = wnd.control.Buffer.GetIterAtMark (wnd.triggeringMark);
+ TextIter endIter = wnd.control.Buffer.GetIterAtOffset (offsetIter.Offset + wnd.PartialWord.Length);
+ wnd.control.Buffer.MoveMark (wnd.control.Buffer.InsertMark, offsetIter);
+ wnd.control.Buffer.Delete (ref offsetIter, ref endIter);
+ wnd.control.Buffer.InsertAtCursor (wnd.CompleteWord);
+ }
+
public new void Hide ()
{
base.Hide ();
Modified: trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ListWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ListWindow.cs 2005-01-26 02:08:22 UTC (rev 2164)
+++ trunk/MonoDevelop/Core/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/ListWindow.cs 2005-01-26 16:05:18 UTC (rev 2165)
@@ -66,8 +66,31 @@
public string PartialWord
{
get { return word.ToString (); }
+ set
+ {
+ string newword = value;
+ if (newword.Trim ().Length == 0)
+ return;
+
+ word = new StringBuilder (newword);
+ curPos = newword.Length;
+ UpdateWordSelection ();
+ }
}
+ public bool IsUniqueMatch
+ {
+ get
+ {
+ int pos = list.Selection;
+ pos ++;
+ if (provider.ItemCount > pos && provider.GetText (pos).ToLower ().StartsWith (PartialWord.ToLower ()) || !(provider.GetText (list.Selection).ToLower ().StartsWith (PartialWord.ToLower ())))
+ return false;
+
+ return true;
+ }
+ }
+
protected ListWidget List
{
get { return list; }
More information about the Monodevelop-patches-list
mailing list