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

if the prompt is more than one line, deleting a text object moves the prompt up #1

Open
doy opened this issue Nov 2, 2013 · 8 comments

Comments

@doy
Copy link

doy commented Nov 2, 2013

I use a multi-line prompt, and if i do something like "da(", the line above my prompt is deleted, and the entire prompt is moved up a line.

@hchbaw
Copy link
Owner

hchbaw commented Nov 3, 2013

Thank you for your report.

I'm using multi-line prompt, too. But I cannot reproduce here.
Please show your zsh setup.

@doy
Copy link
Author

doy commented Nov 3, 2013

So I also have RPS1 configured to show the current editing mode, and disabling that configuration fixes things. I can reproduce the issue with this bit of additional configuration:

function zle-keymap-select () {
    zle reset-prompt
}
zle -N zle-keymap-select

and then using c (not d, I was mistaken there) with a text object in the prompt.

@hchbaw
Copy link
Owner

hchbaw commented Nov 3, 2013

Thank you very much reporting the detail! I confirmed.

Ugh... Some multi-line prompt + the zle reset-prompt yields that even the zsh's builtin vi-change causes this "line up" behavior. Sorry, I cannot find any workarounds at the moment.

@hchbaw
Copy link
Owner

hchbaw commented Nov 4, 2013

Here is a workaround.

zle-keymap-select () {
  setopt localoptions no_ksharrays
  local old="${@[2]-main}"
  local new="$KEYMAP"
  { [[ "$old" == opp ]] || [[ "$new" == opp ]] } && return
  # TODO: please modify the prompt here!
  zle reset-prompt
}
zle -N zle-keymap-select

This cannot distinguish the "operator-pending-mode"-ish from the others by modifying the prompts though.
Sorry for the inconvenience.

@hchbaw
Copy link
Owner

hchbaw commented Nov 4, 2013

Rezised version here.

zle-keymap-select () {
  setopt localoptions no_ksharrays
  [[ "${@[2]-}" == opp ]] && return
  # TODO: please modify the prompt here!
  zle reset-prompt
}
zle -N zle-keymap-select

It's able to distinguish the "opp" from the others for now.
Sorry for the inconveniences.

@doy
Copy link
Author

doy commented Nov 4, 2013

That seems to work - thanks!

doy added a commit to doy/conf that referenced this issue Nov 4, 2013
ryanpetrello added a commit to ryanpetrello/dotfiles that referenced this issue Sep 3, 2014
Additionally, work around a zsh + vim mode + opp.zsh bug:
hchbaw/opp.zsh#1
zhimsel added a commit to zhimsel/dotfiles that referenced this issue Mar 3, 2015
Found here: hchbaw/opp.zsh#1
Config borrowed from here: ryanpetrello/dotfiles:ddfdcc95
Additionally, it allows for the cursor shape to change based on which
mode you are in (huzzah!)
@haifengkao
Copy link

The above fix doesn't work for me. 'ciw' still deletes the line above

@danijar
Copy link

danijar commented Dec 19, 2015

I was able to fix the same issue by getting rid of the \n that was unnecessary since I already filled the whole line.

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

4 participants