dundalek / closh

Bash-like shell based on Clojure
Eclipse Public License 1.0
1.62k stars 66 forks source link

[BUG] Display and input overlap with tab-completion #115

Closed jaidetree closed 5 years ago

jaidetree commented 5 years ago

REPRODUCTION

  1. Run closh-zero.jar
  2. Type in a base directory like ~/
  3. Press the TAB key
  4. Start typing the prefix of a listed dir

Expected

Actual

Environment

Param Value
Operating System: OS X Mojave (10.14)
Parent Shell: ZSH
Closh Version: 0.3.2
Terminal: iTerm 2

Notes

dundalek commented 5 years ago

That looks strange indeed. Does it happen every time or only sometimes?

I sometimes get strange behavior when I resize the terminal window but unfortunately I haven't been able to observe any patterns. Did you maybe resize the terminal?

Could you try a different terminal to see what the behavior is there?

jaidetree commented 5 years ago

Happens every time. I’ll try a different terminal and see what happens.

dundalek commented 5 years ago

Another pointer might be to try to run rebel-readline and see how completions behave there (closh uses rebel-readline internally). I don't run a Mac so I can't unfortunately test these myself.

jaidetree commented 5 years ago

Just tried both. Same thing happened when using default OS X Terminal:

screen shot 2018-12-12 at 11 48 03 am

Rebel readline seemed to work correctly:

screen shot 2018-12-12 at 11 49 33 am

clojure -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.4\"}}}" -m rebel-readline.main

dundalek commented 5 years ago

Great, that helped narrow it down a lot.

I think I found the issue. Closh invokes existing shells for completions. It first tries fish, then zsh and lastly fallbacks to bash. In your case it seems to them from zsh, but it seems that zsh returns some special characters that move the terminal into inconsistent state. I have fish installed so I haven't noticed this before.

In order to fix this I need to improve how the input from zsh gets handled.

In the meantime a temporary workaround for you could be to install the fish shell :)

dundalek commented 5 years ago

The fix for this is now in master. While I am at it I will try to tackle #112 and will publish a release after that.

jaidetree commented 5 years ago

Confirming that running it within fish shell did fix tab-completion. It even works when using bash. I'll try to test those environments if anything comes up again.

Also, you may have just converted me to fish shell*


[*] Fish shell until or under closh of course 😄

dundalek commented 5 years ago

Haha, nice one :smile: I switched to fish and used it for some while before I started working on closh. I think it has the best user interface of all and I would like to make closh feel as smooth (or better) one day.

jaidetree commented 5 years ago

Yeah, fish is a really rich experience. It's a very good benchmark for Closh :)

After playing more with Closh, this behavior does occur even when setting it directly as my default shell. Will this upcoming release fix that?

dundalek commented 5 years ago

It took a bit longer but v0.3.3 is now published and it includes a fix for this issue.

jaidetree commented 5 years ago

Appears fixed now, great job!