zsh-autocomplete icon indicating copy to clipboard operation
zsh-autocomplete copied to clipboard

Loading select-word-style breaks .autocomplete.zle-flags

Open knu opened this issue 2 years ago • 2 comments

Environment

apple darwin21.3.0 /usr/local/bin/zsh /usr/local/bin/zsh zsh-5.9-0-g73d3173 f52f45a (HEAD, origin/main, origin/HEAD, main) Change precmd to chpwd for zlua

  • Operating system: macOS
  • Terminal emulator: iTerm2

Steps to reproduce

  1. Run autoload -Uz select-word-style; select-word-style normal
  2. Type a few words (aaa bbb ccc)
  3. Go to the beginning of the line
  4. Do kill-word (M-d) twice
  5. Paste (C-y)
  6. See only the last word ( bbb) get pasted instead of the last two concatenated (aaa bbb)

Without loading either select-word-style or zsh-autocomplete, I get the expected result.

knu avatar Jul 03 '22 02:07 knu

@knu Thanks for reporting. Since you know where the problem is, would you mind submitting a pull request? 🙂

marlonrichert avatar Jul 11 '22 12:07 marlonrichert

@marlonrichert Unfortunately I'm yet to identify where the problem is. As long as I observe, select-word-style redefines the widgets kill-word/backward-kill-word but they should still match *kill-*~vi-*, so the "kill" flag should be set by .autocomplete.zle-flags. 🤔

knu avatar Jul 12 '22 09:07 knu

It's a bug in kill-word-match. It relies on $LASTWIDGET to check if the last keystroke executed a kill command, but that doesn't work when a zle-line-pre-redraw hook widget has been installed. Please report it on the official zsh-workers mailing list.

marlonrichert avatar Aug 17 '22 12:08 marlonrichert

As an alternative to select-word-style, I would recommend my Zsh Edit plugin. It works a lot better than select-word-style in general.

marlonrichert avatar Aug 17 '22 12:08 marlonrichert