JetBrains / jediterm

Pure Java Terminal Emulator. Works with SSH and PTY.
GNU Lesser General Public License v3.0
675 stars 171 forks source link

use escape sequence to change cursor shape inside zsh causes character under the cursor becomes invisible #255

Open zyf0330 opened 2 years ago

zyf0330 commented 2 years ago

I have these codes to change cursor shape inside .zshrc

function zle-line-init zle-keymap-select {
  if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then
    echo -ne '\e[1 q'
  elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || [[ $1 = 'beam' ]]; then
    echo -ne '\e[5 q'
  fi
}
zle -N zle-line-init
zle -N zle-keymap-select
bindkey -M viins 'jk' vi-cmd-mode

In the WebStorm terminal, when I enter viins mode by press i or vicmd mode by press jk, character under the cursor becomes invisible. After cursor moving, it becomes visible again. But if I enter vicmd mode by press esc or ctrl-[, it doesn't.