To: vim_dev@googlegroups.com Subject: Patch 9.0.1504 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1504 Problem: No error when calling remote_startserver() with an empty string. Solution: Give an error for an empty string. (Hirohito Higashi, closes #12327) Files: runtime/doc/builtin.txt, src/clientserver.c, src/testdir/test_clientserver.vim *** ../vim-9.0.1503/runtime/doc/builtin.txt 2023-04-24 21:09:28.121166626 +0100 --- runtime/doc/builtin.txt 2023-05-01 22:34:03.327080927 +0100 *************** *** 7304,7311 **** < *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. Can also be used as a |method|: > ServerName()->remote_startserver() --- 7312,7320 ---- < *remote_startserver()* *E941* *E942* remote_startserver({name}) ! 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() *** ../vim-9.0.1503/src/clientserver.c 2023-01-09 19:04:19.300528373 +0000 --- src/clientserver.c 2023-05-01 22:34:58.155016344 +0100 *************** *** 968,992 **** 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) 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 ! } #else emsg(_(e_clientserver_feature_not_available)); #endif --- 968,990 ---- f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { #ifdef FEAT_CLIENTSERVER ! if (check_for_nonempty_string_arg(argvars, 0) == FAIL) return; if (serverName != NULL) { + 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 *** ../vim-9.0.1503/src/testdir/test_clientserver.vim 2022-08-30 21:46:03.657214444 +0100 --- src/testdir/test_clientserver.vim 2023-05-01 22:30:24.919391763 +0100 *************** *** 182,188 **** endif endtry ! call assert_fails('call remote_startserver([])', 'E730:') call assert_fails("let x = remote_peek([])", 'E730:') call assert_fails("let x = remote_read('vim10')", \ has('unix') ? ['E573:.*vim10'] : 'E277:') --- 182,189 ---- endif endtry ! 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:') *** ../vim-9.0.1503/src/version.c 2023-04-30 21:24:33.152633659 +0100 --- src/version.c 2023-05-01 22:36:07.130941168 +0100 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1504, /**/ -- The word "leader" is derived from the word "lead", as in the material that bullets are made out of. The term "leader" was popularized at about the same time as the invention of firearms. It grew out of the observation that the person in charge of every organization was the person whom everyone wanted to fill with hot lead. I don't recomment this; it's just a point of historical interest. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///