oilshell / oil

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.78k stars 150 forks source link

bash allows pasting multi-line code snippets, but OSH/YSH don't #1994

Open dezren39 opened 1 week ago

dezren39 commented 1 week ago

i would like to be able to paste a multiline example and it works right

f() {
  local -n out=$1    # -n for named reference
  out=bar
}

x=foo
f x
echo x=$x 

bash

[user@nixos:~]$ f() {
  local -n out=$1    # -n for named reference
  out=bar
}

x=foo
f x
echo x=$x
x=bar

ysh

ysh ysh-0.22.0$ f() {^J  local -n out=$1   # -n for named reference^J  out=bar^J}^J^Jx=foo^Jf x^Jecho x=$x^Jx=bar

osh

osh-0.22.0$ f() {^J  local -n out=$1    # -n for named reference^J  out=bar^J}^J^Jx=foo^Jf x^Jecho x=$x ^J

i realize this specific example is like, a bash script i passed into ysh and osh, but same thing happens if it was valid i think.

dezren39 commented 1 week ago

related but separate technically, is there a toggle hat would turn off the automatic scrolling when long lines are pasted? i'd rather it wrap

andychu commented 1 week ago

Hmm I think this is also a GNU readline thing we don't control

But it has a lot of settings, so not sure if this could be addressed

I think this is the same as bash right? what about zsh or other shells?

dezren39 commented 1 week ago

Top example bash pasted the whole thing and wraps, I'll try and check zsh and some others soon