Repository navigation
Conversation
A prompt that is not a string now behaves as in Node: getPrompt() answers the stored value, a terminal interface writes the value's String() (valueOf before toString, a symbol throws), getCursorPos() measures that text, and a non-terminal interface throws ERR_INVALID_ARG_TYPE instead of writing. The prompt is coerced by the same dynamic string addition the interface uses for prompt + line, so the coercion is Node's. The interface watches its output's 'resize' event and redraws the prompt and line when it fires, byte-identically to Node, for a stream output and for process.stdout, and removes the listener on close. Signal and resize listeners do not keep the process alive, as in Node. Interface.close() now pauses the input as Node's pause() does, which lets the process exit when the last interface on process.stdin closes while the keypress hub's 'data' listener stays registered.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Comment on lines
+6283
to
+6286
| while (scr_rl_resize_hooks) { | ||
| ScrRlResizeHook *h = scr_rl_resize_hooks; | ||
| scr_rl_resize_hooks = h->next; | ||
| free(h); |
Contributor
| * the last interface closes: the keypress hub's 'data' listener stays | ||
| * registered, as in Node, but a paused stdin never reads. */ | ||
| if (rl->in) rl->io->pause(rl->in); | ||
| else if (rl->stdin_in) scr_stdin_pause(); |
Contributor
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ERR_USE_AFTER_CLOSE/ERR_INVALID_CURSOR_POSfrom partial to supported: non-string prompts throughgetPrompt/getCursorPos/write, terminal resize redraw for stream and process.stdout outputs, and close()'s pause of process.stdin.