iFix extra bracketed paste markers when pasting >8kb - st - Simple Terminal Err gopher.r-36.net 70 i Err gopher.r-36.net 70 1Log /scm/st//log.gph gopher.r-36.net 70 1Files /scm/st//files.gph gopher.r-36.net 70 1Refs /scm/st//refs.gph gopher.r-36.net 70 1README /scm/st//file/README.gph gopher.r-36.net 70 1LICENSE /scm/st//file/LICENSE.gph gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1commit 4be353e381e07fd8100f0cf29b299180f6681e46 /scm/st//commit/4be353e381e07fd8100f0cf29b299180f6681e46.gph gopher.r-36.net 70 1parent 20d53cebc122829449524ef339ce44e13c6e85ec /scm/st//commit/20d53cebc122829449524ef339ce44e13c6e85ec.gph gopher.r-36.net 70 hAuthor: dequis URL:mailto:dx@dxzone.com.ar gopher.r-36.net 70 iDate: Fri, 25 Sep 2015 00:56:15 -0300 Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iFix extra bracketed paste markers when pasting >8kb Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iBefore this patch, when pasting over BUFSIZE (8192 bytes here), st would Err gopher.r-36.net 70 ido the following: Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i \e[200~...8192 bytes...\e[201~\e[200~...remaining bytes...\e[201~ Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iWith this patch, the start marker is only sent when the offset is 0 (at Err gopher.r-36.net 70 ithe beginning of selnotify) and the end marker is only sent when the Err gopher.r-36.net 70 iremaining bytes to read are 0 (at the end). Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iFor short pastes, both conditions are true in the same iteration. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iFor long pastes, it removes the extra markers in the middle, keeping the Err gopher.r-36.net 70 iintended wrapping: Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i \e[200~...8192 bytes......remaining bytes...\e[201~ Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iSigned-off-by: Christoph Lohmann <20h@r-36.net> Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iDiffstat: Err gopher.r-36.net 70 i st.c | 4 ++-- Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i1 file changed, 2 insertions(+), 2 deletions(-) Err gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1diff --git a/st.c b/st.c /scm/st//file/st.c.gph gopher.r-36.net 70 i@@ -1135,10 +1135,10 @@ selnotify(XEvent *e) Err gopher.r-36.net 70 i *repl++ = '\r'; Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i- if (IS_SET(MODE_BRCKTPASTE)) Err gopher.r-36.net 70 i+ if (IS_SET(MODE_BRCKTPASTE) && ofs == 0) Err gopher.r-36.net 70 i ttywrite("\033[200~", 6); Err gopher.r-36.net 70 i ttysend((char *)data, nitems * format / 8); Err gopher.r-36.net 70 i- if (IS_SET(MODE_BRCKTPASTE)) Err gopher.r-36.net 70 i+ if (IS_SET(MODE_BRCKTPASTE) && rem == 0) Err gopher.r-36.net 70 i ttywrite("\033[201~", 6); Err gopher.r-36.net 70 i XFree(data); Err gopher.r-36.net 70 i /* number of 32-bit chunks returned */ Err gopher.r-36.net 70 .