X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=st.c;h=8b65450a38da1430fd95c8c6438a5f98afe6b232;hb=6fd887077e29efd789499e06193314d7abdcac38;hp=9a41c5b9bb3b29b8ee5512ae7c63ff5765efcc92;hpb=2323e962e6bcddba42fd8be977088fb63ed8844c;p=st.git diff --git a/st.c b/st.c index 9a41c5b..8b65450 100644 --- a/st.c +++ b/st.c @@ -670,7 +670,7 @@ static void selnormalize(void) { int i; - if(sel.ob.y == sel.oe.y) { + if(sel.ob.y == sel.oe.y || sel.type == SEL_RECTANGULAR) { sel.nb.x = MIN(sel.ob.x, sel.oe.x); sel.ne.x = MAX(sel.ob.x, sel.oe.x); } else { @@ -920,7 +920,7 @@ bpress(XEvent *e) { char * getsel(void) { char *str, *ptr; - int x, y, bufsize, size, i, ex; + int x, y, bufsize, size, ex; Glyph *gp, *last; if(sel.ob.x == -1) @@ -965,13 +965,10 @@ getsel(void) { * after the visible text '\n' is appended. */ if(y == sel.ne.y) { - i = term.col; - while(--i > 0 && term.line[y][i].c[0] == ' ') - /* nothing */; ex = sel.ne.x; if(sel.nb.y == sel.ne.y && sel.ne.x < sel.nb.x) ex = sel.nb.x; - if(i < ex) + if(tlinelen(y) < ex) *ptr++ = '\n'; } }