macvim-dev / macvim-dev/macvim

Terminal mode buffers do not implement Xterm control sequences to change cursor shape correctly

Đang mở
#1,215 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Vim Script
Star
7.9k
Fork
691
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Describe the bug
According to the VIM documentation in terminal.txt under terminal-cursor-style:

By default the cursor in the terminal window uses a not blinking block. The
normal xterm escape sequences can be used to change the blinking state and the
shape. Once focus leaves the terminal window Vim will restore the original
cursor.

These control sequences are defined as follows (source: XTerm Control Sequences ):

CSI Ps SP q
          Set cursor style (DECSCUSR), VT520.
            Ps = 0  ⇒  blinking block.
            Ps = 1  ⇒  blinking block (default).
            Ps = 2  ⇒  steady block.
            Ps = 3  ⇒  blinking underline.
            Ps = 4  ⇒  steady underline.
            Ps = 5  ⇒  blinking bar, xterm.
            Ps = 6  ⇒  steady bar, xterm.

However, trying these in a terminal inside the GUI of MacVim does not work.

To Reproduce
Detailed steps to reproduce the behavior:

  1. Run mvim --clean
  2. Type :terminal to create a new terminal emulator buffer
  3. Type any of the following commands and press enter:
    • printf '\e[1 q' should turn the cursor into a blinking block, which works;
    • printf '\e[2 q' should turn the cursor into a steady block, which works;
    • printf '\e[3 q' should turn the cursor into a blinking underline, instead the cursor turns invisible;
    • printf '\e[4 q' should turn the cursor into a steady underline, instead the cursor turns invisible;
    • printf '\e[5 q' should turn the cursor into a blinking bar, instead the cursor turns invisible;
    • printf '\e[6 q' should turn the cursor into a steady bar, instead the cursor turns invisible.

Expected behavior
The same steps executed in gvim on Kubuntu 18.04 all work as expected, changing the cursor shapes as prescribed by the definition of the control sequences cited above.

Environment (please complete the following information):

  • Vim version

    :version
    VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 24 2021 14:13:28)
    macOS version - x86_64
    Included patches: 1-3455
    Compiled by GitHub Actions
    Huge version with MacVim GUI.  Features included (+) or not (-):
    +acl               +file_in_path      -mouse_sysmouse    +tag_binary
    +arabic            +find_in_path      +mouse_urxvt       -tag_old_static
    +autocmd           +float             +mouse_xterm       -tag_any_white
    +autochdir         +folding           +multi_byte        -tcl
    -autoservername    -footer            +multi_lang        +termguicolors
    +balloon_eval      +fork()            -mzscheme          +terminal
    +balloon_eval_term +fullscreen        +netbeans_intg     +terminfo
    +browse            +gettext           +num64             +termresponse
    ++builtin_terms    -hangul_input      +odbeditor         +textobjects
    +byte_offset       +iconv             +packages          +textprop
    +channel           +insert_expand     +path_extra        +timers
    +cindent           +ipv6              +perl/dyn          +title
    +clientserver      +job               +persistent_undo   +toolbar
    +clipboard         +jumplist          +popupwin          +transparency
    +cmdline_compl     +keymap            +postscript        +user_commands
    +cmdline_hist      +lambda            +printer           +vartabs
    +cmdline_info      +langmap           +profile           +vertsplit
    +comments          +libcall           +python/dyn        +virtualedit
    +conceal           +linebreak         +python3/dyn       +visual
    +cryptv            +lispindent        +quickfix          +visualextra
    +cscope            +listcmds          +reltime           +viminfo
    +cursorbind        +localmap          +rightleft         +vreplace
    +cursorshape       +lua/dyn           +ruby/dyn          +wildignore
    +dialog_con_gui    +menu              +scrollbind        +wildmenu
    +diff              +mksession         +signs             +windows
    +digraphs          +modify_fname      +smartindent       +writebackup
    +dnd               +mouse             -sodium            -X11
    -ebcdic            +mouseshape        -sound             -xfontset
    +emacs_tags        +mouse_dec         +spell             +xim
    +eval              -mouse_gpm         +startuptime       -xpm
    +ex_extra          -mouse_jsbterm     +statusline        -xsmp
    +extra_search      +mouse_netterm     -sun_workshop      -xterm_clipboard
    -farsi             +mouse_sgr         +syntax            -xterm_save
       system vimrc file: "$VIM/vimrc"
         user vimrc file: "$HOME/.vimrc"
     2nd user vimrc file: "~/.vim/vimrc"
          user exrc file: "$HOME/.exrc"
      system gvimrc file: "$VIM/gvimrc"
        user gvimrc file: "$HOME/.gvimrc"
    2nd user gvimrc file: "~/.vim/gvimrc"
           defaults file: "$VIMRUNTIME/defaults.vim"
        system menu file: "$VIMRUNTIME/menu.vim"
      fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
    Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-u
    nknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -arch x86_64 -arch arm64
    -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Wall -Wextra -Wshadow -Werro
    r -Wno-error=missing-field-initializers -Wno-error=deprecated-declarations -Wno-
    error=unused-function
    Linking: clang -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/li
    byaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L. -fs
    tack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local
    /opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -arch x86_64 -arch arm64 -L/u
    sr/local/lib -o Vim -lm -lncurses -liconv /usr/local/lib/libintl.a -framework Ap
    pKit -fstack-protector -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CO
    RE
    
  • OS: macOS Catalina 10.15.7

  • Terminal: GUI

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện vấn đề với mvim --clean, sau đó so sánh hành vi của các chuỗi CSI Ps SP q được liệt kê với gvim trên một bộ đệm terminal. Theo dõi cách MacVim xử lý các chuỗi kiểu con trỏ terminal, tập trung vào lý do các giá trị 3–6 trở nên vô hình trong khi 1–2 hoạt động. Hoàn thành khi các kiểu gạch chân và thanh, cả nhấp nháy và ổn định, được hiển thị chính xác mà không làm hồi quy các kiểu khối.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
vim
Lĩnh vực
desktop
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.