User forums > Help
Auto-completion issue
MortenMacFly:
--- Quote from: MortenMacFly on February 26, 2016, 07:20:12 am ---Reverted for the moment... I'll need to further investigate.
--- End quote ---
Well that is really weird. I was testing this patch and it was working the time back. Now I can't make it work again. The only thing I can imagine is that I was working either on the wrong copy of C::B or the test case was too simple or "special".
Commaster:
I thought I could jump in on this and investigate a bit.
So I put this snippet in the abbreviations.cpp...
--- Code: ---wxString foo;
foo << control->WordStartPosition(curPos, true);
foo << _T(" vs. ");
foo << control->WordStartPosition(curPos, false);
foo << _T(" and ");
foo << control->WordEndPosition(curPos, true);
foo << _T(" vs. ");
foo << control->WordEndPosition(curPos, false);
logMan->DebugLog(_T("Data on positions: ") + foo);
--- End code ---
And the result is as follows...
--- Code: ---Data on positions: 7054 vs. 7054 and 7058 vs. 7060
Auto-complete keyword: forb
Auto-complete match for keyword found.
--- End code ---
My suspicion would be that the "false" case eats up the EOL (most likely \r\n) and thus fails to find a match. (note that the word start position doesn't change ... in this case)
But I'm sure you already know this.
Update:
Confirmed that "false" eats up all EOLs (source had 2 EOLs following the input line):
--- Code: ---Data on positions: 5095 vs. 5095 and 5099 vs. 5103
false: forb
true: forb
Auto-complete keyword: forb
Auto-complete match for keyword found.
--- End code ---
Maybe we can just trim EOLs and it "should" work?
BlueHazzard:
--- Quote from: MortenMacFly on February 26, 2016, 11:16:40 am ---
--- Quote from: MortenMacFly on February 26, 2016, 07:20:12 am ---Reverted for the moment... I'll need to further investigate.
--- End quote ---
Well that is really weird. I was testing this patch and it was working the time back. Now I can't make it work again. The only thing I can imagine is that I was working either on the wrong copy of C::B or the test case was too simple or "special".
--- End quote ---
It works if there is no trailing whitespace or newline. I didn't tested this neither...
--- Quote from: Commaster on February 29, 2016, 09:05:32 pm ---Update:
Confirmed that "false" eats up all EOLs (source had 2 EOLs following the input line):
--- Code: ---Data on positions: 5095 vs. 5095 and 5099 vs. 5103
false: forb
true: forb
Auto-complete keyword: forb
Auto-complete match for keyword found.
--- End code ---
Maybe we can just trim EOLs and it "should" work?
--- End quote ---
Can confirm this. the problem with trim is, that it deletes also all newlines that are between the completion word and the next word, so if you have something like this
--- Code: ---forb
test
--- End code ---
you end with this:
--- Code: ---for (; ; )
{
}test
--- End code ---
clearly not what you want, so more logic is needed
greetings
BlueHazzard:
Does someone know what the original issue was? I can't find anything on sf tickets or here in the forum...
blooden:
Hello,
My autocomplete is not working. It complates char,switch or variable names, but it is not complate functions like scanf printf. What is the problem. I checked my editor setting to activate code completion but it is active. What can i do? Thanks.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version