brittany-reid / ink-scroll-prompts Goto Github PK
View Code? Open in Web Editor NEWPrompts that scroll. Using Ink.
Prompts that scroll. Using Ink.
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.
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).
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).
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.
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.
Tasks
@gnd/ink
to ink
across filesSometimes 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'.
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.
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.
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.