Hi there,

I've done some light hacking on st, and am attaching 3
little patches as a result. I really like st, by the way,
and am finding it very stable and great for everyday use.

nofinalnewlinesel.patch
  This doesn't add a newline to the selection if the next
  line isn't selected. This was really annoying me; I'm
  delighted to have it fixed :)

printtostderr.patch
  There were a couple of error-like messages that were going
  to stdout; this sends them to stderr instead.

removeerrkeyprint.patch
  This removes the errkey stderr printing of key codes which
  don't need to send anything. There's no need for me to get
  a message on stderr every time I press shift.

Hope you like them,

Nick
diff -r 7bae6f59e9f6 st.c
--- a/st.c	Sun Jan 23 12:30:01 2011 +0100
+++ b/st.c	Thu Mar 31 14:17:34 2011 +0100
@@ -420,8 +420,8 @@
 					memcpy(ptr, term.line[y][x].c, sl);
 					ptr += sl;
 				}
-			if(ls)
-				*ptr = '\n', ptr++;
+			if(ls && y < sel.e.y)
+				*ptr++ = '\n';
 		}
 		*ptr = 0;
 	}
diff -r 7bae6f59e9f6 st.c
--- a/st.c	Sun Jan 23 12:30:01 2011 +0100
+++ b/st.c	Thu Mar 31 14:20:33 2011 +0100
@@ -935,7 +935,7 @@
 	switch(escseq.mode) {
 	default:
 	unknown:
-		printf("erresc: unknown csi ");
+		fprintf(stderr, "erresc: unknown csi ");
 		csidump();
 		/* die(""); */
 		break;
@@ -1207,7 +1207,7 @@
 				term.c.attr.mode &= ~ATTR_GFX;
 				break;
 			default:
-				printf("esc unhandled charset: ESC ( %c\n", ascii);
+				fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii);
 			}
 			term.esc = 0;
 		} else {
diff -r 7bae6f59e9f6 st.c
--- a/st.c	Sun Jan 23 12:30:01 2011 +0100
+++ b/st.c	Thu Mar 31 14:21:37 2011 +0100
@@ -1794,8 +1794,7 @@
 				if(meta && len == 1)
 					ttywrite("\033", 1);
 				ttywrite(buf, len);
-			} else /* 4. nothing to send */
-				fprintf(stderr, "errkey: %d\n", (int)ksym);
+			}
 			break;
 		}
 }

Reply via email to