eendroroy / alien

An asynchronous zsh prompt
https://eendroroy.github.io/alien
MIT License
307 stars 45 forks source link

First character in command is repeated when tab is hit #26

Closed blaues0cke closed 5 years ago

blaues0cke commented 5 years ago

What is the current behavior? In this gif I type "l", then "tab" and then I hit "backspace". I expect that then the "l" is still green and I can type the "s" (or whatever I want). But the "l" is repeated when I type "s".

2019-06-30 00 49 31

I cannot reproduce this with other themes like enysdovhan/spaceship-prompt

Environment:

eendroroy commented 5 years ago

Could you please share your theme settings?

blaues0cke commented 5 years ago

@eendroroy For sure. I played around a bit, so this is not the in the cleanest format:

antigen theme eendroroy/alien alien

export ALIEN_THEME="green"
export ALIEN_PROMPT_SYM=
export ALIEN_SECTIONS_LEFT=(
  //exit
  #battery
  #user
  path
  vcs_branch
  #vcs_status:async
  #vcs_dirty:async
  #newline
  ssh
  venv
  prompt
)

export ALIEN_SECTION_TIME_FORMAT=%H:%M:%S
export ALIEN_SECTIONS_RIGHT=(
  time
  user
)

antigen apply

(also switched the //exit to #exit while I am typing this, but this did not fix the issue)

betaboon commented 5 years ago

i have tried to reproduce this with xterm and with my regular terminal emulator alacritty but could not reproduce the behavior visible in the gif. i dont have a macos-device available for testing here.

I am suspecting that the macos-terminal doesnt like the way we move RPROMPT to the same line.

or it doesnt play ball with another zsh plugin oO

could you please provide $PROMPT and $RPROMPT? could you try with another terminal emulator?

eendroroy commented 5 years ago

@betaboon

https://github.com/eendroroy/alien/blob/4aa0f312aa1e5f5cc8722b3e2d22f9e7423dec58/modules/prompt.zsh#L59 Above line is causing the issue when there is content in right prompt.

If we replace it with echo -ne "%1{ %}" ("%1{<space><space>%}" => "%1{<space>%}"; single space) the issue seems to be gone in mac (iTerm2)

Could you please check if it works in linux?

betaboon commented 5 years ago

@eendroroy works for me. but: the reason for putting two spaces there was to remove the space right of RPROMPT (which might just occur in linux), but that seems to cause a bug in iterm2.

eendroroy commented 5 years ago

I have changed it to 1 space. Although it shifts the right prompt to the left by 1 character, I guess it still is usable.

betaboon commented 5 years ago

@blaues0cke does this solve your problem ?

blaues0cke commented 4 years ago

Better late than never: This fixed it! :-)