[dev] [st] [PATCH] Selection now handles empty lines less counter-intuitively.

From: Alexander Sedov <alex0player_AT_gmail.com>
Date: Thu, 18 Apr 2013 12:47:23 +0400

Now, when you are selecting a region, you will get all empty lines that happen
to be in it, including trailing ones. Last line terminator is omitted as it previously
was, though.
---
 st.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/st.c b/st.c
index 27d0be8..44fffda 100644
--- a/st.c
+++ b/st.c
_AT_@ -815,7 +815,7 @@ bpress(XEvent *e) {
 void
 selcopy(void) {
 	char *str, *ptr;
-	int x, y, bufsize, isselected = 0, size;
+	int x, y, bufsize, size;
 	Glyph *gp, *last;
 
 	if(sel.bx == -1) {
_AT_@ -826,7 +826,6 @@ selcopy(void) {
 
 		/* append every set & selected glyph to the selection */
 		for(y = sel.b.y; y < sel.e.y + 1; y++) {
-			isselected = 0;
 			gp = &term.line[y][0];
 			last = gp + term.col;
 
_AT_@ -837,8 +836,6 @@ selcopy(void) {
 			for(x = 0; gp <= last; x++, ++gp) {
 				if(!selected(x, y)) {
 					continue;
-				} else {
-					isselected = 1;
 				}
 
 				size = utf8size(gp->c);
_AT_@ -855,7 +852,7 @@ selcopy(void) {
 			 * st.
 			 * FIXME: Fix the computer world.
 			 */
-			if(isselected && y < sel.e.y)
+			if(y < sel.e.y)
 				*ptr++ = '\n';
 		}
 		*ptr = 0;
-- 
1.7.10.4
Received on Thu Apr 18 2013 - 10:47:23 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 18 2013 - 11:00:03 CEST