When a line doesn't fit in a row of the terminal it is wrapped, so next characters of the line are shown in the next row. st adds always a newline character when rows are copied, but it causes that in wrapped lines a non needed newline is appended. The solution is easy, don't add the newline when there is a character in the last position of the row. --- st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/st.c b/st.c index 1b01353..29a8a1d 100644 --- a/st.c +++ b/st.c @@ -974,7 +974,7 @@ selcopy(void) { ex = sel.ne.x; if(sel.nb.y == sel.ne.y && sel.ne.x < sel.nb.x) ex = sel.nb.x; - if(i < ex) + if(i < ex && i != term.col - 1) *ptr++ = '\n'; } } -- 1.8.3.3