Commit 261603b32b0b81cd5959f3f8e6f321c1717ef895
1 parent
73de0f1c
Exists in
master
and in
3 other branches
Updating clipboard tools.
Showing
2 changed files
with
8 additions
and
4 deletions
Show diff stats
src/include/lib3270/selection.h
... | ... | @@ -145,7 +145,7 @@ |
145 | 145 | * @return 0 if suceeds, error code if not (sets errno). |
146 | 146 | * |
147 | 147 | */ |
148 | - LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int *col, unsigned int *row, unsigned int *width, unsigned int *height); | |
148 | + LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int *row, unsigned int *col, unsigned int *width, unsigned int *height); | |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * @brief Get bitmasked flag for the current selection. | ... | ... |
src/lib3270/selection/selection.c
... | ... | @@ -220,6 +220,8 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba |
220 | 220 | if( (col == 0) || !(hSession->text[baddr-1].attr & LIB3270_ATTR_SELECTED) ) |
221 | 221 | rc |= SELECTION_LEFT; |
222 | 222 | |
223 | + /// FIXME: It should text if baddr is the last element before the +1. | |
224 | + | |
223 | 225 | if( (col == hSession->cols) || !(hSession->text[baddr+1].attr & LIB3270_ATTR_SELECTED) ) |
224 | 226 | rc |= SELECTION_RIGHT; |
225 | 227 | } |
... | ... | @@ -375,7 +377,7 @@ LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession) |
375 | 377 | return hSession->selected != 0; |
376 | 378 | } |
377 | 379 | |
378 | -LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int *col, unsigned int *row, unsigned int *width, unsigned int *height) | |
380 | +LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int *row, unsigned int *col, unsigned int *width, unsigned int *height) | |
379 | 381 | { |
380 | 382 | unsigned int r, c, minRow, minCol, maxRow, maxCol, baddr, count; |
381 | 383 | |
... | ... | @@ -419,10 +421,12 @@ LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int |
419 | 421 | if(!count) |
420 | 422 | return errno = ENOENT; |
421 | 423 | |
424 | + debug("Selection from %u,%u and to %u,%u",minCol,minRow,maxCol,maxRow); | |
425 | + | |
422 | 426 | *col = minCol; |
423 | 427 | *row = minRow; |
424 | - *width = (maxCol - minCol); | |
425 | - *height = (maxRow - minRow); | |
428 | + *width = (maxCol - minCol)+1; | |
429 | + *height = (maxRow - minRow)+1; | |
426 | 430 | |
427 | 431 | return 0; |
428 | 432 | } | ... | ... |