Bug Fixed Autocomplete ignore case#2382
Bug Fixed Autocomplete ignore case#2382anil-shrestha wants to merge 1 commit intonotepad-plus-plus:masterfrom
Conversation
|
I have build with vs2015 |
MAPJe71
left a comment
There was a problem hiding this comment.
Please read and apply Guidelines for pull requests.
anil-shrestha
left a comment
There was a problem hiding this comment.
code indentation and formatting changed
| { | ||
| const size_t bufSize = 256; | ||
|
|
||
| if (isAllDigits(beginChars)) |
There was a problem hiding this comment.
Forcing this upon a user isn't a good idea. They may well want numbers to be autocompleted. I have PR #2378 that does this exact same thing but allows the user to enable it or not.
|
|
||
| if (_ignoreCase) | ||
| { | ||
| std::sort(_keyWordArray.begin(), _keyWordArray.end(), [](const auto& lhs, const auto& rhs){ |
There was a problem hiding this comment.
This is an exact copy of the std::sort() call on line 120 and 376. You can probably put this into a separate function and would make the code a bit more readable, e.g. having a call to sortCaseInsensitive(...) or whatever.
|
|
||
| //if (_keyWordArray[i].compare(0, len, beginChars) == 0) | ||
| //if (keytemp.compare(0, len, beginchartmp) == 0) | ||
| if (((keytemp.compare(0, len, beginchartmp) == 0) && _ignoreCase) || (_keyWordArray[i].compare(0, len, beginChars) == 0)) |
There was a problem hiding this comment.
This is inefficient because it always transforms the two strings even if _ignoreCase is false.
| void AutoCompletion::sortKeyWords() | ||
| { | ||
| if (_ignoreCase) { | ||
| std::sort(_keyWordArray.begin(), _keyWordArray.end(), [](const auto& lhs, const auto& rhs) { |
There was a problem hiding this comment.
This does not work with VS 2013 (the official build system).
There was a problem hiding this comment.
So ... that's probably why the AppVeyor build fails (hint for OP).
There was a problem hiding this comment.
I don't have VS 2013. Please help.
(May be its time to upgrade the official build system, if not remove the VS 2015 proj file from source)
There was a problem hiding this comment.
FYI:
- it's possible to create code with VS2015 that also compiles with VS2013.
- there's a free edition of VS2013.
| } | ||
| else if (canStop) | ||
| { | ||
| else if (canStop) { |
There was a problem hiding this comment.
This change reverses code that complies to the Style Guide.
|
|
||
| if (_ignoreCase) | ||
| { | ||
| if(_ignoreCase){ |
There was a problem hiding this comment.
This change reverses code that complies to the Style Guide.
| return result.second != rhs.cend() && (result.first == lhs.cend() || tolower(*result.first) < tolower(*result.second)); | ||
| }); | ||
| } | ||
| else { |
MAPJe71
left a comment
There was a problem hiding this comment.
Don't change the default build settings of the project!
MAPJe71
left a comment
There was a problem hiding this comment.
Revert changes to AppVeyor.yml and make sure it builds with VS2013!
|
I have made the changes to be build with VS2013. But dont know how to resolve the conflicts. Plz help. |
anil-shrestha
left a comment
There was a problem hiding this comment.
changed to be able to build on VS2013
|
please squash all yours commits. then change "pick" command to "squash" command on each commits Once it's ok, push with force option. It will update the PR.
|
|
Any updates ? |
|
One commit per PR! |
| if (_keyWordArray[i].compare(0, len, beginChars) == 0) | ||
|
|
||
| bool _ignoreCaseMatch = false; | ||
| if (_ignoreCase) |
There was a problem hiding this comment.
This if block creates lots of copies of strings. Is there a better way to compare them? Can you use _tcsicmp()? If so could you also use it in AutoCompletion::sortKeyWords()?
| void callTipClick(int direction); | ||
| void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, bool isHTML); | ||
|
|
||
| void sortKeyWords(); |
There was a problem hiding this comment.
No reason to have this public.
anil-shrestha
left a comment
There was a problem hiding this comment.
squashed all commits to one
|
Any Updates ? |
|
Your release note is wrong. You should remove
|
anil-shrestha
left a comment
There was a problem hiding this comment.
removed unnecessary commit messages
|
Any updates? |
|
any updates? |
|
Please update if anything needs to be done so that you can accept this change. |
|
For me, nothing to update. |
|
@anil-shrestha Please describe the bugs you fixed in detail or refer to an issue (how to reproduce it) . Your description is confused. |
|
I have changed the description. Please advise if it is ok. |
|
I am not able to squash. Please help |
|
Well for me squashing only works with 1 commit only at a time. I had that issue to so that means that any multiple commits from after that would be discarded so back up any of your other changes and then commit them into one locally and then squash that before syncing. (I know its dumb design really) But rebase all your changes from after 4c23de6 like so: Any of your comits from before that from this PR would have to be backed up then deleted on the files that they changed just so you know before squashing as well. |
|
Please send me commands. |
|
@anil-shrestha It seems to be working fine for me now, thanks. |
|
@dail8859 I am not able to squash. Please help |
|
It's a bit complicated since you made commits directly on your master branch, but if you are ok with it I can fix it for you. Keep in mind I'll have to force push it and you will probably have to reset your local master branch. |
|
Please go ahead |
|
Should be fixed now. I rebased the commits and squashed them. I force pushed directly to your master branch in your repository. |
|
Thank you. Can you send me the commands you used. |
|
I did it all with the TortoiseGit GUI, so not 100% sure the exact commands needed. |
|
commands is git rebase -i HEAD~6 ( 6 means the number of commit to rebase) See the helps here : |
|
Any Updates? |
|
I also would like this bug fixed and is it possible to further enhance it to allow:
I trust you can see how this would be useful, but just in case, let's say you are writing C and have a standard of always including braces ( {} pairs ). If I type "do" I want: do { or "if": if( <cursor> ) { Doesn't work quite as well for "for" statements but works well in certain languages for certain expressions. Typing block closing delimiters shouldn't really be necessary given that they must always be present in certain situations. |
|
@simon33-2 That goes a bit more beyond what would be considered "auto-completion". Most editors consider this something like "snippets". There are a couple of Notepad++ plugins that does exactly what you describe (e.g. SnippetsPlus, FingerText, and others). |
|
Any Updates? |
|
@donho Can you please let me know what exactly has happened ? |
|
Anyone please help |
|
Autocompletion feature is a generic function for all surppoted languages, so the modification for adapting only for VB will make autocompletion break for the other languages. vb.xml needs to be modified for removing all the entries contain space, and make all keywords in UPPERCAS or lowercase according the convention. I'll see what can I do for make ignore the case of keyin to trigger auto-completion. |
|
@donho vb.xml was just an example. I have already tested for c.xml and other xmls and my UDL xml as well. And the problem is not only upper or lower case, it is the Keyword containing space character too. Please check in npp++ 5.8.3 which I am currently using which does not have above bugs. Due to these bugs, I am not able to upgrade to latest versions :( Please note that removing keywords containing space from vb.xml is not the solution as there are many other users like me who are using their own UDL and their Keywords contain space character. |
|
@donho are you looking into it? Please consider my previous comment |
|
I was wondering where this left off? I had some issues with auto complete that I believe are related to this fix. I'm using VBScript with IgnoreCase set to Yes and additionalWordChar set to "." Current sort seems to put upper case first. For example if I have a list of keywords containing Janice and JJAbrams when I type J the list will display like: JJAbrams It seems that the first letter is not ignoring case so if I type the lower case "j" I don't get the dialog at all. |
|
I was able to do some testing with this today and it does solve my problem. I was using what @anil-shrestha did without the space character logic. It looks like the issue was closed because of the space logic but would it be possible to submit the change with just the ignore case sorting and comparing? I have an updated version of AutoCompletion.cpp if you need me to do something let me know. |
|
Or, what Notepad++ can do is provide an configuration setting to enable this if they desire. And yes this can bite me as well. I just never ran into it yet (or know if I did) when I would use Notepad++ for my python coding. Although the 1 thing python I would like is the ability to have Notepad++ know if python code breaks PEP8 (As an optional setting) that would also check for new lines at end of file. |
update to Scinitlla Release 5.3.6 (https://www.scintilla.org/scintilla536.zip) Released 26 July 2023. Redraw calltip after showing as didn't update when size of new text exactly same as previous. Feature notepad-plus-plus#1486. On Win32 fix reverse arrow cursor when scaled. Bug notepad-plus-plus#2382. On Win32 hide cursor when typing if that system preference has been chosen. Bug notepad-plus-plus#2333. On Win32 and Qt, stop aligning IME candidate window to target. It is now always aligned to start of composition string. This undoes part of feature notepad-plus-plus#1300. Feature notepad-plus-plus#1488, Bug notepad-plus-plus#2391, Feature notepad-plus-plus#1300. On Qt, for IMEs, update micro focus when selection changes. This may move the location of IME popups to align with the caret. On Qt, implement replacement for IMEs which may help with actions like reconversion. This is similar to delete-surrounding on GTK. and Lexilla Release 5.2.6 (https://www.scintilla.org/lexilla526.zip) Released 26 July 2023. Include empty word list names in value returned by DescribeWordListSets and SCI_DESCRIBEKEYWORDSETS. Issue notepad-plus-plus#175, Pull request notepad-plus-plus#176. Bash: style here-doc end delimiters as SCE_SH_HERE_DELIM instead of SCE_SH_HERE_Q. Issue notepad-plus-plus#177. Bash: allow '$' as last character in string. Issue notepad-plus-plus#180, Pull request notepad-plus-plus#181. Bash: fix state after expansion. Highlight all numeric and file test operators. Don't highlight dash in long option as operator. Issue notepad-plus-plus#182, Pull request notepad-plus-plus#183. Bash: strict checking of special parameters ($*, $@, $$, ...) with property lexer.bash.special.parameter to specify valid parameters. Issue notepad-plus-plus#184, Pull request notepad-plus-plus#186. Bash: recognize keyword before redirection operators (< and >). Issue notepad-plus-plus#188, Pull request notepad-plus-plus#189. Errorlist: recognize Bash diagnostic messages. HTML: allow ASP block to terminate inside line comment. Issue notepad-plus-plus#185. HTML: fix folding with JSP/ASP.NET <%-- comment. Issue notepad-plus-plus#191. HTML: fix incremental styling of multi-line ASP.NET directive. Issue notepad-plus-plus#191. Matlab: improve arguments blocks. Add support for multiple arguments blocks. Prevent "arguments" from being keyword in function declaration line. Fix semicolon handling. Pull request notepad-plus-plus#179. Visual Prolog: add support for embedded syntax with SCE_VISUALPROLOG_EMBEDDED and SCE_VISUALPROLOG_PLACEHOLDER. Styling of string literals changed with no differentiation between literals with quotes and those that are prefixed with "@". Quote characters are in a separate style (SCE_VISUALPROLOG_STRING_QUOTE) to contents (SCE_VISUALPROLOG_STRING). SCE_VISUALPROLOG_CHARACTER, SCE_VISUALPROLOG_CHARACTER_TOO_MANY, SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR, SCE_VISUALPROLOG_STRING_EOL_OPEN, and SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL were removed (replaced with SCE_VISUALPROLOG_UNUSED[1-5]). Pull request notepad-plus-plus#178.
update to Scinitlla Release 5.3.6 (https://www.scintilla.org/scintilla536.zip) Released 26 July 2023. Redraw calltip after showing as didn't update when size of new text exactly same as previous. Feature notepad-plus-plus#1486. On Win32 fix reverse arrow cursor when scaled. Bug notepad-plus-plus#2382. On Win32 hide cursor when typing if that system preference has been chosen. Bug notepad-plus-plus#2333. On Win32 and Qt, stop aligning IME candidate window to target. It is now always aligned to start of composition string. This undoes part of feature notepad-plus-plus#1300. Feature notepad-plus-plus#1488, Bug notepad-plus-plus#2391, Feature notepad-plus-plus#1300. On Qt, for IMEs, update micro focus when selection changes. This may move the location of IME popups to align with the caret. On Qt, implement replacement for IMEs which may help with actions like reconversion. This is similar to delete-surrounding on GTK. and Lexilla Release 5.2.6 (https://www.scintilla.org/lexilla526.zip) Released 26 July 2023. Include empty word list names in value returned by DescribeWordListSets and SCI_DESCRIBEKEYWORDSETS. Issue notepad-plus-plus#175, Pull request notepad-plus-plus#176. Bash: style here-doc end delimiters as SCE_SH_HERE_DELIM instead of SCE_SH_HERE_Q. Issue notepad-plus-plus#177. Bash: allow '$' as last character in string. Issue notepad-plus-plus#180, Pull request notepad-plus-plus#181. Bash: fix state after expansion. Highlight all numeric and file test operators. Don't highlight dash in long option as operator. Issue notepad-plus-plus#182, Pull request notepad-plus-plus#183. Bash: strict checking of special parameters ($*, $@, $$, ...) with property lexer.bash.special.parameter to specify valid parameters. Issue notepad-plus-plus#184, Pull request notepad-plus-plus#186. Bash: recognize keyword before redirection operators (< and >). Issue notepad-plus-plus#188, Pull request notepad-plus-plus#189. Errorlist: recognize Bash diagnostic messages. HTML: allow ASP block to terminate inside line comment. Issue notepad-plus-plus#185. HTML: fix folding with JSP/ASP.NET <%-- comment. Issue notepad-plus-plus#191. HTML: fix incremental styling of multi-line ASP.NET directive. Issue notepad-plus-plus#191. Matlab: improve arguments blocks. Add support for multiple arguments blocks. Prevent "arguments" from being keyword in function declaration line. Fix semicolon handling. Pull request notepad-plus-plus#179. Visual Prolog: add support for embedded syntax with SCE_VISUALPROLOG_EMBEDDED and SCE_VISUALPROLOG_PLACEHOLDER. Styling of string literals changed with no differentiation between literals with quotes and those that are prefixed with "@". Quote characters are in a separate style (SCE_VISUALPROLOG_STRING_QUOTE) to contents (SCE_VISUALPROLOG_STRING). SCE_VISUALPROLOG_CHARACTER, SCE_VISUALPROLOG_CHARACTER_TOO_MANY, SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR, SCE_VISUALPROLOG_STRING_EOL_OPEN, and SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL were removed (replaced with SCE_VISUALPROLOG_UNUSED[1-5]). Pull request notepad-plus-plus#178. Fix notepad-plus-plus#13901, fix notepad-plus-plus#13911, fix notepad-plus-plus#13943, close notepad-plus-plus#13940
for example
<KeyWord name="If Then Else" />.To reproduce the bug:
open new document
Goto Language and choose Visual Basic
start typing
Ifautocomplete box will showsIfThenElsein separate linewhile the expected behavior is to show in single line
while the expected behavior is to ignore case.
Now even if we put
<Environment ignoreCase="yes" >(taken reference from c.xml) in vb.xml, this behavior is not changed.Both the bugs are fixed in this PR.