---
st.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/st.c b/st.c
index 93058b9..726b8f9 100644
--- a/st.c
+++ b/st.c
_AT_@ -790,7 +790,7 @@ selcopy(void) {
}
/* \n at the end of every selected line except for the last one */
if(is_selected && y < sel.e.y)
- *ptr++ = '\r';
+ *ptr++ = '\n';
}
*ptr = 0;
}
_AT_@ -801,7 +801,7 @@ void
selnotify(XEvent *e) {
ulong nitems, ofs, rem;
int format;
- uchar *data;
+ uchar *data, *repl, *last;
Atom type;
ofs = 0;
_AT_@ -812,6 +812,14 @@ selnotify(XEvent *e) {
fprintf(stderr, "Clipboard allocation failed\n");
return;
}
+
+ /* Working around inconsistent behaviour of GUI and terminal apps */
+ last = data + nitems * format / 8;
+ repl = data;
+ while((repl = memchr(repl, '\n', last - repl))) {
+ *repl++ = '\r';
+ }
+
ttywrite((const char *) data, nitems * format / 8);
XFree(data);
/* number of 32-bit chunks returned */
--
1.7.10.4
Received on Fri Apr 12 2013 - 10:28:43 CEST
This archive was generated by hypermail 2.3.0 : Fri Apr 12 2013 - 10:36:04 CEST