ergochat / readline Goto Github PK
View Code? Open in Web Editor NEWA readline implementation in pure Go
License: MIT License
A readline implementation in pure Go
License: MIT License
CharLineStart
, MetaBackward
, etc. can all be lowercased, unexporting them.
term*.go are vendored forks, due to chzyer/readline#62 . The underlying issue is still present in x/term 0.6.0. It has something to do with this specifically:
https://github.com/golang/term/blob/0edf009663f942c41572b65d537ee2636e92180c/term_unix.go#L34
Context: golang/go#15625
I bisected this to 62ab2cf. There is now a race where the password prompt can be printed an extra time. It's reproducible with example/readline-pass-strength/readline-pass-strength.go
:
$ ./readline-pass-strength
✔ ENT New Password:
✗ ENT New Password: Your password was: sdjflaksdf
I'm considering a more extensive refactor of how config updates are done, but I want to get a firm diagnosis for this first to make sure I'm solving the root cause.
Tested on WezTerm, Windows Terminal (both use OpenConsole) and normal Command Prompt. WSL has normal expected Linux behavior.
Should be straightforward because we already accept Ctrl-A and Ctrl-E?
Hey, just happen to noticed this:
$ go run example/readline-demo/readline-demo.go
»
# now press ctrl-r to get the "bck-i-search" promtp, then press enter
» k-i-search:
# ends up with messed up prompt
Think i also managed to get the history search into some other weird states but can't really reproduce it now
The expandable ring buffer from #46 can replace container/list
as the data structure for history. Just a nice-to-have.
Hey! hope your doing good! I noticed this patch for the z/OS fq port, merge?
https://github.com/ZOSOpenTools/fqport/blob/main/patches/readline-patch
As discussed here: wader/fq#940 this is a normal readline feature. I checked our v0.0.1 (last upstream release) and it does not work there, so it's not a regression, it was never implemented.
See #61, it's not clear that this is really useful for anything (although it also doesn't clutter the API very much).
Add documentation explaining what has changed from upstream and how to migrate.
We've accumulated a lot of cases that are likely to break:
async
command in readline-demo)e.g. (*Instance).ReadlineCtx(ctx context.Context)
chzyer/readline#163 is still present in our fork
This code is extremely bogus:
Lines 60 to 83 in cd7fbcc
Instead, resumption should be detected by handling SIGCONT. (Not sure about the story on Windows.)
Suggested by @tpodowd
Let's do this last, after other invasive refactors are complete, since it will introduce lots of potential merge conflicts.
Things like:
We are trying to migrate from chzyer/readline to this fork since the former seems to be unmaintained.
But I'm facing a few issues.
github.com/chzyer/readline had a ClearScreen method that was quite convenient for us as we want to expose
users a way to clear the screen by typing clear
. This package can still do that when pressing Ctrl+L but doesn't espose that as one easy method.
Could we get a ClearScreen method exposed, please?
Investigate https://github.com/charmbracelet/vhs for this: https://www.youtube.com/watch?v=dtVezRX8OEM
(*Config).Init
: this should not be exposedNewFromConfig
and SetConfig
should copy the config. This prevents data races from clients attempting to modify the config from the outside.Config.opHistory
and Config.opSearch
(these should be members of Operation
only)(*Instance).ReadPasswordWithConfig
has weird implications, for example, it can change the stdio handles back to the defaults. This API needs reevaluation.This race is still present:
Ctrl-R writes to the search mode status, wrapWriter reads it on asynchronous writes, and these are not necessarily synchronized.
It's unclear that FillableStdin is actually usable for any purpose that ReadlineWithDefault
can't handle:
Lines 225 to 228 in 86cc349
This is looking better:
https://pkg.go.dev/github.com/ergochat/[email protected]
but there's still a lot of cruft. For example:
Listener
should probably become a function pointer type rather than an interface, eliminating the need for DumpListener
. See #6 for discussion of the listener APIPrefixCompleter
, PrefixCompleterInterface
, and functions like Do
and Print
is confusedInstance
has too many methodsPainter
should be a function pointer type, not an interface typeTabCompleter
should probably be hiddenSegmentComplete
and SegmentCompleter
?A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.