diff options
author | Mike Krüger <mkrueger@novell.com> | 2010-04-16 16:10:11 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@novell.com> | 2010-04-16 16:10:11 +0400 |
commit | 0f5305e7543a1f460464df6359b53bb9bd2a6485 (patch) | |
tree | ef792d18640139fdb120c419087365ef82499842 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion | |
parent | 1289f936a2bcab2c1c14ba9a79d274ab069c1718 (diff) |
* MonoDevelop.Ide.CodeCompletion/ListWindow.cs: Give priority to
items that have the match closer to the beginning of the string (see
Bug 595240 - Completion list filtering should match on words not
just at start).
* MonoDevelop.Ide.CodeCompletion/DeclarationViewWindow.cs: Added
bounds check.
svn path=/trunk/monodevelop/; revision=155625
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/DeclarationViewWindow.cs | 22 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs | 5 |
2 files changed, 19 insertions, 8 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/DeclarationViewWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/DeclarationViewWindow.cs index c5994a0dc0..559f41ac1d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/DeclarationViewWindow.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/DeclarationViewWindow.cs @@ -86,25 +86,31 @@ namespace MonoDevelop.Ide.CodeCompletion void ShowOverload () { - DescriptionMarkup = overloads[current_overload]; - helplabel.Markup = string.Format ("<small>" + GettextCatalog.GetString ("{0} of {1} overloads") + "</small>", current_overload + 1, overloads.Count); + if (current_overload >= 0 && current_overload < overloads.Count) { + DescriptionMarkup = overloads[current_overload]; + helplabel.Markup = string.Format ("<small>" + GettextCatalog.GetString ("{0} of {1} overloads") + "</small>", current_overload + 1, overloads.Count); + } } public void OverloadLeft () { - if (current_overload == 0) - current_overload = overloads.Count - 1; - else + if (current_overload == 0) { + if (overloads.Count > 0) + current_overload = overloads.Count - 1; + } else { current_overload--; + } ShowOverload (); } public void OverloadRight () { - if (current_overload == overloads.Count - 1) + if (current_overload == overloads.Count - 1) { current_overload = 0; - else - current_overload++; + } else { + if (overloads.Count > 0) + current_overload++; + } ShowOverload (); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs index ac2877d2dc..8758248cdc 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs @@ -429,6 +429,11 @@ namespace MonoDevelop.Ide.CodeCompletion return 1; if (xExact > yExact) return -1; + + // favor words where the match starts sooner + if (xMatches.Length > 0 && yMatches.Length > 0 && xMatches[0] != yMatches[0]) + return xMatches[0].CompareTo (yMatches[0]); + int xIndex = xpair.Key; int yIndex = ypair.Key; |