-
Notifications
You must be signed in to change notification settings - Fork 155
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
Option to separate real prompts from unfinished output #20
Comments
There exists another rlwrap-like line editor: What I propose is that rlwrap behaves like As this breaks transparency, it certainly should not be default behaviour. The |
I was about to say something along the lines of your last comment. I think of rlwrap as an input-handling tool. The less it manipulates output the better -- that's what you call "transparency" above. Any assumptions made about an underlying command's output complicate things. As long as output mangling isn't the default that complexity can be avoided. To further separate this feature from rlwrap's core functionality could it be written as a filter plugin? |
In theory a filter could mangle output by inserting cursor movement commands, but this would be a very messy solution. |
Interesting. Are you thinking the full state machine rewrite could be a target for the 0.43 release? |
No, this would be a very major rewrite. A lot of code is currently devoted to rare corner cases (like receiving slave command's output after the slave has died, or ,indeed, receiving output during a line edit, the original motivation for this thread), this re-write could lead to a different (hopefully smaller, but still significant) set of obscure corner cases I'm not exactly looking forward to it.... |
Eric Pruitt wrote:
At present,
rlwrap
considers any output that doesn't end in a newline a prompt. If such a 'prompt' arrives while you are typing it will be appended to the current prompt before the cursor, which is messy.This is the most general solution, but for many commands a prompt can be recognised as such because it fits a certain pattern (e.g. it ends in a '>' or a '$'). Specifying e.g
--only-cook '>\s?$'
preventsrlwrap
from cooking (e.g. colouring) anything else.I could extend the effect of this option (or add a new option), making
rlwrap
reprint the original prompt (on a new line) below any output that doesn't fit the given regexp, even if this output doesn't end in a newlne.If more output arrives,
rlwrap
should go back to the line above the prompt, append the new output, and reprint the prompt (except when this fits the regexp, in which caserlwrap
should behave as it does now)This (Eric's solution 'B') is a bit tricky, but probably doable.
An alternative (or additional) solution would be to extend the filter mechanism (which already can send back messages
_THIS_IS_NOT_A_PROMPT_
)Solution 'A' -don't print any of the slave command's output between starting the line editor and accepting the resulting input - is less attractive to me: the user would miss out on important information, like error messages.
The text was updated successfully, but these errors were encountered: