patch 9.1.0852: No warning when X11 registers are not available
Problem: No warning when X11 registers are not available
(delvh)
Solution: Output W23 once when connection to X11 clipboard/selection
is not possible, mention in the documentation, that register 0
will be used instead
Vim silently uses the 0 register, when clipboard or selection register * or +
are not available. This might be a bit unexpected for the user.
So let's just warn once when this happens.
fixes: #14768
closes: #16013
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/message.c b/src/message.c
index 03c7072..576d922 100644
--- a/src/message.c
+++ b/src/message.c
@@ -55,6 +55,9 @@
static FILE *verbose_fd = NULL;
static int verbose_did_open = FALSE;
+static int did_warn_clipboard = FALSE;
+static char *warn_clipboard = "W23: Clipboard register not available, using register 0";
+
/*
* When writing messages to the screen, there are many different situations.
* A number of variables is used to remember the current state:
@@ -4060,6 +4063,19 @@
msg_putchar(' ');
}
+/*
+ * Warn about missing Clipboard Support
+ */
+ void
+msg_warn_missing_clipboard(void)
+{
+ if (!global_busy && !did_warn_clipboard)
+ {
+ msg(_(warn_clipboard));
+ did_warn_clipboard = TRUE;
+ }
+}
+
#if defined(FEAT_CON_DIALOG) || defined(PROTO)
/*
* Used for "confirm()" function, and the :confirm command prefix.