GithubHelp home page GithubHelp logo

ink-scroll-prompts's People

Watchers

 avatar  avatar

ink-scroll-prompts's Issues

Autogenerated README

Sorry, my research is in software engineering and documentation, so solutions to documentation maintenance are fun for me.

There is now a README generation script that merges markdown files in /doc, this allows us to maintain individual documentation pages as well as a full README with no extra work.

The script is super simple at the moment, I would like to export it to it's own project at some point.

Next/Previous Word Keybinding Issues

In VSCode on windows, the alt+arrow key press for next/previous word does not work. It sends no code. Perhaps there is a setting that can be toggled?

However, in powershell this sends the code '\x1B\x1B[C'. I will manually add this to the useInput hook for now.

As mentioned here, powershells move by word is swapped compared to the mac terminal, so a case could be made for having different keybindings for different platforms (but I would rather not).

ReplaceAll is not a function

I updated the validateInput function from version 16 of Node, to use ReplaceAll, however, I knew something was wrong and on testing on v14 (my windows install), the function has only been recently added. I was wondering why I had used replace previously, probably because I thought that was javascripts version of replaceAll.

I will add version 14 to the testing action as this is still LTS, and this is an easy fix (use regex).

Delete Line KeyBinding Issues

In VSCode on MacOS, pressing command + delete, gives the same code as ctrl + u, the delete line code, \x15.

However, in the default terminal, this causes an 'alarm' sound.

The command ctrl + delete sends simply the delete code.

I tried adding a custom binding somehow but the terminal preferences don't allow me to copy and paste the code \x15 without escaping it, I need to press the actual command, but command + u doesn't work and ctrl + u gives a different code.

ctrl + u still works.

Line Start and Line End Issues

In VSCode on MacOS, cmd + <- moves to the start of a line and cmd + -> moves to the end of a line.

However, in the default terminal, this does nothing.

Similarly, using ctrl sends no code.

The supposed way to do this CTRL+E adn CTRL+A, but again, I find these shortcuts to be hard to remember. They do work however.

I could bindctrl + <- to \001 by pressing ctrl+e in terminal preferences, however, this was not sending any code to my terminal.

Replace @gnd/ink dependency with ink

Tasks

  • Update references to package @gnd/ink to ink across files
  • Remove patched src/patch/ink-testing-library.js, open a pull request in the actual package repository for some missing stdout functions that I've found useful.

Trim input on cancel

Sometimes I get a bit crazy and put a bunch of newlines while typing, and when I exit my prompt, oops, my terminal is filled with ugly newlines! Is this really an issue? No, but I do think it takes up space in your terminal scrollback and my general impression is 'not polished'.

image

In the above screenshot, I was editing a code snippet, then exited out of the coding environment back to the CLI prompt. The canceled prompt is not dimmed because this is in VSCode on windows using powershell.

Trimming these newlines would clean up the UI a bit.

Prompt API

I want to implement a set of objects that handle the running and exiting of the components, that can be used with no knowledge of react/ink. I want to call the base class Prompt. The class that implements the InputPrompt can be Input and the ScrollMenu implementation Select.

The implementation I have so far works as follows:

var result = await new Prompt().run();

The idea is that if you just want the base features, you can use this. If you need to build your own prompt, you can use the existing components. If your new component follows the same API as the existing components, you can even extend Prompt to use it! This is what I have in my projects already, as it reduces the amount of code needed.

However, the Prompt name is already used by a component, that is, the text before you start typing, which is commonly called a "prompt". What this component really is, is a text component, constructed from given props. So I will rename it PromptText. It is not exported in index.js and only used by InputPrompt to format the prompt text.

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.