Closed siebenmann closed 6 years ago
Hm, even this hacky solution is better than the current state of affairs... I will try to recreate this.
diff --git a/libXg/gwin.c b/libXg/gwin.c
index 4bee554..f8d5a65 100644
--- a/libXg/gwin.c
+++ b/libXg/gwin.c
@@ -491,7 +491,8 @@ SendSel(Widget w, Atom *sel, Atom *target, Atom *rtype, XtPointer *ans,
XTextProperty p = {0};
char *ls[2] = {NULL, NULL};
- if (*target == XA_STRING){
+ if ((*target == XA_STRING) ||
+ (*target == XInternAtom(_dpy, "UTF8_STRING", 0))){
ls[0] = gw->gwin.selection? gw->gwin.selection : "";
if (XmbTextListToTextProperty(_dpy, ls, 1, XUTF8StringStyle, &p) != Success)
return false;
This seems to allow pasting between two instances of sam. What's keeping us from including this?
@ckeen Works for me. Can you open a PR?
Merged and closing. Thanks!
Suppose that you are running two copies of sam (perhaps on different machines) and you want to transfer some text from a file in one to a file in the other. In theory you should be able to snarf the text in the source sam,
<exch>
to make it the X selection,<exch>
in the target sam to import the X selection, and then paste it. In practice this doesn't work; the target sam winds up with nothing from its<exch>
operation. It does work if I use xterm runningcat >/dev/null
as an intermediate.This may be related to #61, since both involve
<exch>
.In attempting to look at the code with very little knowledge of how X selection things work, I noticed that
libXg/gwin.c
'sSelectSwap()
appears to set the selection as aUTF8_STRING
, butSendSel()
returnsfalse
unless it is being asked for anXA_STRING
. Some instrumentation suggests that when another sam asks for the selection,SendSel()
is usually called with aUTF8_STRING
Atom as the*target
value. In the current code, it will thus fail. Hacking it up to acceptUTF8_STRING
as well appears to make things work between two sam processes (although it doesn't fix #61).