return OK;
}
-/*
- * If "vim" is TRUE, then get the motion type. If "vimenc" is TRUE, then get the
- * motion type and also convert "*buf". "buf" and "len_store" will be updated to
- * reflect the actual contents, but should be set beforehand with the initial
- * contents. Returns OK on success and FAIL on failure.
- */
- int
-clip_convert_data(
- char_u **buf,
- long *len_store,
- int *motion,
- bool vim,
- bool vimenc,
- char_u **tofree)
-{
- char_u *final = *buf;
- char_u *enc;
- long len = *len_store;
-
- if (vim && len >= 2)
- {
- *motion = *final++;
- len--;
- }
- else if (vimenc && len >= 3)
- {
- vimconv_T conv;
- int convlen;
-
- // First byte is motion type
- *motion = *final++;
- len--;
-
- // Get encoding of selection
- enc = final;
-
- // Skip the encoding type including null terminator in final text
- final = memchr(final, NUL, len);
- if (final == NULL)
- return FAIL;
- final++; // Skip NUL
-
- // Subtract pointers to get length of encoding;
- len -= final - enc;
-
- conv.vc_type = CONV_NONE;
- convert_setup(&conv, enc, p_enc);
- if (conv.vc_type != CONV_NONE)
- {
- char_u *tmp;
-
- convlen = len;
- tmp = string_convert(&conv, final, &convlen);
- len = convlen;
- if (tmp != NULL)
- {
- final = tmp;
- *tofree = final;
- }
- convert_setup(&conv, NULL, NULL);
- }
- }
- *buf = final;
- *len_store = len;
- return OK;
-}
/*
* Read data from a file descriptor and write it to the given clipboard.
}
#endif // FEAT_CLIPBOARD_PROVIDER
+
+#if defined(FEAT_WAYLAND_CLIPBOARD) || (defined(FEAT_GUI_GTK) && defined(USE_GTK4))
+/*
+ * If "vim" is TRUE, then get the motion type. If "vimenc" is TRUE, then get the
+ * motion type and also convert "*buf". "buf" and "len_store" will be updated to
+ * reflect the actual contents, but should be set beforehand with the initial
+ * contents. Returns OK on success and FAIL on failure.
+ */
+ int
+clip_convert_data(
+ char_u **buf,
+ long *len_store,
+ int *motion,
+ bool vim,
+ bool vimenc,
+ char_u **tofree)
+{
+ char_u *final = *buf;
+ char_u *enc;
+ long len = *len_store;
+
+ if (vim && len >= 2)
+ {
+ *motion = *final++;
+ len--;
+ }
+ else if (vimenc && len >= 3)
+ {
+ vimconv_T conv;
+ int convlen;
+
+ // First byte is motion type
+ *motion = *final++;
+ len--;
+
+ // Get encoding of selection
+ enc = final;
+
+ // Skip the encoding type including null terminator in final text
+ final = memchr(final, NUL, len);
+ if (final == NULL)
+ return FAIL;
+ final++; // Skip NUL
+
+ // Subtract pointers to get length of encoding;
+ len -= final - enc;
+
+ conv.vc_type = CONV_NONE;
+ convert_setup(&conv, enc, p_enc);
+ if (conv.vc_type != CONV_NONE)
+ {
+ char_u *tmp;
+
+ convlen = len;
+ tmp = string_convert(&conv, final, &convlen);
+ len = convlen;
+ if (tmp != NULL)
+ {
+ final = tmp;
+ *tofree = final;
+ }
+ convert_setup(&conv, NULL, NULL);
+ }
+ }
+ *buf = final;
+ *len_store = len;
+ return OK;
+}
+#endif
int clip_init_wayland(void);
void clip_uninit_wayland(void);
int clip_reset_wayland(void);
-int clip_convert_data(char_u **buf, long *len_store, int *motion, bool vim, bool vimenc, char_u **tofree);
char *choose_clipmethod(void);
void ex_clipreset(exarg_T *eap);
void adjust_clip_reg(int *rp);
void call_clip_provider_set(int reg);
void inc_clip_provider(void);
void dec_clip_provider(void);
+int clip_convert_data(char_u **buf, long *len_store, int *motion, bool vim, bool vimenc, char_u **tofree);
/* vim: set ft=c : */