patch 9.1.1651: Cannot use clientserver over socket

Problem:  Cannot use clientserver over Unix domain socket
Solution: Implement socketserver functionality (Foxe Chen).

fixes: #3509
closes: #17839

Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Foxe Chen
2025-08-18 21:40:40 +02:00
committed by Christian Brabandt
parent 31170af24a
commit 96b2154b73
34 changed files with 2562 additions and 68 deletions

View File

@ -1855,7 +1855,8 @@ getout(int exitval)
* Get the name of the display, before gui_prepare() removes it from
* argv[]. Used for the xterm-clipboard display.
*
* Also find the --server... arguments and --socketid and --windowid
* Also find the --server, --clientserver... arguments and --socketid and
* --windowid
*/
static void
early_arg_scan(mparm_T *parmp UNUSED)
@ -1900,6 +1901,22 @@ early_arg_scan(mparm_T *parmp UNUSED)
gui.dofork = FALSE;
# endif
}
# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER)
else if (STRNICMP(argv[i], "--clientserver", 14) == 0)
{
char_u *arg;
if (i == argc - 1)
mainerr_arg_missing((char_u *)argv[i]);
arg = (char_u *)argv[++i];
if (STRICMP(arg, "socket") == 0)
clientserver_method = CLIENTSERVER_METHOD_SOCKET;
else if (STRICMP(arg, "x11") == 0)
clientserver_method = CLIENTSERVER_METHOD_X11;
else
mainerr(ME_UNKNOWN_OPTION, arg);
}
# endif
# endif
# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN)
@ -2220,7 +2237,11 @@ command_line_scan(mparm_T *parmp)
else if (STRNICMP(argv[0] + argv_idx, "serverlist", 10) == 0)
; // already processed -- no arg
else if (STRNICMP(argv[0] + argv_idx, "servername", 10) == 0
|| STRNICMP(argv[0] + argv_idx, "serversend", 10) == 0)
|| STRNICMP(argv[0] + argv_idx, "serversend", 10) == 0
# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER)
|| STRNICMP(argv[0] + argv_idx, "clientserver", 12) == 0
# endif
)
{
// already processed -- snatch the following arg
if (argc > 1)
@ -3712,6 +3733,9 @@ usage(void)
main_msg(_("-Y\t\t\tDo not connect to Wayland compositor"));
#endif
#ifdef FEAT_CLIENTSERVER
# if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER)
main_msg(_("--clientserver <socket|x11> Backend for clientserver communication"));
# endif
main_msg(_("--remote <files>\tEdit <files> in a Vim server if possible"));
main_msg(_("--remote-silent <files> Same, don't complain if there is no server"));
main_msg(_("--remote-wait <files> As --remote but wait for files to have been edited"));