[vim/vim] win32: Set cursor style on Windows Terminal (PR #11028)

453 views
Skip to first unread message

K.Takata

unread,
Sep 1, 2022, 3:03:29 AM9/1/22
to vim/vim, Subscribed

Close #6576

Win32 version of Vim supports changing cursor shape by
mch_set_cursor_shape(). However, this didn't work on Windows Terminal.

This patch supports changing cursor shape on Windows Terminal.
By default, the default shape (that is set by the terminal) will be used
on normal mode, and underline will be used on insert mode.

This also allows to customize the cursor shape by setting 't_SI', 't_EI'
and so on.

Sample setting:

" Change cursor shape
" Note: This should be set after `set termguicolors` or `set t_Co=256`.
if &term =~ 'xterm' || &term == 'win32'
  " Use DECSCUSR escape sequences
  let &t_SI = "\e[5 q"    " blink bar
  let &t_SR = "\e[3 q"    " blink underline
  let &t_EI = "\e[1 q"    " blink block
  let &t_ti .= "\e[1 q"   " blink block
  let &t_te .= "\e[0 q"   " default (depends on terminal, normally blink block)
endif

Win32 version of Vim uses its own terminal codes. However, this passes
through DECSCUSR escape sequences to the terminal. This allows to use
the same settings on Windows and Unix (as shown above).

Note: Win32 version of Vim will reset 't_SI', 't_EI' and other terminal
codes when set termguicolors or set t_Co=256 is used. So, the above
setting should be written after them.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/11028

Commit Summary

  • 0a4016c win32: Set cursor style on Windows Terminal

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11028@github.com>

codecov[bot]

unread,
Sep 1, 2022, 3:12:30 AM9/1/22
to vim/vim, Subscribed

Codecov Report

Merging #11028 (0a4016c) into master (5d09a40) will decrease coverage by 81.34%.
The diff coverage is n/a.

@@             Coverage Diff             @@

##           master   #11028       +/-   ##

===========================================

- Coverage   81.64%    0.29%   -81.35%     

===========================================

  Files         162      152       -10     

  Lines      187778   173442    -14336     

  Branches    42734    39916     -2818     

===========================================

- Hits       153320      520   -152800     

- Misses      21979   172865   +150886     

+ Partials    12479       57    -12422     
Flag Coverage Δ
huge-clang-none ?
huge-gcc-none ?
huge-gcc-testgui ?
huge-gcc-unittests 0.29% <ø> (ø)
linux 0.29% <ø> (-82.16%) ⬇️
mingw-x64-HUGE ?
mingw-x64-HUGE-gui ?
windows ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/float.c 0.00% <0.00%> (-98.44%) ⬇️
src/sha256.c 0.00% <0.00%> (-96.45%) ⬇️
src/gui_gtk_f.c 0.00% <0.00%> (-94.72%) ⬇️
src/arabic.c 0.00% <0.00%> (-94.57%) ⬇️
src/crypt_zip.c 0.00% <0.00%> (-94.12%) ⬇️
src/typval.c 0.00% <0.00%> (-93.24%) ⬇️
src/blob.c 0.00% <0.00%> (-92.48%) ⬇️
src/eval.c 0.00% <0.00%> (-92.29%) ⬇️
src/debugger.c 0.00% <0.00%> (-92.23%) ⬇️
src/vim9expr.c 0.00% <0.00%> (-92.18%) ⬇️
... and 146 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11028/c1233844797@github.com>

Bram Moolenaar

unread,
Sep 1, 2022, 8:21:04 AM9/1/22
to vim/vim, Subscribed

Closed #11028 via df5320c.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/11028/issue_event/7304726603@github.com>

Reply all
Reply to author
Forward
0 new messages