[hackers] [st] Trim trailing whitespaces in every selection case || Ivan Delalande

From: <git_AT_suckless.org>
Date: Wed, 19 Nov 2014 18:55:07 +0100

commit 09f5d98251469070b76f3911cc6a83d977871656
Author: Ivan Delalande <colona_AT_ycc.fr>
Date: Sun Nov 16 09:02:57 2014 +0100

    Trim trailing whitespaces in every selection case
    
    Trailing whitespaces are trimmed when copying from normal selection and
    rectangular selection on lines that have their last character included
    or on the left of the selection. It leads to inconsistent behaviors when
    copying the exact same text from the left and right window in
    applications with vertical splits.
    This patch solves this issue by always trimming the selection.

diff --git a/st.c b/st.c
index 4499be6..fc91334 100644
--- a/st.c
+++ b/st.c
_AT_@ -947,6 +947,8 @@ getsel(void) {
                         lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
                 }
                 last = &term.line[y][MIN(lastx, linelen-1)];
+ while(last >= gp && last->c[0] == ' ')
+ --last;
 
                 for( ; gp <= last; ++gp) {
                         if(gp->mode & ATTR_WDUMMY)
Received on Wed Nov 19 2014 - 18:55:07 CET

This archive was generated by hypermail 2.3.0 : Wed Nov 19 2014 - 19:00:13 CET