lite-xl / lite-xl-plugin-manager

A lite-xl plugin manager.
Other
102 stars 14 forks source link

Flush input before reading it #89

Closed Guldoman closed 6 months ago

Guldoman commented 6 months ago

To avoid that, for example, a double enter confirms the default choice twice.

adamharrison commented 6 months ago

4ef4e13?

Guldoman commented 6 months ago

Sadly doesn't seem to work:

lpm run 2.1.2-gh https://github.com/PerilousBooklet/lite-xl-lsp-servers:java lsp_java
   8.3 kB [   8.1 MB/s][100%]: Fetching https://github.com/PerilousBooklet/lite-xl-lsp-servers:java...
jdk is an optional dependency of lsp_java. Should we install it? [Y/n]: 
Installing complex library jdk.

Installing singleton plugin language_java.
lintplus is an optional dependency of lsp. Should we install it? [Y/n]: Installing complex plugin lintplus.
lsp_snippets is an optional dependency of lsp. Should we install it? [Y/n]: json is an optional dependency of lsp_snippets. Should we install it? [Y/n]: 
Installing singleton library json.
Installing singleton plugin snippets.
Installing singleton plugin lsp_snippets.
warning: widget stub on https://github.com/lite-xl/lite-xl-plugins.git:master has differing version from remote (0.2.1 vs 0.2); may lead to install being inconsistent
Installing complex library widget.
Installing complex plugin lsp.
Installing complex plugin lsp_java.
adamharrison commented 6 months ago

There's no good way to do it, apparently. I'd probably have to fuck around with fnctl in C.

Guldoman commented 6 months ago

Would something like fseek(stdin,0,SEEK_END); work?

adamharrison commented 6 months ago

Nope.

adamharrison commented 6 months ago

I think this is out of scope, honestly. Do other package managers do this?

Guldoman commented 6 months ago

Yeah, see https://gitlab.archlinux.org/pacman/pacman/-/blob/e3dc296ba35d5039775c6e53decc7296b3bce396/src/pacman/util.c#L183.

adamharrison commented 6 months ago

Oh, ok. That's easier than expected. Will implement.

adamharrison commented 6 months ago

389fe57

Guldoman commented 6 months ago

Working great, thanks!