iFix copy of line with len = 0 - 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 5d2d9d540d84761cf11648ea42a6413001a5d7b9 /scm/st//commit/5d2d9d540d84761cf11648ea42a6413001a5d7b9.gph gopher.r-36.net 70 1parent a1ed5071e54e4f8ce765c07d5415da7d8cedf618 /scm/st//commit/a1ed5071e54e4f8ce765c07d5415da7d8cedf618.gph gopher.r-36.net 70 hAuthor: Roberto E. Vargas Caballero URL:mailto:k0ga@shike2.com gopher.r-36.net 70 iDate: Thu, 10 Sep 2015 11:53:11 +0200 Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iFix copy of line with len = 0 Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iWhen a line has no any character linelen is 0, so last = &term.line[y][MIN(lastx, linelen-1)] Err gopher.r-36.net 70 igenerated a pointer to the end of the previous line. The best thing we can do in this case Err gopher.r-36.net 70 iis to add a newline, because we don't have a glyph to print (and consult its state of Err gopher.r-36.net 70 iwrapping). Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iDiffstat: Err gopher.r-36.net 70 i st.c | 5 ++++- Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i1 file changed, 4 insertions(+), 1 deletion(-) 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@@ -1004,7 +1004,10 @@ getsel(void) Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i /* append every set & selected glyph to the selection */ Err gopher.r-36.net 70 i for (y = sel.nb.y; y <= sel.ne.y; y++) { Err gopher.r-36.net 70 i- linelen = tlinelen(y); Err gopher.r-36.net 70 i+ if ((linelen = tlinelen(y)) == 0) { Err gopher.r-36.net 70 i+ *ptr++ = '\n'; Err gopher.r-36.net 70 i+ continue; Err gopher.r-36.net 70 i+ } Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i if (sel.type == SEL_RECTANGULAR) { Err gopher.r-36.net 70 i gp = &term.line[y][sel.nb.x]; Err gopher.r-36.net 70 .