patch 9.1.1485: missing Wayland clipboard support
Problem: missing Wayland clipboard support
Solution: make it work (Foxe Chen)
fixes: #5157
closes: #17097
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/optionstr.c b/src/optionstr.c
index e82654a..c72c5d2 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -44,6 +44,8 @@
#ifdef FEAT_CLIPBOARD
// Note: Keep this in sync with did_set_clipboard()
static char *(p_cb_values[]) = {"unnamed", "unnamedplus", "autoselect", "autoselectplus", "autoselectml", "html", "exclude:", NULL};
+// Note: Keep this in sync with get_clipmethod()
+static char *(p_cpm_values[]) = {"wayland", "x11", NULL};
#endif
#ifdef FEAT_CRYPT
static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2",
@@ -1384,6 +1386,23 @@
numMatches,
matches);
}
+
+ char *
+did_set_clipmethod(optset_T *args UNUSED)
+{
+ return choose_clipmethod();
+}
+
+ int
+expand_set_clipmethod(optexpand_T *args, int *numMatches, char_u ***matches)
+{
+ return expand_set_opt_string(
+ args,
+ p_cpm_values,
+ ARRAY_LENGTH(p_cpm_values) - 1,
+ numMatches,
+ matches);
+}
#endif
/*
@@ -3625,6 +3644,21 @@
}
/*
+ * The 'wlseat' option is changed
+ */
+ char *
+did_set_wlseat(optset_T *args UNUSED)
+{
+#ifdef FEAT_WAYLAND_CLIPBOARD
+ // If there isn't any seat named 'wlseat', then let the wayland clipboard be
+ // unavailable. Ignore errors returned.
+ wayland_cb_reload();
+#endif
+
+ return NULL;
+}
+
+/*
* The 'selection' option is changed.
*/
char *