Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Close code completion on "space"?
MortenMacFly:
Dear all,
I know code completion is WIP, but a very minor change could improve the current functionality a lot - so I ask for it hereby:
Wouldn't it make sense to close the code completion window if the user presses "space"? That's actually the major issue (for me!) the window does not close if I continue typing and it is already empty and/or I press "space". Correct me if I'm wrong, but if I type "space" than this really cannot make sense in code completion because a variable/method/whatever cannot contain a space, right? So it would make sense to close the code completion window in that situation.
I tried to implement it myself so I've looked through the code to find how the CTRL+SPACE is handled but no success. Could someone of the devs give me a hint? At least the file I should look into? Hopefully I can provide a patch then...
Any help is appreciated. With regards, Morten.
mandrav:
If you 're not using the custom code-completion control (Settings->Editor->Code completion->Use custom control), in codecompletion.cpp line 395, add a space in the fill-up chars (in bold):
ed->GetControl()->AutoCompSetFillUps(m_IsAutoPopup ? _T("") : _T(">.;([="));
Else, for the custom control, in cclist.cpp line 267 insert:
case WXK_SPACE:
Of course you can do both of the above :)
MortenMacFly:
Thanks for the answer!
--- Quote from: mandrav on March 15, 2006, 11:16:16 pm ---If you 're not using the custom code-completion control
--- End quote ---
Well, I do! But here it comes: I changed to the "default" control (removing the check in the checkbox, right?) and it works! This helps (for the first step).
--- Quote from: mandrav on March 15, 2006, 11:16:16 pm ---ed->GetControl()->AutoCompSetFillUps(m_IsAutoPopup ? _T("") : _T(">.;([="));
--- End quote ---
Isn't this the place where I change when the code completion pops up? I want to change when it closes automatically, so it's the opposite... or am I missing something here?!
--- Quote from: mandrav on March 15, 2006, 11:16:16 pm ---Else, for the custom control, in cclist.cpp line 267 insert:
case WXK_SPACE:
--- End quote ---
Aaaah! I guess that's what I was looking for. It seems I only need to add:
--- Code: --- case WXK_SPACE:
{
Destroy();
break;
}
--- End code ---
here. But I'm looking into this tomorrow, I'm far too tired for now to run a C::B build. Anyway, posting this here makes sure I've got that information tomorrow morning at work. Sorry for misusing the board as a scratchpad... ;-)
Thanks again, I'll report back...
With regards, Morten.
mandrav:
--- Quote ---Isn't this the place where I change when the code completion pops up? I want to change when it closes automatically, so it's the opposite... or am I missing something here?!
--- End quote ---
The fill-ups are the characters that when pressed will select the highlighted item and dismiss the code-completion window.
If you don't want to select the item using space, then the default behaviour is fine.
MortenMacFly:
--- Quote from: mandrav on March 15, 2006, 11:16:16 pm ---Else, for the custom control, in cclist.cpp line 267 insert:
case WXK_SPACE:
--- End quote ---
Alright, that's exactly what was to do. So now the custom control closes on space. But: In addition I would like to have the space also typed in the editor - this does not happen unfortunately. I thought using the event.Skip() would provide the "space" key to the editor but it seems the "space" ist lost... somewhere. But where?
I'm not sure how to better explain, so maybe here is an example: If I type "std::cout" then the code completion window is still open but empty. The next character shall be a space so if I just continue typing the "space" I would like to have the code completion window closed and in the editor is now "std::cout{space}". It works like that if I'm not using the custom control, but I would like to have this behaviour for the custom control, too.
With regards, Morten.
Navigation
[0] Message Index
[#] Next page
Go to full version