-
-
Notifications
You must be signed in to change notification settings - Fork 863
feat: add better prompt marker in REPL's multi-line mode #1818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Snehil Shah <[email protected]>
@@ -26,6 +26,11 @@ var repeat = require( '@stdlib/string/repeat' ); | |||
var leadingWhitespaceRegExp = require( './regexp_leading_whitespace.js' ); | |||
|
|||
|
|||
// VARIABLES // | |||
|
|||
var BASE_PROMPT = '...: '; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this work when a user provides a custom prompt? This assumes that the prompt is of the form In [%d]:
, but that is not necessarily the case. See https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/repl#repl-options-.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g., the prompt could be changed to >
or $
or something else entirely. In which case, this implementation is making an assumption about the form of the prompt which is not guaranteed to be true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I messed up there. One solution can be, the prompt can just consist of spaces/dots the length of the input prompt, the lines would still align , there would be no ...:
in the prompt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kgryte something like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this returns us to whether a continuation prompt is necessary. For example, if we support SHIFT+ENTER or some other modifier, then
In [5]:
function func() {
console.log( 'hello world' );
}
should be possible which achieves alignment, without requiring special prompt handling or the loss of terminal columns with unused whitespace. For the latter in particular, while some terminal applications are good in handling text overflow, others are not, thus making horizontal real estate something of a precious commodity. If we followed IPython and provided a continuation prompt which indents based on the parent prompt, we limit full use of all possible real estate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.. I'll close this issue and PR👍
Resolves #1763
Description
This pull request:
Related Issues
This pull request:
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers