diff options
| author | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-01-31 17:30:00 +0100 |
|---|---|---|
| committer | Roberto E. Vargas Caballero <k0ga@shike2.com> | 2014-02-02 19:42:01 +0100 |
| commit | 6521b5dc32d9bdc4d8826324cb7b2877910cc633 (patch) | |
| tree | 420fa01fef29484ee1d962602551ab2b23d0c80d /st.c | |
| parent | a8d5870073af14aa08032ab8520c5fe17bb8a1e8 (diff) | |
| download | st-6521b5dc32d9bdc4d8826324cb7b2877910cc633.tar.gz st-6521b5dc32d9bdc4d8826324cb7b2877910cc633.zip | |
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.
Diffstat (limited to 'st.c')
| -rw-r--r-- | st.c | 9 |
1 files changed, 5 insertions, 4 deletions
| @@ -953,11 +953,12 @@ selcopy(void) { | |||
| 953 | /* append every set & selected glyph to the selection */ | 953 | /* append every set & selected glyph to the selection */ |
| 954 | for(y = sel.nb.y; y < sel.ne.y + 1; y++) { | 954 | for(y = sel.nb.y; y < sel.ne.y + 1; y++) { |
| 955 | gp = &term.line[y][0]; | 955 | gp = &term.line[y][0]; |
| 956 | last = gp + term.col; | 956 | last = &gp[term.col-1]; |
| 957 | 957 | ||
| 958 | while(--last >= gp && !(selected(last - gp, y) && \ | 958 | while(last >= gp && !(selected(last - gp, y) && |
| 959 | strcmp(last->c, " ") != 0)) | 959 | strcmp(last->c, " ") != 0)) { |
| 960 | /* nothing */; | 960 | --last; |
| 961 | } | ||
| 961 | 962 | ||
| 962 | for(x = 0; gp <= last; x++, ++gp) { | 963 | for(x = 0; gp <= last; x++, ++gp) { |
| 963 | if(!selected(x, y) || (gp->mode & ATTR_WDUMMY)) | 964 | if(!selected(x, y) || (gp->mode & ATTR_WDUMMY)) |
