Git Product home page Git Product logo

go.linenoise's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

go.linenoise's Issues

stdin left in raw state after crash

Not sure this is really a bug for go-linenoise, but if one has an uncontrolled panic then stdin is left in raw mode, messing up the terminal. Maybe simply warn about this possibility?

Detecting end-of-file

Thanks BTW for a most useful binding! It would be useful if we could detect that the user has closed stdin with ctrl-D or wants to escape with ctrl-C. Both of these make the original linenoise function return NULL. But Go strings are not nil-able; there is no way to tell difference between user pressing empty line and user having cancelled the session with these keys.

Now 1st prize is not breaking the existing API, so I thought one could represent 'end-of-input/session' with a special string. One I tried was "\000" which has length 1 (this is not C ;)) and where s[0]==0.

Another solution is to extend the API and have a linenoise.LineBytes (or whatever, I'm not talented at naming things) which returns a []byte value, which can be easily converted into a string and is nil-able.

Thoughts? Otherwise people are going to be frustrated if they can't get out of a session with the usual keys and have to kill the terminal......

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.