yuku / textcomplete

Autocomplete for HTMLTextAreaElement and more.
https://yuku.takahashi.coffee/textcomplete/
MIT License
1.74k stars 303 forks source link

Prevent default behavior of Enter, Up, Down in dropdown doesn't work in CodeMirror #338

Closed ebigram closed 3 years ago

ebigram commented 3 years ago

Hi there, very elegant/useful library, I think it makes a lot of sense to have a generalized solution to this problem with multiple backends, and for the most part it has been easy to integrate in my case.

I'm making a plug-in for an Electron app that uses CodeMirror, and while everything works great, I notice that Up, Down, and Enter events are not suppressed while dropdown is active, so I get wonky behavior as the cursor keeps moving even as a cycle through autocompletion hint candidates, and it "jumps" to the next line if I choose one with Enter. I notice you use an e.preventDefault to override these events, is there anything with the version of CodeMirror that could be incompatible with this?

When I build a simplified application with the latest versions of Electron/CodeMirror, I don't have this issue. Unfortunately since this is a plugin, I can't control the version in the current codebase I'm working against. Are there other ways to ignore events in the client library? This has greatly simplified my code, and I'd hate to abandon this package just due to some minor incompatibility. Thanks.

ebigram commented 3 years ago

Sorry, please ignore, I can't say for sure what finally resolved this issue, but it seemed to have gone away when I fixed my regex matching. I'm digging this library, thanks for maintaining it.