mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -04:00
patch 9.0.1504: no error when calling remote_startserver("")
Problem: No error when calling remote_startserver() with an empty string. Solution: Give an error for an empty string. (Hirohito Higashi, closes #12327)
This commit is contained in:
@@ -7312,8 +7312,9 @@ remote_send({server}, {string} [, {idvar}])
|
||||
<
|
||||
*remote_startserver()* *E941* *E942*
|
||||
remote_startserver({name})
|
||||
Become the server {name}. This fails if already running as a
|
||||
server, when |v:servername| is not empty.
|
||||
Become the server {name}. {name} must be a non-empty string.
|
||||
This fails if already running as a server, when |v:servername|
|
||||
is not empty.
|
||||
|
||||
Can also be used as a |method|: >
|
||||
ServerName()->remote_startserver()
|
||||
|
@@ -968,25 +968,23 @@ f_remote_send(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
{
|
||||
#ifdef FEAT_CLIENTSERVER
|
||||
char_u *server;
|
||||
|
||||
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
|
||||
if (check_for_nonempty_string_arg(argvars, 0) == FAIL)
|
||||
return;
|
||||
|
||||
server = tv_get_string_chk(&argvars[0]);
|
||||
if (server == NULL)
|
||||
return; // type error; errmsg already given
|
||||
if (serverName != NULL)
|
||||
emsg(_(e_already_started_server));
|
||||
else
|
||||
{
|
||||
# ifdef FEAT_X11
|
||||
if (check_connection() == OK)
|
||||
serverRegisterName(X_DISPLAY, server);
|
||||
# else
|
||||
serverSetName(server);
|
||||
# endif
|
||||
emsg(_(e_already_started_server));
|
||||
return;
|
||||
}
|
||||
|
||||
char_u *server = tv_get_string_chk(&argvars[0]);
|
||||
# ifdef FEAT_X11
|
||||
if (check_connection() == OK)
|
||||
serverRegisterName(X_DISPLAY, server);
|
||||
# else
|
||||
serverSetName(server);
|
||||
# endif
|
||||
|
||||
#else
|
||||
emsg(_(e_clientserver_feature_not_available));
|
||||
#endif
|
||||
|
@@ -182,7 +182,8 @@ func Test_client_server()
|
||||
endif
|
||||
endtry
|
||||
|
||||
call assert_fails('call remote_startserver([])', 'E730:')
|
||||
call assert_fails('call remote_startserver("")', 'E1175:')
|
||||
call assert_fails('call remote_startserver([])', 'E1174:')
|
||||
call assert_fails("let x = remote_peek([])", 'E730:')
|
||||
call assert_fails("let x = remote_read('vim10')",
|
||||
\ has('unix') ? ['E573:.*vim10'] : 'E277:')
|
||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1504,
|
||||
/**/
|
||||
1503,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user