master
Aurélien Aptel 14 years ago
parent 591d147af7
commit 9703859e6c

13
st.c

@ -218,13 +218,13 @@ selinit(void) {
}
static inline int selected(int x, int y) {
if ((sel.ey==y && sel.by==y)) {
if(sel.ey == y && sel.by == y) {
int bx = MIN(sel.bx, sel.ex);
int ex = MAX(sel.bx, sel.ex);
return (x>=bx && x<=ex);
return BETWEEN(x, bx, ex);
}
return (((y>sel.b[1] && y<sel.e[1]) || (y==sel.e[1] && x<=sel.e[0])) || \
(y==sel.b[1] && x>=sel.b[0] && (x<=sel.e[0] || sel.b[1]!=sel.e[1])));
return ((sel.b[1] < y&&y < sel.e[1]) || (y==sel.e[1] && x<=sel.e[0]))
|| (y==sel.b[1] && x>=sel.b[0] && (x<=sel.e[0] || sel.b[1]!=sel.e[1]));
}
static void getbuttoninfo(XEvent *e, int *b, int *x, int *y) {
@ -249,13 +249,12 @@ static char *getseltext() {
int ls, x, y, sz;
if(sel.bx == -1)
return NULL;
sz = ((term.col+1) * (sel.e[1]-sel.b[1]+1));
sz = (term.col+1) * (sel.e[1]-sel.b[1]+1);
ptr = str = malloc(sz);
for(y = 0; y < term.row; y++) {
for(x = 0; x < term.col; x++) {
for(x = 0; x < term.col; x++)
if(term.line[y][x].state & GLYPH_SET && (ls = selected(x, y)))
*ptr = term.line[y][x].c, ptr++;
}
if(ls)
*ptr = '\n', ptr++;
}

Loading…
Cancel
Save