Commit 28296b0c6073e25f400d0ad0531c9bf436dcbe70
1 parent
3cfc57fa
Exists in
master
and in
5 other branches
wip
Showing
2 changed files
with
20 additions
and
0 deletions
Show diff stats
src/lib3270/api.h
| ... | ... | @@ -91,8 +91,10 @@ |
| 91 | 91 | /* Debug & log */ |
| 92 | 92 | #if defined( DEBUG ) |
| 93 | 93 | #define Trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); |
| 94 | + #define trace( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n", __FILE__, __LINE__, __VA_ARGS__ ); fflush(stderr); | |
| 94 | 95 | #else |
| 95 | 96 | #define Trace( fmt, ... ) /* __VA_ARGS__ */ |
| 97 | + #define trace( fmt, ... ) /* __VA_ARGS__ */ | |
| 96 | 98 | #endif |
| 97 | 99 | |
| 98 | 100 | ... | ... |
src/lib3270/selection.c
| ... | ... | @@ -437,7 +437,25 @@ LIB3270_EXPORT int lib3270_get_selected_addr(H3270 *hSession, int *begin, int *e |
| 437 | 437 | |
| 438 | 438 | LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) |
| 439 | 439 | { |
| 440 | + int step = (to - from); | |
| 441 | + int first, last, pos, len; | |
| 440 | 442 | |
| 443 | + if(lib3270_get_selected_addr(hSession,&first,&last)) | |
| 444 | + return from; | |
| 445 | + | |
| 446 | + len = hSession->rows * hSession->cols; | |
| 447 | + | |
| 448 | + pos = first+step; | |
| 449 | + trace("first=%d pos=%d step=%d",first,pos,step); | |
| 450 | + if(pos < 0) | |
| 451 | + step -= pos; | |
| 452 | + | |
| 453 | + pos = last+step; | |
| 454 | + if(pos > len) | |
| 455 | + step -= (pos - len); | |
| 456 | + | |
| 457 | + | |
| 458 | + trace("%s step=%d",__FUNCTION__,step); | |
| 441 | 459 | |
| 442 | 460 | return from; |
| 443 | 461 | } | ... | ... |