fast-syntax-highlighting icon indicating copy to clipboard operation
fast-syntax-highlighting copied to clipboard

[bug]: Input mangling when using command substitution

Open hcwesson opened this issue 2 years ago • 1 comments

Describe the bug

In certain scenarios, command substitution with $() is mangled when f-s-h is active. The opening bracket is duplicated, and attempting to delete the additional bracket or input additional characters results in duplicate character deletion or addition, respectively.

Steps to reproduce

  1. Enable f-s-h
  2. Attempt to type the following in the terminal: git diff @ $(echo "test") ; this should trigger the behavior following $(.

Expected behavior

The entered command string should be input as typed.

Screenshots and recordings

Behavior with f-s-h enabled: f-s-h_cmdsub_bug

Behavior after disabling f-s-h: no_f-s-h_cmdsub

Operating System & Version

linux-gnu | debian | x86_64 | x86_64 | x86_64 unknown

Zsh version

zsh 5.9 (x86_64-debian-linux-gnu)

Terminal emulator

various (see add. context table); xterm-256color, screen-256color

If using WSL on Windows, which version of WSL

WSL 2

Additional context

Reproduced in several environments:

OS Terminal Emulator Plugin Framework $TERM
OSX iTerm2 oh-my-zsh xterm-256color, screen-256color
Win10/WSL2 (Ubuntu 20.04) mintty/wsltty, Windows Terminal oh-my-zsh, none xterm-256color, screen-256color
Debian 11 "Buster" xterm, gnome-terminal none xterm-256color

hcwesson avatar Jun 04 '22 21:06 hcwesson

I'm experiencing the same issue, specifically on opening a parenthesis or square bracket after a hyphen on the git command:

git -((ddoouubbllee  cchhaarraacctteerrss
git -[[ddoouubblleedd      
git -beforeparens((aafftteerr 
git -no (problem) if there's a space after the hyphen
git -{no problem with braces}

Cannot reproduce OP's example, though.

ghost avatar Jun 21 '22 15:06 ghost