int i;
int local_State = get_real_state();
int is_plug_map = FALSE;
+ bool in_osc = in_osc_sequence(); // If we are in an OSC sequence,
+ // then go straight to
+ // check_termcode() in order to
+ // consume chars.
// If typeahead starts with <Plug> then remap, even for a "noremap" mapping.
- if (typebuf.tb_len >= 3
+ if (!in_osc && typebuf.tb_len >= 3
&& typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
&& typebuf.tb_buf[typebuf.tb_off + 1] == KS_EXTRA
&& typebuf.tb_buf[typebuf.tb_off + 2] == KE_PLUG)
* - waiting for "hit return to continue" and CR or SPACE typed
* - waiting for a char with --more--
* - in Ctrl-X mode, and we get a valid char for that mode
+ * - currently receiving OSC sequence
*/
tb_c1 = typebuf.tb_buf[typebuf.tb_off];
- if (no_mapping == 0 && is_maphash_valid()
+ if (!in_osc && no_mapping == 0 && is_maphash_valid()
&& (no_zero_mapping == 0 || tb_c1 != '0')
&& (typebuf.tb_maplen == 0 || is_plug_map
|| (p_remap
/*
* Check for match with 'pastetoggle'
*/
- if (*p_pt != NUL && mp == NULL && (State & (MODE_INSERT | MODE_NORMAL)))
+ if (!in_osc && *p_pt != NUL && mp == NULL &&
+ (State & (MODE_INSERT | MODE_NORMAL)))
{
for (mlen = 0; mlen < typebuf.tb_len && p_pt[mlen]; ++mlen)
if (p_pt[mlen] != typebuf.tb_buf[typebuf.tb_off + mlen])
// May check for a terminal code when there is no mapping or only a partial
// mapping. Also check if there is a full mapping with <Esc>, unless timed
// out, since that is nearly always a partial match with a terminal code.
- if ((mp == NULL || max_mlen + want_termcode > mp_match_len
+ if (in_osc || ((mp == NULL || max_mlen + want_termcode > mp_match_len
|| (mp_match_len == 1 && *mp->m_keys == ESC && !*timedout))
- && keylen != KEYLEN_PART_MAP)
+ && keylen != KEYLEN_PART_MAP))
{
int save_keylen = keylen;
* - and not an ESC sequence, not in insert mode or p_ek is on,
* - and when not timed out,
*/
- if (no_mapping == 0 || allow_keys != 0)
+ if (in_osc || no_mapping == 0 || allow_keys != 0)
{
- if ((typebuf.tb_maplen == 0
+ if (in_osc || ((typebuf.tb_maplen == 0
|| (p_remap && typebuf.tb_noremap[
typebuf.tb_off] == RM_YES))
- && !*timedout)
+ && !*timedout))
keylen = check_termcode(max_mlen + 1, NULL, 0, NULL);
else
keylen = 0;
int is_mouse_topline(win_T *wp);
int put_string_in_typebuf(int offset, int slen, char_u *string, int new_slen, char_u *buf, int bufsize, int *buflen);
int decode_modifiers(int n);
+bool in_osc_sequence(void);
int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen);
void term_get_fg_color(char_u *r, char_u *g, char_u *b);
void term_get_bg_color(char_u *r, char_u *g, char_u *b);
static oscstate_T osc_state;
/*
- * Handles any OSC sequence and places the result in "v:termosc". Note that the
- * OSC identifier and terminator character(s) will not be placed in the final
- * result. Returns OK on success and FAIL on failure.
+ * Return true if currently receiving an OSC response.
+ */
+ bool
+in_osc_sequence(void)
+{
+ return osc_state.processing;
+}
+
+/*
+ * Handles any OSC sequence and places the result in "v:termosc". Returns OK on
+ * success and FAIL on failure.
*/
static int
handle_osc(char_u *tp, int len, char_u *key_name, int *slen)