Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete eat second line prompt #1488

Open
kocoai opened this issue Oct 17, 2017 · 34 comments
Open

Autocomplete eat second line prompt #1488

kocoai opened this issue Oct 17, 2017 · 34 comments

Comments

@kocoai
Copy link

kocoai commented Oct 17, 2017

Description

Problem to show autocomplete when prompt is multi-lines

Expected behavior

Autocomplete word should show in second line

Actual behavior

Autocomplete word showed in first line

Steps to Reproduce

  • PROMPT=$'${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{6}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)\n${editor_info[keymap]} '
  • type ls then tab to activate autocomplete

Versions

  • Prezto commit: 25d8db3
  • ZSH version: 5.3
  • OS information: macOS hight sierra

screen shot 2017-10-17 at 11 21 28

@belak
Copy link
Collaborator

belak commented Oct 17, 2017

I'm not able to reproduce this with my config. Do you have your full config posted anywhere so I can use it to try and reproduce it?

screen shot 2017-10-17 at 10 45 29 am

@josiahwiebe
Copy link

I'm having the same issue. See attached gif for reference.

autocomplete

@leshow
Copy link

leshow commented Oct 18, 2017

Same issue here also, seems to happen in all of the prompts that use 2 lines, this one is pure

unalgined

@belak
Copy link
Collaborator

belak commented Oct 18, 2017

Unfortunately, I still don't have enough information to reproduce this. I was only able to find one dotfiles repo among everyone who's commented so far and it appears to be pointing to oh-my-zsh.

If someone could provide me their zpreztorc (and any other related zsh config files) I'd be happy to look into this further.

@leshow
Copy link

leshow commented Oct 18, 2017

.zpreztorc https://gist.github.com/leshow/8710fec109e0edcfaa0b75a7b35dcb09
.zhsrc https://gist.github.com/leshow/a89bb4f116645c748a52869149654556

I think my zpreztorc and zshrc are fairly typical. I have a lot of modules enabled, but nothing that I think would cause any issues.

@belak
Copy link
Collaborator

belak commented Oct 18, 2017

@leshow Thanks!

Which terminal, OS, and version of zsh are you using? I'm hoping that will be enough for me to reproduce this.

@leshow
Copy link

leshow commented Oct 18, 2017

rxvt-unicode (urxvt) v9.22 - released: 2016-01-23
❯  ~  uname -a
Linux workbox 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux
❯  ~  zsh --version
zsh 5.3.1 (x86_64-debian-linux-gnu)

if there's anything else you need from me let me know. i will also try updating prezto and using pure on my home machine, it's running arch with up-to-date packages for everything.

@josiahwiebe
Copy link

And as for my setup, here's my config files.

$ uname -a
Darwin Norges.local 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64

$ zsh --version
zsh 5.3 (x86_64-apple-darwin17.0)

I'm running macOS High Sierra (v10.13) and using Terminal.app.

@johnpneumann
Copy link
Collaborator

I noticed this a few weeks ago when I did a recent upgrade to prezto and thought I might have been seeing things. I was still on El Capitan at the time, but upgraded to High Sierra last week. Today I noticed it ad-nauseum and watched things disappear as I used autocomplete. I didn't have a chance to look at it though and assumed it was my setup, but as others have noted it, it's apparently not a "my machine" issue.

I'll take a look into this to see what I can discern in the am, but here's my info if it's even mildly helpful to anyone who may be checking it already (admittedly my update regimen is poor - still adjusting to having a baby in the house again):

El Capitan - zsh version 5.0.3 - prezto commit - dd1133d
High Sierra - zsh version 5.3 - prezto commit - 1d0bee6

Previous version that I believe worked: f236344

Also, I use the paradox theme, which may lend more credence to the multi-line prompt bit that was brought up by @leshow.

@belak
Copy link
Collaborator

belak commented Oct 20, 2017

This is curious... here's what I've tried to reproduce this:

Using iTerm

  • System zsh (5.3) on High Sierra on 1d0bee6
  • System zsh (5.3) on High Sierra on 25d8db3
  • Homebrew zsh (5.4.2) on High Sierra on 1d0bee6
  • Homebrew zsh (5.4.2) on High Sierra on 25d8db3

All of these were tested with my personal config (with the prompt changed to pure) and the config from #1488 (comment) and I wasn't able to get this to reproduce with any of them.

I'm at a loss since I haven't been able to reproduce this. I'm curious if anyone here runs into this on 5e295b0 since this is the last commit before the prompt_sp changes which were introduced because of an unofficially breaking change in zsh 5.4.1.

I would be happy to help people debug this... easiest way to get a hold of me during the day would be to message me (I'm belak on Freenode) but if you don't use IRC, we might be able to work something else out.

@leshow
Copy link

leshow commented Oct 20, 2017

I said I'd report back and kind of forgot. I do not have this issue at home on my archlinux box, so I'm not sure what the culprit is. I do however have an ssh bug that I filed separately. The new init.zsh for ssh doesn't seem to agree with non-gui setups. Sorry to hijack.

Edit: definitely nothing to do with 5e295b0 here, I hadn't updated in about 6 months and just updated this week.

@josiahwiebe
Copy link

I just wiped my config and pulled a fresh copy of Prezto – still experiencing the same issue with the latest version.

@belak
Copy link
Collaborator

belak commented Oct 20, 2017

@leshow I mentioned that commit because it's the last one before before a prompt related change... So I thought the next commit could have been a culprit. I do understand you were on an older commit.

If anyone has a known good commit and can do a bisect, that would also be helpful.

@johnpneumann
Copy link
Collaborator

Tried to reproduce on something other than Mac OS:

  • Ubuntu: 16.04.3
  • zsh version: 5.1.1
  • prezto commit: 1098644

I was unable to reproduce this issue on there. I also tested this on Mac OS
with the latest version and tested on zsh 5.3 and 5.4.2 and the issue persists.
It's interesting that it doesn't happen on anything except what appears to be
Mac OS. Has anyone tried any other os or configuration?

@johnpneumann
Copy link
Collaborator

Spent some time on this today and boy am I ashamed. So for everyone who's in this
thread here's the issue:

A long long time ago in issue #1245 there was a story of how there was a regression
in zsh version 5.3.1. What's great about that is that the version shipped with
High-Sierra identifies as 5.3 with zsh --version, which has also been identified
with having the issue. Neat! So here's what you need to do:

Step 1: brew install zsh zsh-completions
Step 2: Run this

sudo tee -a /etc/shells >/dev/null <<EOF
/usr/local/bin/zsh
EOF

Step 3: chsh -s /usr/local/bin/zsh

Or you can replace all of those hardcoded paths to /usr/local/bin/zsh with
$(which zsh) in a new shell (or the same one - live dangerously my friends), but
the hardcoded paths work.

So to sum the issue up: This is not a prezto problem, but a problem with zsh that's
been noted already and fixed (?). The zsh version that's shipped with High Sierra
is the problem.

That being said: Do we want to make a note somewhere for Mac OS users to verify that
they're not using anything in the 5.3 line? Or should we look to update multi-line
themes in some way that's compatible with the changes?

@belak
Copy link
Collaborator

belak commented Oct 24, 2017

Thanks for looking into it! I vaguely remember that issue, but it would have taken me a while to find it again.

If it's possible to add a hack to work around this, I'd like to do that... however, recommending the latest version of zsh seems like a reasonable alternative. It may also be worth compiling a list somewhere with breaking changes in zsh (like the prompt crap in 5.4.1 and this) so we can find this stuff easier in the future.

@josiahwiebe
Copy link

Do we know if macOS Sierra also shipped with 5.3? I know I had this issue before updating to High Sierra.

I updated zsh using the above instructions and it seemed to fix the issue. Thanks @johnpneumann!

@belak
Copy link
Collaborator

belak commented Oct 24, 2017

Looks like 5.2 on Sierra.

% /bin/zsh --version
zsh 5.2 (x86_64-apple-darwin16.0)

@johnpneumann
Copy link
Collaborator

@belak - We could definitely add a hack in here for this using the pre-prompt
print where the first line basically just gets printed out before the actual
prompt does. The only issue I have with doing that is that it's going to be
specific to versions of zsh that are affected by this and it can create either
fragmentation within prezto where we're supporting every version of zsh that's
out there and dealing with bugs that crop up from upstream issues, which sounds
like a bad idea. That being said, I definitely see value in doing something
about it, because I can only imagine how many folks are going to be affected by
this as OS' continue to upgrade versions (eg. Ubuntu 16.04 is on 5.1, which means
if they upgrade to 5.3 for their next LTS release, that's gonna be 5 years of
issues that come up). However, I don't know what that something is.

In re: compiling a list - We should definitely expand the documentation to
better indicate known-issues, workarounds and things that are known that there
are no workarounds for.

@josiahwiebe - Glad it worked out. Definitely made my evening a bit better. :)

Additional thoughts on the issue of zsh versions eg. rambling thoughts

Does anyone know what the state of differing zsh versions are across the
OS landscape? Or can folks who have an OS that they do know of who are in this
thread comment with the zsh version that came with their OS? Maybe we can figure
out what the baseline is from that and determine what it is we want to do from
there.

Ideally we'd do some type of pre-check that determines if the version of zsh
that's being used has the particular issue and then set a flag that basically
tells prompts that the zsh version being used will cause issues with two-line
prompts. From there we can actually allow the theme developers to handle how
they'd like to address the issue. For any prompts that are included in prezto,
we'll obviously need to sort it out ourselves, so we can spec that out,
divide and conquer. Maybe there's an easier way of dealing with multi-line
prompts than providing hacks, but nothing is coming to mind ATM.

It might be good to actually ask some of the theme developers what their
thoughts are and how they've handled it thus far, since I can't imagine we're the
only ones affected by issues like this. What about zim and oh-my-zsh? Have
they done anything in regards to this issue? I know that oh-my-zsh does prompts
differently than we do, but I'd imagine they were affected as well.

@belak
Copy link
Collaborator

belak commented Oct 24, 2017

One thing worth noting: the lowest version we officially support has traditionally come from the oldest version of Debian that's still supported. I think the current minimum comes from either RHEL or CentOS 6 (I can't remember which, but it was a recent PR).

@josiahwiebe
Copy link

Interesting. I've made no changes since updating my zsh version and the issue has resurfaced. ¯_(ツ)_/¯

@belak belak added the Upstream label Nov 28, 2017
@DragosDumitrache
Copy link

Latest version of ZSH still seems to suffer from it. I began looking into it, came across this issue and a similar one #1512, as well as the one referenced above #1245 . Has anyone had a go at modifying themes to see whether that would help?

@belak
Copy link
Collaborator

belak commented Jan 29, 2018

There was a fix mentioned by the wizards working on pure (sindresorhus/pure#376 (comment)) but I haven't been able to take the time and figure out why that fixes the issue. If anyone manages to port fixes for other themes in prezto, please feel free to submit pull requests.

@DragosDumitrache
Copy link

@belak Thanks for pointing to that issue. I actually gave that a go, but it did not fix the pure prompt at all. Will keep at it and post here if I get anywhere with it.

@belak belak removed the Upstream label Jan 31, 2018
@belak
Copy link
Collaborator

belak commented Jan 31, 2018

I'm removing the upstream label for now since I believe we've had reports of other themes in prezto seeing the same issue.

@DragosDumitrache
Copy link

Silly me, even though I had the latest zsh version, it wasn't actually being used, my $SHELL var still pointed to the 5.3 version of it. Fixing that seems to have fixed the tab eating away one line of the prompt. The fix on pure didn't seem to be doing anything, however.

@johnpneumann
Copy link
Collaborator

Ok. So I just tested this on Sierra and it has been fixed. I'm not sure if it was fixed in #1547, but my assumption is that it was. I tested with the following options:

vagrant@This-MacBook-Pro ~ ❯❯❯ sw_vers -productVersion
10.12.6
vagrant@This-MacBook-Pro ~ ❯❯❯ zsh --version
zsh 5.2 (x86_64-apple-darwin16.0)
vagrant@This-MacBook-Pro ~ ❯❯❯ PROMPT=$'${SSH_TTY:+"%F{9}%n%f%F{7}@%f%F{3}%m%f "}%F{6}${_prompt_sorin_pwd}%(!. %B%F{1}#%f%b.)\n${editor_info[keymap]} '

vagrant@This-MacBook-Pro ~
 ❯❯❯ ls Downloads/
 -- files --
Desktop/    Documents/  Downloads/  Library/    Movies/     Music/      Pictures/   Public/

I hit tab 3 times, which is why it's on Downloads. If anyone can confirm this, I'd appreciate it and we can close this out.

@ngphadke
Copy link

I can confirm that it is still present on Mojave (10.14) with zsh --version giving 5.3
Followed the instructions by @johnpneumann and they work perfectly

@juanibiapina
Copy link

Still present in zsh 5.7.1 (x86_64-apple-darwin17.7.0) installed with homebrew

@ngphadke
Copy link

@juanibiapina if its still a problem see @johnpneumann's solution. That works like a charm.

@juanibiapina
Copy link

Is this the solution to use zsh from brew and include it in /etc/shells? That's my default setup for many years.

@johnpneumann
Copy link
Collaborator

What prompt are you using? What's the version of prezto?

@juanibiapina
Copy link

Sorry about the confusion, this is not related to prezto. It's still a zsh bug.

@jef
Copy link

jef commented Aug 31, 2019

Sorry about the confusion, this is not related to prezto. It's still a zsh bug.

What seems to be the problem with zsh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants