Add multicursor autocompletions - #4028
Conversation
|
But we already have #3442 and this use case is discussed within it?! |
|
Yes, but #3442 still autocompletes on all cursors, even if they shouldn't be. |
|
Tested the changes, works well as expected. Nice one. |
|
Hey @redsti-github , I want to merge this to my own fork. Could you tidy up the commits please? Thanks. |
325e85c to
5c71c2e
Compare
5c71c2e to
5b66d78
Compare
5b66d78 to
54c5bc5
Compare
|
This caused a serious regression: autocompletion in the command bar doesn't work unless the cursor is after a word. For example, open the command prompt and press Tab - nothing happens (while it should suggest commands to execute). Or for example, open the command prompt, type |
|
So there are 2 autocomplete functions (confusingly), one in buffer and one in action, where the action one calls the buffer one. And there's also CommandComplete, for the command bar, which calls the buffer autocomplete directly. Previously, the autocomplete in the action one was guarded with some autocomplete logic (is the cursor in words, etc...). This PR moved the guard to the buffer autocomplete, and now the CommandComplete which wasn't guarded by this logic before is guarded now. Unfortunately I didn't spot this :/ (I have always typed the first few letters before auto-completing...) I guess the fix would be moving the guard back to the action autocomplete function instead of in the buffer one? |
|
I also noticed this quirk that can happen when the words under different cursors don't match: https://asciinema.org/a/mc6ZvLipLNBv1Wmd This also broke plugins that autocomplete sequences with non-word characters. For example jlabbrev lets you autocomplete |
PR micro-editor#4028 moved the check for autocomplete from action autocomplete to the buffer one, which caused a few regression for upstream callers that use the buffer autocomplete. This commit restores pre micro-editor#4028 behavior by adding a callback variant for buffer autocomplete functions while keeping the multi-cursor autocomplete function.
PR micro-editor#4028 moved the check for autocomplete from action autocomplete to the buffer one, which caused a few regression for upstream callers (commandbar autocomplete & plugins that use buffer autocomplete) that use the buffer autocomplete. This commit restores pre micro-editor#4028 behavior by adding a callback variant for buffer autocomplete functions while keeping the multi-cursor autocomplete function.
Implements autocomplete while using multiple cursors. (loosely based on #3442)
Only autocompletes cursors which end in the same word as the active cursor.
For example:
Closes #3442