patch 9.1.1895: OSC terminal response hard to detect
Commit:
https://github.com/vim/vim/commit/8707b7a15b8a22ee4f60e1f9e7d3d417b20e60d2
Author: Foxe Chen <[email protected]>
Date: Sat Nov 1 16:26:18 2025 +0000
patch 9.1.1895: OSC terminal response hard to detect
Problem: OSC terminal response hard to detect
Solution: Add the <OSC> and <xOSC> pseudo keys
(Foxe Chen)
closes: #18660
Signed-off-by: Foxe Chen <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt
index 46aa9428f..828d2852d 100644
--- a/runtime/doc/intro.txt
+++ b/runtime/doc/intro.txt
@@ -1,4 +1,4 @@
-*intro.txt* For Vim version 9.1. Last change: 2025 Oct 12
+*intro.txt* For Vim version 9.1. Last change: 2025 Nov 01
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -450,6 +450,8 @@ notation meaning equivalent decimal
value(s) ~
<Del> delete 127
<CSI> command sequence intro ALT-Esc 155 *<CSI>*
<xCSI> CSI when typed in the GUI *<xCSI>*
+<OSC> operating system command 157 *<OSC>*
+<xOSC> finished OSC response *<xOSC>*
<EOL> end-of-line (can be <CR>, <NL> or <CR><NL>,
depends on system and 'fileformat') *<EOL>*
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 8fd8cbae1..09ba497ef 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -3841,6 +3841,7 @@ $quote eval.txt /*$quote*
<NL> motion.txt /*<NL>*
<Nop> map.txt /*<Nop>*
<Nul> intro.txt /*<Nul>*
+<OSC> intro.txt /*<OSC>*
<PageDown> scroll.txt /*<PageDown>*
<PageUp> scroll.txt /*<PageUp>*
<Plug> map.txt /*<Plug>*
@@ -3961,6 +3962,7 @@ $quote eval.txt /*$quote*
<xHome> term.txt /*<xHome>*
<xHome>-xterm term.txt /*<xHome>-xterm*
<xLeft> term.txt /*<xLeft>*
+<xOSC> intro.txt /*<xOSC>*
<xRight> term.txt /*<xRight>*
<xUp> term.txt /*<xUp>*
= change.txt /*=*
diff --git a/src/keymap.h b/src/keymap.h
index e993e0999..d30097950 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -280,6 +280,7 @@ enum key_extra
, KE_SID = 106 // <SID> special key, followed by {nr};
, KE_ESC = 107 // used for K_ESC
, KE_WILD = 108 // triggers wildmode completion
+ , KE_OSC = 109 // OSC sequence
};
/*
@@ -478,6 +479,7 @@ enum key_extra
#define K_MOUSERIGHT TERMCAP2KEY(KS_EXTRA, KE_MOUSERIGHT)
#define K_CSI TERMCAP2KEY(KS_EXTRA, KE_CSI)
+#define K_OSC TERMCAP2KEY(KS_EXTRA, KE_OSC)
#define K_SNR TERMCAP2KEY(KS_EXTRA, KE_SNR)
#define K_PLUG TERMCAP2KEY(KS_EXTRA, KE_PLUG)
#define K_CMDWIN TERMCAP2KEY(KS_EXTRA, KE_CMDWIN)
diff --git a/src/misc2.c b/src/misc2.c
index 8380e745c..fcbf0dd1c 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1053,6 +1053,7 @@ static struct key_name_entry
{TRUE, NL, STRING_INIT("NewLine"), TRUE},
{TRUE, NL, STRING_INIT("NL"), FALSE},
{TRUE, K_ZERO, STRING_INIT("Nul"), FALSE},
+ {TRUE, OSC, STRING_INIT("OSC"), FALSE},
{TRUE, K_PAGEDOWN, STRING_INIT("PageDown"), FALSE},
{TRUE, K_PAGEUP, STRING_INIT("PageUp"), FALSE},
{TRUE, K_PE, STRING_INIT("PasteEnd"), FALSE},
@@ -1111,6 +1112,7 @@ static struct key_name_entry
{TRUE, K_XF4, STRING_INIT("xF4"), FALSE},
{TRUE, K_XHOME, STRING_INIT("xHome"), FALSE},
{TRUE, K_XLEFT, STRING_INIT("xLeft"), FALSE},
+ {TRUE, K_OSC, STRING_INIT("xOSC"), FALSE},
{TRUE, K_XRIGHT, STRING_INIT("xRight"), FALSE},
{TRUE, K_XUP, STRING_INIT("xUp"), FALSE},
{TRUE, K_ZEND, STRING_INIT("zEnd"), FALSE},
diff --git a/src/term.c b/src/term.c
index 4c365b19b..39005b242 100644
--- a/src/term.c
+++ b/src/term.c
@@ -5933,7 +5933,6 @@ handle_osc(char_u *tp, int len, char_u *key_name, int
*slen)
last_char = ((char_u *)osc_state.buf.ga_data)[osc_state.buf.ga_len - 1];
key_name[0] = (int)KS_EXTRA;
- key_name[1] = (int)KE_IGNORE;
// Read data and append to buffer. If we reach a terminator, then
// finally set the vim var.
@@ -5945,6 +5944,8 @@ handle_osc(char_u *tp, int len, char_u *key_name, int
*slen)
{
osc_state.processing = FALSE;
+ key_name[1] = (int)KE_OSC;
+
ga_concat_len(&osc_state.buf, tp, i + 1 + (tp[i] == ESC));
ga_append(&osc_state.buf, NUL);
*slen = i + 1 + (tp[i] == ESC);
@@ -5962,6 +5963,8 @@ handle_osc(char_u *tp, int len, char_u *key_name, int
*slen)
return OK;
}
+ key_name[1] = (int)KE_IGNORE;
+
#ifdef ELAPSED_FUNC
if (ELAPSED_FUNC(osc_state.start_tv) >= p_ost)
{
diff --git a/src/version.c b/src/version.c
index b8a4d78a8..e42edad47 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1895,
/**/
1894,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vGllj-006kNF-6O%40256bit.org.