mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.0.0829: job running in terminal can't communicate with Vim
Problem: A job running in a terminal window cannot easily communicate with the Vim it is running in. Solution: Pass v:servername in an environment variable. (closes #1908)
This commit is contained in:
@@ -4094,6 +4094,9 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL)
|
#if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL)
|
||||||
|
/*
|
||||||
|
* Set the environment for a child process.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
set_child_environment(long rows, long columns, char *term)
|
set_child_environment(long rows, long columns, char *term)
|
||||||
{
|
{
|
||||||
@@ -4105,6 +4108,7 @@ set_child_environment(long rows, long columns, char *term)
|
|||||||
static char envbuf_Lines[20];
|
static char envbuf_Lines[20];
|
||||||
static char envbuf_Columns[20];
|
static char envbuf_Columns[20];
|
||||||
static char envbuf_Colors[20];
|
static char envbuf_Colors[20];
|
||||||
|
static char envbuf_Servername[60];
|
||||||
# endif
|
# endif
|
||||||
long colors =
|
long colors =
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
@@ -4112,7 +4116,6 @@ set_child_environment(long rows, long columns, char *term)
|
|||||||
# endif
|
# endif
|
||||||
t_colors;
|
t_colors;
|
||||||
|
|
||||||
/* Simulate to have a dumb terminal (for now) */
|
|
||||||
# ifdef HAVE_SETENV
|
# ifdef HAVE_SETENV
|
||||||
setenv("TERM", term, 1);
|
setenv("TERM", term, 1);
|
||||||
sprintf((char *)envbuf, "%ld", rows);
|
sprintf((char *)envbuf, "%ld", rows);
|
||||||
@@ -4123,10 +4126,12 @@ set_child_environment(long rows, long columns, char *term)
|
|||||||
setenv("COLUMNS", (char *)envbuf, 1);
|
setenv("COLUMNS", (char *)envbuf, 1);
|
||||||
sprintf((char *)envbuf, "%ld", colors);
|
sprintf((char *)envbuf, "%ld", colors);
|
||||||
setenv("COLORS", (char *)envbuf, 1);
|
setenv("COLORS", (char *)envbuf, 1);
|
||||||
|
setenv("VIM_SERVERNAME", serverName == NULL ? "" : (char *)serverName, 1);
|
||||||
# else
|
# else
|
||||||
/*
|
/*
|
||||||
* Putenv does not copy the string, it has to remain valid.
|
* Putenv does not copy the string, it has to remain valid.
|
||||||
* Use a static array to avoid losing allocated memory.
|
* Use a static array to avoid losing allocated memory.
|
||||||
|
* This won't work well when running multiple children...
|
||||||
*/
|
*/
|
||||||
vim_snprintf(envbuf_Term, sizeof(envbuf_Term), "TERM=%s", term);
|
vim_snprintf(envbuf_Term, sizeof(envbuf_Term), "TERM=%s", term);
|
||||||
putenv(envbuf_Term);
|
putenv(envbuf_Term);
|
||||||
@@ -4139,6 +4144,9 @@ set_child_environment(long rows, long columns, char *term)
|
|||||||
putenv(envbuf_Columns);
|
putenv(envbuf_Columns);
|
||||||
vim_snprintf(envbuf_Colors, sizeof(envbuf_Colors), "COLORS=%ld", colors);
|
vim_snprintf(envbuf_Colors, sizeof(envbuf_Colors), "COLORS=%ld", colors);
|
||||||
putenv(envbuf_Colors);
|
putenv(envbuf_Colors);
|
||||||
|
vim_snprintf(envbuf_Servername, sizeof(envbuf_Servername),
|
||||||
|
"VIM_SERVERNAME=%s", serverName == NULL ? "" : (char *)serverName);
|
||||||
|
putenv(envbuf_Servername);
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
829,
|
||||||
/**/
|
/**/
|
||||||
828,
|
828,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user