You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can confirm it works! Hooray! Are you going to make a PR, @jcburley (the commit being yours) or would you like me to?
I don't plan to do it, it was actually a PR for Roman's fork of liner. I don't know whether he'd be interested in trying to push it upstream, especially given his fork having other changes (to suit Joker) in which Peter might have little or no interest.
But I'm happy for you to give it a try!
(Sorry for the bad link a few messages back; glad you figured it out while I was AFK.)
I guess making a PR and then letting Peter decide to merge it or not would work too. In that case, would you like to make a PR? Also, is it possible for me to make a PR that still shows you as the author of the commit?
I guess making a PR and then letting Peter decide to merge it or not would work too. In that case, would you like to make a PR? Also, is it possible for me to make a PR that still shows you as the author of the commit?
I'm not sure @peterh wants liner to be suitable for non-shells, but here's the PR anyway (and I'm open to helping make this configurable so the default remains shell-like behavior, while programs like Joker and other "normal" utilities can get this newer behavior):
Hmm but the reason I'm involved in this is because I'm making a shell. When raw mode is enabled, programs ran through the shell I'm making can't get any input.
Hmm but the reason I'm involved in this is because I'm making a shell. When raw mode is enabled, programs ran through the shell I'm making can't get any input.
Oh, good point! I might be misremembering some other discussion from awhile back.
Basically it just echoes input, after prompting for and the reading it using liner, readline (which Joker used to use), or vanilla/default.
I recently added supporting e.g. "30s" (anything accepted by time.ParseDuration()) to mean "sleep for this long", to test out the effects of things like SIGQUIT on the terminal state.
Yeah, I'm not sure how useful that actually is. I was trying to better understand how these things (like line-readers) work when reading from a socket, as in a server configuration, versus a terminal. Didn't get far. But it's not currently an important use case for me ATM, though it has (at times) been in the past; mostly a matter of curiosity on my part.
This seems like a good idea, but again I'm not entirely sure it's necessary (in Joker's case anyway) if, as I suspect, input always ends up being "unmolested" despite temporary things like automatically adding a close-paren when typing an open-paren and then positioning the cursor just after the open-paren.
golang.com/x/term has stuff related to bracketed pastes. Bracketed paste mode is implemented by all major shells so I think Peter would be happy with a PR for that.
On January 19, 2021 7:06:35 AM EST, Ishan Goel ***@***.***> wrote:
[golang.com/x/term](https://pkg.go.dev/golang.org/x/term#Terminal.SetBracketedPasteMode)
has stuff related to bracketed pastes. Bracketed paste mode is
implemented by all major shells so I think Peter would be happy with a
PR for that.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#146 (comment)
sad := liner.TerminalMode()
l := liner.NewLiner()
happy := liner.TerminalMode()
sad.ApplyMode()
// shell out to another program here, remember to happy.ApplyMode before calling l.Prompt()
Besides, how do you feel about having this as default behavior?
Assuming "this" refers to liner returning to sad mode whenever it isn't inside Prompt? It would make me sad. I don't like my terminal to echo while my application is processing.
Yes, that happens with regular shells. And I hate it every time it happens. I do not want to see my input interspersed with the output of the application.
Wait but then I'm trying to build an actual shell and it's not able to give the commands run input from stdin. I found this was when raw mode was enabled.
Activity
jcburley commentedon Jan 17, 2021
You might want to take a look at the fork done for Joker (a Clojure interpreter implemented in Go):
#146
That might answer some of your questions.
quackduck commentedon Jan 17, 2021
Found it here: https://github.com/candid82/liner
quackduck commentedon Jan 17, 2021
Ah is this commit what you mean: candid82@8e336a7? I will use that fork now. Hooray for open source!
quackduck commentedon Jan 17, 2021
I can confirm it works! Hooray! Are you going to make a PR, @jcburley (the commit being yours) or would you like me to?
jcburley commentedon Jan 18, 2021
I don't plan to do it, it was actually a PR for Roman's fork of liner. I don't know whether he'd be interested in trying to push it upstream, especially given his fork having other changes (to suit Joker) in which Peter might have little or no interest.
But I'm happy for you to give it a try!
(Sorry for the bad link a few messages back; glad you figured it out while I was AFK.)
Yeah, open source is great!!
quackduck commentedon Jan 18, 2021
I think at least this one change would be a good addition to the original library. @peterh, would you be interested in such a change?
Could you expand on what other changes that fork has @jcburley?
(No problem with the link thing 🙂)
quackduck commentedon Jan 18, 2021
I guess making a PR and then letting Peter decide to merge it or not would work too. In that case, would you like to make a PR? Also, is it possible for me to make a PR that still shows you as the author of the commit?
peterh commentedon Jan 19, 2021
You can save and restore the terminal mode with https://pkg.go.dev/github.com/peterh/liner#TerminalMode
quackduck commentedon Jan 19, 2021
I don't see a way to set the mode...? Besides, how do you feel about having this as default behavior?
jcburley commentedon Jan 19, 2021
I'm not sure @peterh wants
linerto be suitable for non-shells, but here's the PR anyway (and I'm open to helping make this configurable so the default remains shell-like behavior, while programs like Joker and other "normal" utilities can get this newer behavior):#147
quackduck commentedon Jan 19, 2021
Hmm but the reason I'm involved in this is because I'm making a shell. When raw mode is enabled, programs ran through the shell I'm making can't get any input.
jcburley commentedon Jan 19, 2021
Oh, good point! I might be misremembering some other discussion from awhile back.
quackduck commentedon Jan 19, 2021
Ah. On a side note, what does https://github.com/jcburley/echo do?
jcburley commentedon Jan 19, 2021
Basically it just echoes input, after prompting for and the reading it using
liner,readline(which Joker used to use), or vanilla/default.I recently added supporting e.g. "30s" (anything accepted by
time.ParseDuration()) to mean "sleep for this long", to test out the effects of things like SIGQUIT on the terminal state.So it's just a test harness of sorts.
quackduck commentedon Jan 19, 2021
Ah cool. I see it connecting to servers too.
jcburley commentedon Jan 19, 2021
Yeah, I'm not sure how useful that actually is. I was trying to better understand how these things (like line-readers) work when reading from a socket, as in a server configuration, versus a terminal. Didn't get far. But it's not currently an important use case for me ATM, though it has (at times) been in the past; mostly a matter of curiosity on my part.
jcburley commentedon Jan 19, 2021
Another thing that "we" might put in our fork of
lineris supported for bracketed paste:candid82/joker#429
This seems like a good idea, but again I'm not entirely sure it's necessary (in Joker's case anyway) if, as I suspect, input always ends up being "unmolested" despite temporary things like automatically adding a close-paren when typing an open-paren and then positioning the cursor just after the open-paren.
quackduck commentedon Jan 19, 2021
golang.com/x/term has stuff related to bracketed pastes. Bracketed paste mode is implemented by all major shells so I think Peter would be happy with a PR for that.
jcburley commentedon Jan 19, 2021
peterh commentedon Jan 19, 2021
Assuming "this" refers to liner returning to sad mode whenever it isn't inside
Prompt? It would make me sad. I don't like my terminal to echo while my application is processing.quackduck commentedon Jan 19, 2021
But @peterh isn't that what happens with regular shells?
peterh commentedon Jan 19, 2021
Yes, that happens with regular shells. And I hate it every time it happens. I do not want to see my input interspersed with the output of the application.
peterh commentedon Jan 19, 2021
At least one other person has requested bracketed pastes. I'd be happy to look at a pull request for them.
quackduck commentedon Jan 19, 2021
Wait but then I'm trying to build an actual shell and it's not able to give the commands run input from stdin. I found this was when raw mode was enabled.
quackduck commentedon Jan 19, 2021
Shells do need to give commands input.
quackduck commentedon Jan 19, 2021
At least there being an option would do no harm.
peterh commentedon Jan 19, 2021
If you're trying to build an actual shell, you don't want liner. Sorry, but liner is not (and was never intended to be) suitable for all use cases.
quackduck commentedon Jan 19, 2021
Oh. I don't see what harm adding an option would do, but you're the owner!