[hackers] [st] Add newline to last selected line

From: Alexander Rezinsky <alexrez_AT_gmail.com>
Date: Sun, 28 Apr 2013 21:49:51 -0700

diff --git a/st.c b/st.c
index 7720446..ae7bc2d 100644
--- a/st.c
+++ b/st.c
_AT__AT_ -934,6 +934,22 @@ selcopy(void) {
                         */
                        if(y < sel.e.y && !((gp-1)->mode & ATTR_WRAP))
                                *ptr++ = '\n';
+ if (y == sel.e.y) {
+ /*
+ * Add '\n' to last selected line only when
+ * selection expands over the end of the last line
+ */
+ int ex, i;
+ for (i = term.col; --i > 0 && term.line[y][i].c[0] == ' ';
)
+ /* nothing */ ;
+ ex = sel.e.x;
+ if (sel.b.y == sel.e.y && sel.e.x < sel.b.x) {
+ ex = sel.b.x;
+ }
+ if (i < ex) {
+ *ptr++ = '\n';
+ }
+ }
Received on Mon Apr 29 2013 - 06:49:51 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 29 2013 - 07:00:17 CEST