-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Refactor auto completion #1077
Conversation
The current auto completion has two modes:
The case sensitive mode is activated when one types a word that has mixed case, e.g., The case sensitive mode is straight-forward: It will lookup a word that can be completed from the current partial word. Discussion point All Shells (UNIX) are case sensitive by default. |
e8c3413
to
f6b85bd
Compare
a4c5c0f
to
2e14f84
Compare
9e5219a
to
0cc9f4f
Compare
Ok, I got something working here now. Massively refactored the code (god was this hard to read 😭). @JabRef/developers WDYT? I'd be happy if you try the version with a few use cases of your own to check whether it is working correctly for you. http://builds.jabref.org/auto-complete/ |
private List<String> suggestions; | ||
private String currentWord; | ||
private int currentCompletion; | ||
private int realCaretPosition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make suggestions final and unmodifyable.
f9f676c
to
770a8c1
Compare
LGTM 👍 |
@JabRef/developers Does it work for you? Should we merge this in or any further suggestions? |
Would it make sense for the NameAutoCompleter to work for all fields with BibtexSingleFieldProperties.PERSON_NAMES set? I do not really know how it works today, but I seem to recall that it wasn't obvious if the same AutoCompleter was used for both "author" and "editor". (Haven't had time to test it yet.) |
Would be possible, currently it only works on author and editor.
|
I quick checked. Currently only those two fields have the property |
Correct but there's is a PR (don't know the number now) which adds 20 or so
fields.
|
Ah ok. We could do something like this:
But I get NullpointerExceptions in the tests due to the InternalBibtexFields relying on Globals.prefs (InternalBibtexFields.java:125) |
OK! These dependencies are annoying... Mock JabRefPreferences?
|
Is this still a valid question? If yes: I was thinking that casing causes more keys to type (shift key). Thus: being lazy should instruct JabRef to search for everything. Being non-lazy (capital letter), I want the tool to search only for these cases as I demand something specific. In powerline-shell or Windows CMD, the search IMHO also is case-insensitive. I have not researched for typical algorithms the recent time. When refactoring the auto completion a few years ago, I found nothing useful. However, I did not document my search. |
Quick test:
The typed characters have to be kept! The autocompletion must not override the user's input. I can send you my large bib file privatly. Don't want to share it publicly. |
|
This PR is superseeded by #1136 |
Major changes in this PR: