mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.0.0764: 'termkey' does not work yet
Problem: 'termkey' does not work yet. Solution: Implement 'termkey'.
This commit is contained in:
18
src/option.c
18
src/option.c
@@ -3269,7 +3269,6 @@ static void set_options_default(int opt_flags);
|
|||||||
static char_u *term_bg_default(void);
|
static char_u *term_bg_default(void);
|
||||||
static void did_set_option(int opt_idx, int opt_flags, int new_value);
|
static void did_set_option(int opt_idx, int opt_flags, int new_value);
|
||||||
static char_u *illegal_char(char_u *, int);
|
static char_u *illegal_char(char_u *, int);
|
||||||
static int string_to_key(char_u *arg);
|
|
||||||
#ifdef FEAT_CMDWIN
|
#ifdef FEAT_CMDWIN
|
||||||
static char_u *check_cedit(void);
|
static char_u *check_cedit(void);
|
||||||
#endif
|
#endif
|
||||||
@@ -4763,7 +4762,7 @@ do_set(
|
|||||||
&& (!arg[1] || VIM_ISWHITE(arg[1]))
|
&& (!arg[1] || VIM_ISWHITE(arg[1]))
|
||||||
&& !VIM_ISDIGIT(*arg))))
|
&& !VIM_ISDIGIT(*arg))))
|
||||||
{
|
{
|
||||||
value = string_to_key(arg);
|
value = string_to_key(arg, FALSE);
|
||||||
if (value == 0 && (long *)varp != &p_wcm)
|
if (value == 0 && (long *)varp != &p_wcm)
|
||||||
{
|
{
|
||||||
errmsg = e_invarg;
|
errmsg = e_invarg;
|
||||||
@@ -5320,14 +5319,17 @@ illegal_char(char_u *errbuf, int c)
|
|||||||
/*
|
/*
|
||||||
* Convert a key name or string into a key value.
|
* Convert a key name or string into a key value.
|
||||||
* Used for 'wildchar' and 'cedit' options.
|
* Used for 'wildchar' and 'cedit' options.
|
||||||
|
* When "multi_byte" is TRUE allow for multi-byte characters.
|
||||||
*/
|
*/
|
||||||
static int
|
int
|
||||||
string_to_key(char_u *arg)
|
string_to_key(char_u *arg, int multi_byte)
|
||||||
{
|
{
|
||||||
if (*arg == '<')
|
if (*arg == '<')
|
||||||
return find_key_option(arg + 1);
|
return find_key_option(arg + 1);
|
||||||
if (*arg == '^')
|
if (*arg == '^')
|
||||||
return Ctrl_chr(arg[1]);
|
return Ctrl_chr(arg[1]);
|
||||||
|
if (multi_byte)
|
||||||
|
return PTR2CHAR(arg);
|
||||||
return *arg;
|
return *arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5345,7 +5347,7 @@ check_cedit(void)
|
|||||||
cedit_key = -1;
|
cedit_key = -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = string_to_key(p_cedit);
|
n = string_to_key(p_cedit, FALSE);
|
||||||
if (vim_isprintc(n))
|
if (vim_isprintc(n))
|
||||||
return e_invarg;
|
return e_invarg;
|
||||||
cedit_key = n;
|
cedit_key = n;
|
||||||
@@ -7462,6 +7464,12 @@ did_set_string_option(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_TERMINAL
|
#ifdef FEAT_TERMINAL
|
||||||
|
/* 'termkey' */
|
||||||
|
else if (varp == &curwin->w_p_tms)
|
||||||
|
{
|
||||||
|
if (*curwin->w_p_tk != NUL && string_to_key(curwin->w_p_tk, TRUE) == 0)
|
||||||
|
errmsg = e_invarg;
|
||||||
|
}
|
||||||
/* 'termsize' */
|
/* 'termsize' */
|
||||||
else if (varp == &curwin->w_p_tms)
|
else if (varp == &curwin->w_p_tms)
|
||||||
{
|
{
|
||||||
|
@@ -9,6 +9,7 @@ void set_helplang_default(char_u *lang);
|
|||||||
void init_gui_options(void);
|
void init_gui_options(void);
|
||||||
void set_title_defaults(void);
|
void set_title_defaults(void);
|
||||||
int do_set(char_u *arg, int opt_flags);
|
int do_set(char_u *arg, int opt_flags);
|
||||||
|
int string_to_key(char_u *arg, int multi_byte);
|
||||||
void set_options_bin(int oldval, int newval, int opt_flags);
|
void set_options_bin(int oldval, int newval, int opt_flags);
|
||||||
int get_viminfo_parameter(int type);
|
int get_viminfo_parameter(int type);
|
||||||
char_u *find_viminfo_parameter(int type);
|
char_u *find_viminfo_parameter(int type);
|
||||||
|
@@ -60,9 +60,9 @@
|
|||||||
* - implement term_scrape(buf, row) inspect terminal screen
|
* - implement term_scrape(buf, row) inspect terminal screen
|
||||||
* - implement term_open(command, options) open terminal window
|
* - implement term_open(command, options) open terminal window
|
||||||
* - implement term_getjob(buf)
|
* - implement term_getjob(buf)
|
||||||
* - implement 'termkey'
|
|
||||||
* - when 'encoding' is not utf-8, or the job is using another encoding, setup
|
* - when 'encoding' is not utf-8, or the job is using another encoding, setup
|
||||||
* conversions.
|
* conversions.
|
||||||
|
* - In the GUI use a terminal emulator for :!cmd.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
@@ -445,6 +445,10 @@ terminal_loop(void)
|
|||||||
size_t len;
|
size_t len;
|
||||||
static int mouse_was_outside = FALSE;
|
static int mouse_was_outside = FALSE;
|
||||||
int dragging_outside = FALSE;
|
int dragging_outside = FALSE;
|
||||||
|
int termkey = 0;
|
||||||
|
|
||||||
|
if (*curwin->w_p_tk != NUL)
|
||||||
|
termkey = string_to_key(curwin->w_p_tk, TRUE);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@@ -459,10 +463,15 @@ terminal_loop(void)
|
|||||||
--no_mapping;
|
--no_mapping;
|
||||||
--allow_keys;
|
--allow_keys;
|
||||||
|
|
||||||
|
if (c == (termkey == 0 ? Ctrl_W : termkey))
|
||||||
|
{
|
||||||
|
stuffcharReadbuff(Ctrl_W);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Catch keys that need to be handled as in Normal mode. */
|
/* Catch keys that need to be handled as in Normal mode. */
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case Ctrl_W:
|
|
||||||
case NUL:
|
case NUL:
|
||||||
case K_ZERO:
|
case K_ZERO:
|
||||||
stuffcharReadbuff(c);
|
stuffcharReadbuff(c);
|
||||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
764,
|
||||||
/**/
|
/**/
|
||||||
763,
|
763,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user