@@ -3466,7 +3466,7 @@ clip_wl_owner_exists(Clipboard_T *cbd)
34663466 * depending on the order of values in str.
34673467 */
34683468 static clipmethod_T
3469- get_clipmethod (char_u * str , bool * regular , bool * primary )
3469+ get_clipmethod (char_u * str , bool * plus UNUSED , bool * star )
34703470{
34713471 int len = (int )STRLEN (str ) + 1 ;
34723472 char_u * buf = alloc (len );
@@ -3493,8 +3493,8 @@ get_clipmethod(char_u *str, bool *regular, bool *primary)
34933493 if (clip_wl .regular .available || clip_wl .primary .available )
34943494 {
34953495 method = CLIPMETHOD_WAYLAND ;
3496- * regular = clip_wl .regular .available ;
3497- * primary = clip_wl .primary .available ;
3496+ * plus = clip_wl .regular .available ;
3497+ * star = clip_wl .primary .available ;
34983498 }
34993499#endif
35003500 }
@@ -3516,7 +3516,7 @@ get_clipmethod(char_u *str, bool *regular, bool *primary)
35163516 // won't be executed since xterm_dpy will be set to NULL.
35173517 xterm_update ();
35183518 method = CLIPMETHOD_X11 ;
3519- * regular = * primary = true;
3519+ * plus = * star = true;
35203520 }
35213521#endif
35223522 }
@@ -3527,35 +3527,48 @@ get_clipmethod(char_u *str, bool *regular, bool *primary)
35273527 if (gui .in_use )
35283528 {
35293529 method = CLIPMETHOD_GUI ;
3530- * regular = * primary = true;
3530+ * star = * plus = true;
35313531 }
35323532#endif
35333533 }
35343534 else if (STRCMP (buf , "other" ) == 0 )
35353535 {
35363536#ifndef UNIX
35373537 method = CLIPMETHOD_OTHER ;
3538- * regular = * primary = true;
3538+ * plus = * star = true;
35393539#endif
35403540 }
35413541 else
35423542 {
35433543#ifdef FEAT_CLIPBOARD_PROVIDER
35443544 // Check if it is the name of a provider
3545- int reg = clip_provider_is_available (& clip_plus , buf );
3546- int pri = clip_provider_is_available (& clip_star , buf );
3545+ #ifndef ONE_CLIPBOARD
3546+ int plus_avail = clip_provider_is_available (& clip_plus , buf );
3547+ #endif
3548+ int star_avail = clip_provider_is_available (& clip_star , buf );
35473549
3548- if (reg == 1 || pri == 1 )
3550+ if (
3551+ #ifndef ONE_CLIPBOARD
3552+ plus_avail == 1 ||
3553+ #endif
3554+ star_avail == 1 )
35493555 {
35503556 method = CLIPMETHOD_PROVIDER ;
35513557
35523558 vim_free (clipprovider_name );
35533559 clipprovider_name = vim_strsave (buf );
35543560
3555- * regular = reg == 1 ;
3556- * primary = pri == 1 ;
3561+ #ifndef ONE_CLIPBOARD
3562+ * plus = plus_avail == 1 ;
3563+ #endif
3564+ * star = star_avail == 1 ;
35573565 }
3558- else if (reg == -1 )
3566+
3567+ else if (
3568+ #ifndef ONE_CLIPBOARD
3569+ plus_avail == -1 ||
3570+ #endif
3571+ star_avail == -1 )
35593572#endif
35603573 {
35613574 ret = CLIPMETHOD_FAIL ;
@@ -3614,8 +3627,9 @@ clipmethod_to_str(clipmethod_T method)
36143627 char *
36153628choose_clipmethod (void )
36163629{
3617- bool regular = false, primary = false;
3618- clipmethod_T method = get_clipmethod (p_cpm , & regular , & primary );
3630+ bool plus = false;
3631+ bool star = false;
3632+ clipmethod_T method = get_clipmethod (p_cpm , & plus , & star );
36193633
36203634 if (method == CLIPMETHOD_FAIL )
36213635 return e_invalid_argument ;
@@ -3633,30 +3647,35 @@ choose_clipmethod(void)
36333647 // If we have a clipmethod that works now, then initialize clipboard
36343648 else if (clipmethod == CLIPMETHOD_NONE && method != CLIPMETHOD_NONE )
36353649 {
3636- clip_init_single ( & clip_plus , regular );
3637- clip_init_single (& clip_star , primary );
3650+ #ifndef ONE_CLIPBOARD
3651+ clip_init_single (& clip_plus , plus );
36383652 clip_plus .did_warn = false;
3653+ #endif
3654+ clip_init_single (& clip_star , star );
36393655 clip_star .did_warn = false;
36403656 }
36413657 else if ((clipmethod != CLIPMETHOD_NONE && method != clipmethod ))
36423658 {
36433659 // Disown clipboard if we are switching to a new method
36443660 if (clip_star .owned )
36453661 clip_lose_selection (& clip_star );
3662+ clip_init_single (& clip_star , star );
3663+ #ifndef ONE_CLIPBOARD
36463664 if (clip_plus .owned )
36473665 clip_lose_selection (& clip_plus );
3648-
3649- clip_init_single (& clip_plus , regular );
3650- clip_init_single (& clip_star , primary );
3666+ clip_init_single (& clip_plus , plus );
3667+ #endif
36513668 }
36523669 else
36533670 {
36543671 // If availability of a clipboard changed, then update the clipboard
36553672 // structure.
3656- if (regular != clip_plus .available )
3657- clip_init_single (& clip_plus , regular );
3658- if (primary != clip_star .available )
3659- clip_init_single (& clip_star , primary );
3673+ #ifndef ONE_CLIPBOARD
3674+ if (plus != clip_plus .available )
3675+ clip_init_single (& clip_plus , plus );
3676+ #endif
3677+ if (star != clip_star .available )
3678+ clip_init_single (& clip_star , star );
36603679 }
36613680
36623681 clipmethod = method ;
@@ -3724,8 +3743,12 @@ clip_provider_is_available(Clipboard_T *cbd, char_u *provider)
37243743
37253744 avail = rettv .vval .v_string ;
37263745
3727- if ((vim_strchr (avail , '+' ) != NULL && cbd == & clip_plus )
3728- || (vim_strchr (avail , '*' ) != NULL && cbd == & clip_star ))
3746+
3747+ if (
3748+ #ifndef ONE_CLIPBOARD
3749+ (vim_strchr (avail , '+' ) != NULL && cbd == & clip_plus ) ||
3750+ #endif
3751+ (vim_strchr (avail , '*' ) != NULL && cbd == & clip_star ))
37293752 res = 1 ;
37303753
37313754 if (FALSE)
0 commit comments