aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2024-12-17 07:11:41 -0600
committerGitHub <noreply@github.com>2024-12-17 07:11:41 -0600
commit0dd933265ff2e64786fd30f949e767e10f401519 (patch)
treec6dfd63bb7ff0d83f2d248e9f3f233bd446604f4 /runtime
parentdf367cf91cdd805d907f758cb295c6b36fe39480 (diff)
downloadrneovim-0dd933265ff2e64786fd30f949e767e10f401519.tar.gz
rneovim-0dd933265ff2e64786fd30f949e767e10f401519.tar.bz2
rneovim-0dd933265ff2e64786fd30f949e767e10f401519.zip
feat(terminal)!: cursor shape and blink (#31562)
When a terminal application running inside the terminal emulator sets the cursor shape or blink status of the cursor, update the cursor in the parent terminal to match. This removes the "virtual cursor" that has been in use by the terminal emulator since the beginning. The original rationale for using the virtual cursor was to avoid having to support additional UI methods to change the cursor color for other (non-TUI) UIs, instead relying on the TermCursor and TermCursorNC highlight groups. The TermCursor highlight group is now used in the default 'guicursor' value, which has a new entry for Terminal mode. However, the TermCursorNC highlight group is no longer supported: since terminal windows now use the real cursor, when the window is not focused there is no cursor displayed in the window at all, so there is nothing to highlight. Users can still use the StatusLineTermNC highlight group to differentiate non-focused terminal windows. BREAKING CHANGE: The TermCursorNC highlight group is no longer supported.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/deprecated.txt4
-rw-r--r--runtime/doc/news.txt11
-rw-r--r--runtime/doc/options.txt6
-rw-r--r--runtime/doc/syntax.txt2
-rw-r--r--runtime/doc/terminal.txt2
-rw-r--r--runtime/doc/vim_diff.txt1
-rw-r--r--runtime/lua/vim/_meta/options.lua6
-rw-r--r--runtime/syntax/vim.vim2
8 files changed, 25 insertions, 9 deletions
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index ab9c0b2ce8..592b6389c4 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -38,6 +38,10 @@ DIAGNOSTICS
- The "cursor_position" parameter of |vim.diagnostic.JumpOpts| is renamed to
"pos"
+HIGHLIGHTS
+• *TermCursorNC* As of Nvim 0.11, unfocused |terminal| windows no
+ longer have any cursor.
+
TREESITTER
• *TSNode:child_containing_descendant()* Use
|TSNode:child_with_descendant()| instead; it is identical except that it can
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 5e70d75cfd..ad0835e80f 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -87,6 +87,11 @@ EVENTS
• |vim.ui_attach()| callbacks for |ui-messages| `msg_show` events are executed in
|api-fast| context.
+HIGHLIGHTS
+
+• |TermCursorNC| is removed and no longer supported. Unfocused terminals no
+ longer have a cursor.
+
LSP
• Improved rendering of LSP hover docs. |K-lsp-default|
@@ -281,6 +286,12 @@ TERMINAL
'scrollback' are not reflown.
• The |terminal| now supports OSC 8 escape sequences and will display
hyperlinks in supporting host terminals.
+• The |terminal| now uses the actual cursor, rather than a "virtual" cursor.
+ This means that escape codes sent by applications running in a terminal
+ buffer can change the cursor shape and visibility. However, it also
+ means that the |TermCursorNC| highlight group is no longer supported: an
+ unfocused terminal window will have no cursor at all (so there is nothing to
+ highlight).
TREESITTER
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 84f0bfe141..c2ed19f34f 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -2977,7 +2977,7 @@ A jump table for the options with a short description can be found at |Q_op|.
An |OptionSet| autocmd can be used to set it up to match automatically.
*'guicursor'* *'gcr'* *E545* *E546* *E548* *E549*
-'guicursor' 'gcr' string (default "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20")
+'guicursor' 'gcr' string (default "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20,t:block-blinkon500-blinkoff500-TermCursor")
global
Configures the cursor style for each mode. Works in the GUI and many
terminals. See |tui-cursor-shape|.
@@ -3005,6 +3005,7 @@ A jump table for the options with a short description can be found at |Q_op|.
ci Command-line Insert mode
cr Command-line Replace mode
sm showmatch in Insert mode
+ t Terminal mode
a all modes
The argument-list is a dash separated list of these arguments:
hor{N} horizontal bar, {N} percent of the character height
@@ -3021,7 +3022,8 @@ A jump table for the options with a short description can be found at |Q_op|.
cursor is not shown. Times are in msec. When one of
the numbers is zero, there is no blinking. E.g.: >vim
set guicursor=n:blinkon0
-< - Default is "blinkon0" for each mode.
+<
+ Default is "blinkon0" for each mode.
{group-name}
Highlight group that decides the color and font of the
cursor.
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index c5d3422f62..df4d0f7260 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -5162,8 +5162,6 @@ EndOfBuffer Filler lines (~) after the end of the buffer.
By default, this is highlighted like |hl-NonText|.
*hl-TermCursor*
TermCursor Cursor in a focused terminal.
- *hl-TermCursorNC*
-TermCursorNC Cursor in an unfocused terminal.
*hl-ErrorMsg*
ErrorMsg Error messages on the command line.
*hl-WinSeparator*
diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index 5a1421f430..f9536c2f0c 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -101,7 +101,7 @@ Configuration *terminal-config*
Options: 'modified', 'scrollback'
Events: |TermOpen|, |TermEnter|, |TermLeave|, |TermClose|
-Highlight groups: |hl-TermCursor|, |hl-TermCursorNC|
+Highlight groups: |hl-TermCursor|
Terminal sets local defaults for some options, which may differ from your
global configuration.
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index bfef5d5d4a..c93d2b119e 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -325,7 +325,6 @@ Highlight groups:
- |hl-MsgSeparator| highlights separator for scrolled messages
- |hl-Substitute|
- |hl-TermCursor|
-- |hl-TermCursorNC|
- |hl-WinSeparator| highlights window separators
- |hl-Whitespace| highlights 'listchars' whitespace
- |hl-WinBar| highlights 'winbar'
diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua
index 63bf0df5f6..e5cea884c5 100644
--- a/runtime/lua/vim/_meta/options.lua
+++ b/runtime/lua/vim/_meta/options.lua
@@ -2783,6 +2783,7 @@ vim.go.gp = vim.go.grepprg
--- ci Command-line Insert mode
--- cr Command-line Replace mode
--- sm showmatch in Insert mode
+--- t Terminal mode
--- a all modes
--- The argument-list is a dash separated list of these arguments:
--- hor{N} horizontal bar, {N} percent of the character height
@@ -2802,7 +2803,8 @@ vim.go.gp = vim.go.grepprg
--- ```vim
--- set guicursor=n:blinkon0
--- ```
---- - Default is "blinkon0" for each mode.
+---
+--- Default is "blinkon0" for each mode.
--- {group-name}
--- Highlight group that decides the color and font of the
--- cursor.
@@ -2848,7 +2850,7 @@ vim.go.gp = vim.go.grepprg
---
---
--- @type string
-vim.o.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20"
+vim.o.guicursor = "n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20,t:block-blinkon500-blinkoff500-TermCursor"
vim.o.gcr = vim.o.guicursor
vim.go.guicursor = vim.o.guicursor
vim.go.gcr = vim.go.guicursor
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 3ad04e2957..2a4bb2c8c9 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -63,7 +63,7 @@ syn keyword vimGroup contained Comment Constant String Character Number Boolean
syn keyword vimHLGroup contained ErrorMsg IncSearch ModeMsg NonText StatusLine StatusLineNC EndOfBuffer VertSplit DiffText PmenuSbar TabLineSel TabLineFill Cursor lCursor QuickFixLine CursorLineSign CursorLineFold CurSearch PmenuKind PmenuKindSel PmenuMatch PmenuMatchSel PmenuExtra PmenuExtraSel Normal Directory LineNr CursorLineNr MoreMsg Question Search SpellBad SpellCap SpellRare SpellLocal PmenuThumb Pmenu PmenuSel SpecialKey Title WarningMsg WildMenu Folded FoldColumn SignColumn Visual DiffAdd DiffChange DiffDelete TabLine CursorColumn CursorLine ColorColumn MatchParen StatusLineTerm StatusLineTermNC CursorIM LineNrAbove LineNrBelow
syn match vimHLGroup contained "\<Conceal\>"
syn keyword vimOnlyHLGroup contained Menu Scrollbar ToolbarButton ToolbarLine Tooltip VisualNOS
-syn keyword nvimHLGroup contained FloatBorder FloatFooter FloatTitle MsgSeparator NormalFloat NormalNC Substitute TermCursor TermCursorNC VisualNC Whitespace WinBar WinBarNC WinSeparator
+syn keyword nvimHLGroup contained FloatBorder FloatFooter FloatTitle MsgSeparator NormalFloat NormalNC Substitute TermCursor VisualNC Whitespace WinBar WinBarNC WinSeparator
"}}}2
syn case match