Remove non defined behaviour in selcopy

It is not defined when lateral effects of expressions are
calculated, so an expression as:

	--last >= gp && !(selected(last - gp, y)

is non portable.
This commit is contained in:
Roberto E. Vargas Caballero 2014-01-31 17:30:00 +01:00
parent a8d5870073
commit 6521b5dc32

9
st.c
View File

@ -953,11 +953,12 @@ selcopy(void) {
/* append every set & selected glyph to the selection */ /* append every set & selected glyph to the selection */
for(y = sel.nb.y; y < sel.ne.y + 1; y++) { for(y = sel.nb.y; y < sel.ne.y + 1; y++) {
gp = &term.line[y][0]; gp = &term.line[y][0];
last = gp + term.col; last = &gp[term.col-1];
while(--last >= gp && !(selected(last - gp, y) && \ while(last >= gp && !(selected(last - gp, y) &&
strcmp(last->c, " ") != 0)) strcmp(last->c, " ") != 0)) {
/* nothing */; --last;
}
for(x = 0; gp <= last; x++, ++gp) { for(x = 0; gp <= last; x++, ++gp) {
if(!selected(x, y) || (gp->mode & ATTR_WDUMMY)) if(!selected(x, y) || (gp->mode & ATTR_WDUMMY))