Giter Site home page Giter Site logo

xterm-readline's People

Contributors

jamhed avatar strtok avatar wch avatar

Stargazers

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

Watchers

 avatar

xterm-readline's Issues

Request: a way to show tab completions

First off, thanks for creating this package.

I'm using it create a REPL using Pyodide (Python compiled to wasm), and I would like to add support for tab completions. The idea is that when you press tab, it does one of the following (which is similar to the normal python REPL):

  • If there are zero possible completions, then nothing happens.
  • If there is one possible completion, it completes it.
  • If there are two or more possible completions, then it fills in any following characters that are present in all of the possible completions, and then displays the possible completions.

I don't see a good way to do this with the existing API. One way to go would be to provide a way register a completion handler; this handler would be a function which takes a string (the text typed on the command line so far) and returns an array of strings (the list of possible completions).

So the usage would be something like this:

    readline.setCompletionHandler((text: string): string[] => {
      // Do stuff here
    })    

Handling vi/vim mode

I am having hard time make readline working properly in vi/vim mode and letters are jumping and adding bunch of letters on top the current when try to navigate or even try to type anything. Any guidance on how to initialize Vi/vim properly and handle all keyboard events?

Thank you.

Empty input() or input("") won't ask a thing and duplicate the output

I am basically forwarding this (wrongly opened) Xterm.js issue: xtermjs/xterm.js#4966

Apparently when no argument/parameter is passed to input(), or input("") with empty string, expectations are broken and the terminal prints last printed thing twice.

Is this a known issue and/or can we fix it by passing a zero-width char out of the box, when no argument is provided, which solves all the things?

That is: input("​") (note: you don't see it, that's its purpose, your IDE would though, or should!)

input("​")

GitHub copy would definitively give you that invisible char!

Thank you!

multiline input > terminal height is broken

There's a few ways to see symptoms of this:

  1. Start a multiline prompt and add enough lines so that the prompt scrolls above the terminal window. Scroll up with the terminal and you will see that multiple prompts have been rendered, likely as an effect of how the refresh() code deals with refreshing a terminal.
  2. Input enough lines so that the terminal prompt scrolls above the terminal window, and then arrow up. It is not possible to arrow up to the text that scrolled away.

This is tracked in the rustyline project by kkawakam/rustyline#611

Support for `write()` while `read()`

Currently, if you call write() after you read() and before that read has completed, the written text is inserted directly after the prompt with the typed content and the prompt line is not refreshed. If you backspace to force it to refresh, it overwrites the written text as if the write() has never happened.

This would be useful for an async REPL where text may be printed from async code running in the background.

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.