allow subsequent input() call to retroactively continue previous line #4

Open
opened 2026-05-08 02:13:01 +00:00 by blokyk · 0 comments
Member

replxx has some multiline support, but it is only accessible through either keyboard shortcuts or pasting multiline text. this isn't a great experience, in particular because our current flow requires going through the parser first to determine whether the next input should be a continuation of the previous line, or if it's a new, independent line.

the ideal solution here would be to have some way to tell Replxx::input that it should continue the input from the previous call(s), such that it is transparent to the user and they can navigate/edit previous lines. this would mean that input() would have to return all accumulated input thus far, but that shouldn't be a big problem as i'm pretty sure ReplxxImpl::_utf8Buffer (or ReplxxImpl::_data or one of the other generically-named buffers) already keeps the previous input data in-between input() calls. (worst case scenario we can always have the user pass the previous input in).

note: currently, replxx takes care of indenting each new line correctly based on the original prompt, but the idea of changing the prompt during multiline input is interesting (e.g. zsh shows the current scope/reason you're multiline (e.g. quoted string, subshell, etc.) as a secondary prompt for new lines). i'm not sure what the behavior should even look like here (i don't think replxx can do right-aligned prompts so don't even think about it)

replxx has _some_ multiline support, but it is only accessible through either keyboard shortcuts or pasting multiline text. this isn't a great experience, in particular because our current flow requires going through the parser first to determine whether the next input should be a continuation of the previous line, or if it's a new, independent line. the ideal solution here would be to have some way to tell `Replxx::input` that it should continue the input from the previous call(s), such that it is transparent to the user and they can navigate/edit previous lines. this would mean that `input()` would have to return all accumulated input thus far, but that shouldn't be a big problem as i'm pretty sure `ReplxxImpl::_utf8Buffer` (or `ReplxxImpl::_data` or one of the other generically-named buffers) already keeps the previous input data in-between `input()` calls. (worst case scenario we can always have the user pass the previous input in). note: currently, replxx takes care of indenting each new line correctly based on the original prompt, but the idea of changing the prompt during multiline input is interesting (e.g. zsh shows the current scope/reason you're multiline (e.g. quoted string, subshell, etc.) as a secondary prompt for new lines). i'm not sure what the behavior should even look like here (i don't think replxx can do right-aligned prompts so don't even think about it)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lix-project/replxx#4
No description provided.