-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
update linenoise #16451
update linenoise #16451
Conversation
@@ -485,6 +499,8 @@ void refreshShowHints(struct abuf *ab, struct linenoiseState *l, int plen) { | |||
if (bold == 1 && color == -1) color = 37; | |||
if (color != -1 || bold != 0) | |||
snprintf(seq,64,"\033[%d;%d;49m",bold,color); | |||
else | |||
seq[0] = '\0'; |
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.
It seems to have a small fix here
This comment has been minimized.
This comment has been minimized.
Yeah, is this module rarely used? |
Please rewrite all the C code in Nim. We don't need more "static" variables, it's a desaster for multi-threading. |
That said, I kind of agree with the need for rewrite, although it's a bit unfair to dump it all on this PR's author. Long term this is absolutely the way to go though, for several reasons:
I had actually done exactly that in D some time ago, and it was not hard, and it did allow implementing more features easily in a more high-level langauge. In nim, this could also be done in multiple stages instead of a one-time conversion, thanks to
no, it's useful anytime you need interactive CLI input in a program (eg for a repl, eg inim) |
I could port them when I have free time. I will also consider porting a better and modern one: |
It seems that there are already two Pure Nim version of linenoise |
@Araq @xflywind instead of rewriting something that already exists in nimble (in multiple packages in fact), how about this plan:
nimble install noise # suppose it has a `linenoisecompat` module with same interface as std/linenoise
nim --path:std/linenoise:pkg/noise/linenoisecompat main
then it all works, and even
notethis approach generalizes to other use cases (there's nothing specific about linenoise) where we're better off reusing nimble packages than re-inventing (poorly) the wheel in stdlib, thus avoiding duplicating effort |
fetch the upstream updates
based on this commit
antirez/linenoise@97d2850