diff --git a/src/include/lib3270/selection.h b/src/include/lib3270/selection.h index 1b23317..8c9b665 100644 --- a/src/include/lib3270/selection.h +++ b/src/include/lib3270/selection.h @@ -42,31 +42,40 @@ * @brief Selection element * */ - typedef struct _lib3270_selection_element { - unsigned char chr; ///< @brief Element character. - unsigned short flags; ///< @brief Element colors & visual state. @see LIB3270_ATTR - unsigned char field_attributes; ///< @brief Field attribute. @see LIB3270_FIELD_ATTRIBUTE + typedef struct _lib3270_selection_element + { + unsigned char chr; ///< @brief Element character. + + struct + { + unsigned short visual; ///< @brief Element colors & visual state. @see LIB3270_ATTR + unsigned char field; ///< @brief Field attribute. @see LIB3270_FIELD_ATTRIBUTE + } attribute; + } lib3270_selection_element; /** - * @brief A rectangle containing the selected area. + * @brief A rectangle with informations about the selected area. * */ typedef struct _lib3270_selection { + /// @brief Cursor address. + unsigned int cursor_address; + + /// @brief Clipboard rectangle. struct { unsigned int row; unsigned int col; unsigned int width; unsigned int height; + } bounds; - } bounds; ///< @brief Clipboard rectangle. - + /// @brief Selection contents. lib3270_selection_element contents[1]; } lib3270_selection; - LIB3270_EXPORT int lib3270_unselect(H3270 *session); LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr); LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr); @@ -84,7 +93,7 @@ LIB3270_SELECTION_CUT = 0x0001, ///< @brief Cut selected data (if available). LIB3270_SELECTION_ALL = 0x0002, ///< @brief Get all data (the default is get only selected data). - LIB3270_SELECTION_UNPROTECTED_ONLY = 0x0004, ///< @brief Get only unprotected contents. +// LIB3270_SELECTION_UNPROTECTED_ONLY = 0x0004, ///< @brief Get only unprotected contents. } LIB3270_SELECTION_OPTIONS; diff --git a/src/lib3270/selection/get.c b/src/lib3270/selection/get.c index 0a62896..69ab403 100644 --- a/src/lib3270/selection/get.c +++ b/src/lib3270/selection/get.c @@ -156,10 +156,11 @@ LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cu // Get output buffer. lib3270_selection * selection = lib3270_malloc(sizeof(lib3270_selection) + (sizeof(lib3270_selection_element) * (width*height))); - selection->bounds.col = col; - selection->bounds.row = row; - selection->bounds.height = height; - selection->bounds.width = width; + selection->bounds.col = col; + selection->bounds.row = row; + selection->bounds.height = height; + selection->bounds.width = width; + selection->cursor_address = lib3270_get_cursor_address(hSession); unsigned int dstaddr = 0; @@ -183,8 +184,8 @@ LIB3270_EXPORT lib3270_selection * lib3270_get_selection(H3270 *hSession, int cu } selection->contents[dstaddr].chr = (hSession->text[baddr].chr ? hSession->text[baddr].chr : ' '); - selection->contents[dstaddr].flags = hSession->text[baddr].attr; - selection->contents[dstaddr].field_attributes = fa; + selection->contents[dstaddr].attribute.visual = hSession->text[baddr].attr; + selection->contents[dstaddr].attribute.field = fa; if(cut && !FA_IS_PROTECTED(fa)) { clear_chr(hSession,baddr); -- libgit2 0.21.2