peterh / liner

Pure Go line editor with history, inspired by linenoise
MIT License
1.05k stars 132 forks source link

Does liner support to read multi-line seperated by '\'? #133

Closed jievince closed 4 years ago

jievince commented 4 years ago

just like:

prompt>select a from b \
yield c

which equals to:

prompt>select a from b yield c
jievince commented 4 years ago

https://github.com/peterh/liner/pull/59#issue-50142806

jievince commented 4 years ago

https://github.com/influxdata/influxdb/issues/4279#issue-109034813

jievince commented 4 years ago

@peterh

peterh commented 4 years ago

Liner does not have built-in line continuation support. A user of liner could implement its own (by, for example, prompting again with a different prompt string when it sees a trailing backslash), but it's not a feature of liner per-se.

The closest thing that liner has is https://pkg.go.dev/github.com/peterh/liner?tab=doc#State.SetMultiLineMode (which is not the same thing, but it might be close enough if all you're looking for is a way to avoid the horizontally scrolling line).

jievince commented 4 years ago

Thanks for your reply. MultiLineMode is not what I want. Does liner need a builtin line continuation? I can support it.

peterh commented 4 years ago

Thanks for the offer, but I don't think we want to support builtin line continuation.

Which line continuation styles should liner support? I know you have C style continuation above, but what if someone wants to use groff style? FORTRAN style? VB style? JCL style? I'd rather not open this particular can of worms.

The application using liner knows what line continuation style it wants to support, so the support should be there.

jievince commented 4 years ago

You're right, line continuation should be done in our own program, instead of in liner

zoulux commented 2 years ago

If support \, do you have a good idea?