zsh-vi-mode icon indicating copy to clipboard operation
zsh-vi-mode copied to clipboard

zvm_cursor_style errors out every return

Open klmanion opened this issue 3 years ago • 14 comments

General information

  • konsole 21.08.1 - and, xterm-370
  • FreeBSD 13.0-RELEASE-p3
  • zinit
  • zsh 5.8
  • zvm 0.8.5

Problem description

zvm_cursor_style:33: failed to compile regex: trailing backslash ()

Reproduction steps

  1. source attached zshrc
  2. will occur after hitting return (but not before, i.e. not right when terminal loads)

Expected behavior

error shown in prob. desc. occurs immediately after the command line. There is no newline before it. The error is itself followed by a newline. There is no extraneous trailing newline occurring after command output.

Occurs regardless of whether ZVM_CURSOR_STYLE_ENABLED is set to true or false

zprofile.txt zshrc.txt

klmanion avatar Jan 21 '22 03:01 klmanion

The error is in if [[ $old_style =~ '\e\][0-9]+;.+\a' ]]; then in zsh-vi-mode.zsh:3047

anupamsr avatar Sep 19 '22 06:09 anupamsr

I'm hitting this, too 😢

juliekoubova avatar Jun 11 '23 20:06 juliekoubova

@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075

anupamsr avatar Jun 12 '23 02:06 anupamsr

Hi @klmanion,

Thanks for your reporting, may I know if this issue is still existing in using the latest version?

Thanks & Regards

jeffreytse avatar Jul 24 '23 05:07 jeffreytse

@jeffreytse I am on freebsd and can verify that the issue still exists with the latest version,

anupamsr avatar Jul 27 '23 18:07 anupamsr

Hi @anupamsr

Currently, I can't reproduce your issue on my local env. Could we have a co-debugging on your env?

Thanks & Regards

jeffreytse avatar Jul 31 '23 03:07 jeffreytse

Hello! Well, apparently zsh on FreeBSD does not support PCRE by default, as in, the following shall fail:

setopt re_match_pcre

A practical approach to enable PCRE support is to reinstall via the ports tree with the respective flag enabled:

cd /usr/ports/shells/zsh

# enable the "pcre" option...
make config

# reinstall the shell...
make reinstall clean

Thus you can issue the setopt again:

setopt re_match_pcre

With the module in place the error messages are gone.

On macOS (homebrew) and Linux (DNF/Fedora), zsh supports PCRE by default, apparently this issue will only occur on FreeBSD using pre-compiled packages.

otaviof avatar Sep 16 '23 02:09 otaviof

zvm_cursor_style:33: failed to compile regex: trailing backslash () i got same error on termux. Which line to delete or comment.

@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075

wahaj4311 avatar Sep 23 '23 20:09 wahaj4311

zvm_cursor_style:33: failed to compile regex: trailing backslash () i got same error on termux. Which line to delete or comment.

@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075

https://github.com/jeffreytse/zsh-vi-mode/blob/ea1f58ab9b1f3eac50e2cde3e3bc612049ef683b/zsh-vi-mode.zsh#L3222-L3224

The three lines of if judgment code from line 3222 to line 3224.

But here comes the question, is it caused by regularity or something else?

daiaji avatar Nov 22 '23 14:11 daiaji

@daiaji thanks @otaviof I tried compiling zsh from port using libpcre but still faced the same issue.

anupamsr avatar Dec 20 '23 05:12 anupamsr

Hi @anupamsr, I'd love to help settle this issue, but currently I can not reproduce it in my local.

jeffreytse avatar Dec 20 '23 05:12 jeffreytse

zvm_cursor_style:33: failed to compile regex: trailing backslash () i got same error on termux. Which line to delete or comment.

@juliekoubova I solved this by simply removing this 3 line if block, currently on line 3075

I also got this error in termux. I fixed it by just adding setopt re_match_pcre to .zshrc as @otaviof suggested. I did not have to recompile anything.

@anupamsr As for freebsd, you might try recompiling libpcre with different config options? That's the only relevant difference I can find between the termux version, the archlinux version (which works without the zsh option), and the port version.

For reference, Archlinux https://gitlab.archlinux.org/archlinux/packaging/packages/pcre/-/blob/8.45-4/PKGBUILD#L40

Termux-pacman https://github.com/termux-pacman/termux-packages/blob/master/packages/pcre/build.sh#L13

FreeBSD https://cgit.freebsd.org/ports/tree/devel/pcre/Makefile?id=56fcffd8655a1cc30676ff357af80be1225b4c34#n23

Hope that helps

rosetintedcheeks avatar Dec 28 '23 16:12 rosetintedcheeks

I did not have this problem, but when I set -o GLOB_SUBST then I have almost the same error after every <CR>, <Up>, or <Down>: zvm_cursor_style:38: bad pattern: \e[0 q. I also get zvm_update_repeat_commands:42: bad pattern: ^[[A

NotRexButCaesar avatar Feb 11 '24 19:02 NotRexButCaesar