[hackers] [st] Fix extra bracketed paste markers when pasting >8kb || dequis

From: <git_AT_suckless.org>
Date: Fri, 25 Sep 2015 20:17:07 +0200 (CEST)

commit 4be353e381e07fd8100f0cf29b299180f6681e46
Author: dequis <dx_AT_dxzone.com.ar>
AuthorDate: Fri Sep 25 00:56:15 2015 -0300
Commit: Christoph Lohmann <20h_AT_r-36.net>
CommitDate: Fri Sep 25 20:16:30 2015 +0200

    Fix extra bracketed paste markers when pasting >8kb
    
    Before this patch, when pasting over BUFSIZE (8192 bytes here), st would
    do the following:
    
        \e[200~...8192 bytes...\e[201~\e[200~...remaining bytes...\e[201~
    
    With this patch, the start marker is only sent when the offset is 0 (at
    the beginning of selnotify) and the end marker is only sent when the
    remaining bytes to read are 0 (at the end).
    
    For short pastes, both conditions are true in the same iteration.
    
    For long pastes, it removes the extra markers in the middle, keeping the
    intended wrapping:
    
        \e[200~...8192 bytes......remaining bytes...\e[201~
    
    Signed-off-by: Christoph Lohmann <20h_AT_r-36.net>

diff --git a/st.c b/st.c
index bcf74b3..9de30ec 100644
--- a/st.c
+++ b/st.c
_AT_@ -1135,10 +1135,10 @@ selnotify(XEvent *e)
                         *repl++ = '\r';
                 }
 
- if (IS_SET(MODE_BRCKTPASTE))
+ if (IS_SET(MODE_BRCKTPASTE) && ofs == 0)
                         ttywrite("\033[200~", 6);
                 ttysend((char *)data, nitems * format / 8);
- if (IS_SET(MODE_BRCKTPASTE))
+ if (IS_SET(MODE_BRCKTPASTE) && rem == 0)
                         ttywrite("\033[201~", 6);
                 XFree(data);
                 /* number of 32-bit chunks returned */
Received on Fri Sep 25 2015 - 20:17:07 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 25 2015 - 20:24:16 CEST