Commit Diff


commit - 51466e019a67e9319e6c5a7fa4205842ca860b71
commit + 98a1085d0e7c3d84e19185ba666c4b0c725cd974
blob - 497885b0b48c03fc19be0de0e558049d05168e51
blob + 097775db84e85948a72d9e310ee2e16caac3743d
--- st.c
+++ st.c
@@ -662,7 +662,10 @@ y2row(int y) {
 static int tlinelen(int y) {
 	int i = term.col;
 
-	while (i > 0 && term.line[y][i - 1].c[0] == ' ')
+	if(term.line[y][i - 1].mode & ATTR_WRAP)
+		return i;
+
+	while(i > 0 && term.line[y][i - 1].c[0] == ' ')
 		--i;
 
 	return i;
@@ -959,7 +962,7 @@ getsel(void) {
 		 * st.
 		 * FIXME: Fix the computer world.
 		 */
-		if(sel.ne.y > y || lastx >= linelen)
+		if((y < sel.ne.y || lastx >= linelen) && !(last->mode & ATTR_WRAP))
 			*ptr++ = '\n';
 	}
 	*ptr = 0;