[Monodevelop-patches-list] r1255 - in trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor: . CodeCompletion Gui
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Fri Mar 26 01:57:01 EST 2004
Author: tberman
Date: 2004-03-26 01:57:00 -0500 (Fri, 26 Mar 2004)
New Revision: 1255
Modified:
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs
trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
Log:
ctrl+space automagic completion stuff..
we are finally getting usable with code completion.. thank god.
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2004-03-26 04:54:18 UTC (rev 1254)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/ChangeLog 2004-03-26 06:57:00 UTC (rev 1255)
@@ -1,3 +1,9 @@
+2004-03-26 Todd Berman <tberman at sevenl.net>
+
+ * Gui/SourceEditorView.cs:
+ * CodeCompletion/CompletionWindow.cs: now, ctrl+space will autocomplete
+ the entire thing if there is only one match.
+
2004-03-25 Todd Berman <tberman at sevenl.net>
* Gui/SourceEditorView.cs: setup completionWindow to be reused properly
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs 2004-03-26 04:54:18 UTC (rev 1254)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/CodeCompletion/CompletionWindow.cs 2004-03-26 06:57:00 UTC (rev 1255)
@@ -126,16 +126,17 @@
break;
}
- ShuffleSelection ();
+ ShuffleSelection (false);
ex.RetVal = true;
}
- public void ShuffleSelection ()
+ public bool ShuffleSelection (bool magic)
{
// select the current typed word
int lastSelected = -1;
int capitalizationIndex = -1;
+ int numOfHits = 0;
string typedString = GetTypedString ();
TreeIter iter;
@@ -151,6 +152,9 @@
++currentCapitalizationIndex;
}
}
+ if (currentCapitalizationIndex >= capitalizationIndex) {
+ numOfHits++;
+ }
if (currentCapitalizationIndex > capitalizationIndex) {
lastSelected = i;
@@ -166,8 +170,13 @@
listView.Selection.SelectPath (path);
listView.SetCursor (path, complete_column, false);
listView.ScrollToCell (path, null, false, 0, 0);
+ if (magic && numOfHits == 1) {
+ ActivateItem (null, null);
+ Destroy ();
+ return true;
+ }
}
-
+ return false;
}
void InitializeControls ()
@@ -213,7 +222,7 @@
/// <remarks>
/// Shows the filled completion window, if it has no items it isn't shown.
/// </remarks>
- public void ShowCompletionWindow (char firstChar, TextIter trigIter)
+ public void ShowCompletionWindow (char firstChar, TextIter trigIter, bool magic)
{
triggeringMark = control.Buffer.CreateMark (null, trigIter, true);
origOffset = trigIter.Offset;
@@ -225,9 +234,10 @@
return;
}
- //Point caretPos = control.ActiveTextAreaControl.Caret.Position;
- //Point visualPos = new Point(control.ActiveTextAreaControl.TextArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X) + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.X,
- // (int)((1 + caretPos.Y) * control.ActiveTextAreaControl.TextArea.TextView.FontHeight) - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y);
+ if (magic) {
+ if (ShuffleSelection (true))
+ return;
+ }
Gdk.Rectangle rect = control.GetIterLocation (control.Buffer.GetIterAtMark (triggeringMark));
@@ -241,6 +251,7 @@
Move (tx + wx, ty + wy);
listView.Selection.Changed += new EventHandler (RowActivated);
ShowAll ();
+ RowActivated (null, null);
//GdkWindow.Move (tx + wx, ty + wy);
}
@@ -325,14 +336,13 @@
// This code is for sizing the treeview properly.
Gtk.TreePath path = store.GetPath (iter);
Gdk.Rectangle backRect = listView.GetBackgroundArea (path, (Gtk.TreeViewColumn)listView.Columns[0]);
+
+ listView.HeightRequest = (backRect.Height * 5) + 2;
- listView.HeightRequest = (backRect.Height * 5) + 2;
-
// FIXME: This code is buggy, and generates a bad placement sometimes when you jump a lot.
// but it is better than 0,0
-
+ // This code is for sizing the treeview properly.
Gdk.Rectangle rect = listView.GetCellArea (path, (Gtk.TreeViewColumn)listView.Columns[0]);
-
int listpos_x, listpos_y;
GetPosition (out listpos_x, out listpos_y);
int vert = listpos_y + rect.Y;
@@ -344,7 +354,6 @@
} else if (vert < listpos_y) {
vert = listpos_y;
}
-
// FIXME: This is a bad calc, its always on the right,
// it needs to test if thats too big, and if so, place on the left;
int horiz = listpos_x + lvWidth + 30;
@@ -361,17 +370,16 @@
if (declarationviewwindow.DescriptionMarkup.Length == 0)
return;
-
+
declarationviewwindow.ShowAll ();
int dvwWidth, dvwHeight;
declarationviewwindow.GdkWindow.GetSize (out dvwWidth, out dvwHeight);
-
if (listView.Screen.Width <= horiz + dvwWidth) {
horiz = listpos_x - dvwWidth - 10;
}
-
+
declarationviewwindow.Move (horiz, vert);
}
}
Modified: trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-03-26 04:54:18 UTC (rev 1254)
+++ trunk/MonoDevelop/src/AddIns/DisplayBindings/SourceEditor/Gui/SourceEditorView.cs 2004-03-26 06:57:00 UTC (rev 1255)
@@ -166,8 +166,7 @@
triggerIter.ForwardChar ();
completionWindow = new CompletionWindow (this, ParentEditor.DisplayBinding.ContentName, new CodeCompletionDataProvider ());
- completionWindow.ShowCompletionWindow (triggerChar, triggerIter);
- completionWindow.ShuffleSelection ();
+ completionWindow.ShowCompletionWindow (triggerChar, triggerIter, true);
}
protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
@@ -226,7 +225,7 @@
bool retval = base.OnKeyPressEvent (evnt);
if (EnableCodeCompletion) {
completionWindow = new CompletionWindow (this, ParentEditor.DisplayBinding.ContentName, new CodeCompletionDataProvider ());
- completionWindow.ShowCompletionWindow ((char)key, buf.GetIterAtMark (buf.InsertMark));
+ completionWindow.ShowCompletionWindow ((char)key, buf.GetIterAtMark (buf.InsertMark), false);
}
return retval;
/*case '(':
More information about the Monodevelop-patches-list
mailing list