A few style questions:
> - if(*y > 0 && term.line[*y - 1][term.col-1].mode
> - & ATTR_WRAP) {
> + if(*y > 0 && term.line[*y-1][term.col-1].mode & ATTR_WRAP
> + && !strchr(worddelimiters,
> + term.line[*y-1][term.col-1].c[0])) {
The term "term.line[*y-1][term.col-1]" appears twice in a very long
expression. I think the use of a pointer can help a bit here with
something like:
if(*y > 0 && (gp= &term.line[*y-1][term.col-1])
&& gp->mode & ATTR_WRAP
&& !strchr(worddelimiters, gp->c[0])) {
> _AT_@ -720,8 +721,8 @@ selsnap(int mode, int *x, int *y, int direction) {
> }
> }
> if(direction > 0 && *x >= term.col-1) {
> - if(*y < term.row-1 && term.line[*y][*x].mode
> - & ATTR_WRAP) {
> + if(*y < term.row-1 && term.line[*y][*x].mode & ATTR_WRAP
> + && !strchr(worddelimiters, term.line[*y+1][0].c[0])) {
The same here.
Maybe the use of && to allow sequential code in a 'if' is not a good idea,
and maybe some refactoring could be done here to avoid so long lines and
the ugly sequential &&.
--
Roberto E. Vargas Caballero
Received on Wed Jun 04 2014 - 21:32:11 CEST