aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Vargas Caballero2014-01-31 17:30:00 +0100
committerRoberto E. Vargas Caballero2014-02-02 19:42:01 +0100
commitccef77d94a070418a7b88ecf39817430a2d2b184 (patch)
tree5ac3146765e2a9bf0e654ac8298412af02ff4008
parent8edfe53e5907ca1ae83332fa0a2d81f27db6d297 (diff)
downloadaur-ccef77d94a070418a7b88ecf39817430a2d2b184.tar.gz
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.
-rw-r--r--st.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/st.c b/st.c
index c59bf1d64b71..6e7077af3963 100644
--- a/st.c
+++ b/st.c
@@ -953,11 +953,12 @@ selcopy(void) {
/* append every set & selected glyph to the selection */
for(y = sel.nb.y; y < sel.ne.y + 1; y++) {
gp = &term.line[y][0];
- last = gp + term.col;
+ last = &gp[term.col-1];
- while(--last >= gp && !(selected(last - gp, y) && \
- strcmp(last->c, " ") != 0))
- /* nothing */;
+ while(last >= gp && !(selected(last - gp, y) &&
+ strcmp(last->c, " ") != 0)) {
+ --last;
+ }
for(x = 0; gp <= last; x++, ++gp) {
if(!selected(x, y) || (gp->mode & ATTR_WDUMMY))