Posted 15 years ago
by Daniel Navarro
Version: 9.2.0511
Platform: .NET 3.5
Environment: Windows Vista (32-bit)

Sometimes the completion list window will be wrongly sized.
You can see this problem by making a small modification to your "Sample Browser - Simple Language 5: Completion Provider" sample.
On SimpleCompletionProvider.cs add the following lines to function public override bool RequestSession(IEditorView view, bool canCommitWithoutPopup) ...
// After: CompletionSession sesion = new CompletionSession();
session.CanFilterUnmatchedItems = true; // Filter unmatching items
for (char c = 'A'; c <= 'Z'; c++) // And add a few filler words
{
session.Items.Add(new CompletionItem(c.ToString()+"1", new CommonImageSourceProvider(CommonImage.Keyword)));
session.Items.Add(new CompletionItem(c.ToString()+"2", new CommonImageSourceProvider(CommonImage.Keyword)));
}
Now, run the sample and try the following:
- Go to a new line and type "Z"
> A completion list will show with just "Z1" and "Z2" (all good for now)
- Press backspace (to delete "Z")
> Completion list will show with "U2", "V1", "V2", ... "Z1" (still good)
- Now press "Z" again
> A completion list will show again with "Z1" and "Z2", but this time the window will be wrongly sized
This doesn't happen if you type one of the first letters ("A" to "E"), or if there's just one word on the list starting with the letter you type.
---
PS. I have a related question. If you activate completion provider on new word, and set CanFilterUnmatchedItems = true, then type a non-matching letter (not matching any of the words on the list), you´ll see a "(no items)" window. How could I cancel the CompletionSession when that happens?
Thank you.
You can see this problem by making a small modification to your "Sample Browser - Simple Language 5: Completion Provider" sample.
On SimpleCompletionProvider.cs add the following lines to function public override bool RequestSession(IEditorView view, bool canCommitWithoutPopup) ...
// After: CompletionSession sesion = new CompletionSession();
session.CanFilterUnmatchedItems = true; // Filter unmatching items
for (char c = 'A'; c <= 'Z'; c++) // And add a few filler words
{
session.Items.Add(new CompletionItem(c.ToString()+"1", new CommonImageSourceProvider(CommonImage.Keyword)));
session.Items.Add(new CompletionItem(c.ToString()+"2", new CommonImageSourceProvider(CommonImage.Keyword)));
}
Now, run the sample and try the following:
- Go to a new line and type "Z"
> A completion list will show with just "Z1" and "Z2" (all good for now)
- Press backspace (to delete "Z")
> Completion list will show with "U2", "V1", "V2", ... "Z1" (still good)
- Now press "Z" again
> A completion list will show again with "Z1" and "Z2", but this time the window will be wrongly sized
This doesn't happen if you type one of the first letters ("A" to "E"), or if there's just one word on the list starting with the letter you type.
---
PS. I have a related question. If you activate completion provider on new word, and set CanFilterUnmatchedItems = true, then type a non-matching letter (not matching any of the words on the list), you´ll see a "(no items)" window. How could I cancel the CompletionSession when that happens?
Thank you.