Commit 6e811eaa4ff2134882145938a2ff799bde7e7a2b

Authored by Perry Werneck
1 parent 36c9ac2a

Adding method to get "paste-next" state.

src/core/paste.c
@@ -413,6 +413,14 @@ LIB3270_EXPORT int lib3270_paste_text(H3270 *hSession, const unsigned char *str) @@ -413,6 +413,14 @@ LIB3270_EXPORT int lib3270_paste_text(H3270 *hSession, const unsigned char *str)
413 return 0; 413 return 0;
414 } 414 }
415 415
  416 +LIB3270_EXPORT int lib3270_can_paste_next(const H3270 *hSession)
  417 +{
  418 + if(!(lib3270_is_connected(hSession) && hSession->paste_buffer))
  419 + return 0;
  420 +
  421 + return strlen(hSession->paste_buffer);
  422 +}
  423 +
416 LIB3270_EXPORT int lib3270_paste_next(H3270 *hSession) 424 LIB3270_EXPORT int lib3270_paste_next(H3270 *hSession)
417 { 425 {
418 char * ptr; 426 char * ptr;
src/core/properties/boolean.c
@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
38 #include <lib3270.h> 38 #include <lib3270.h>
39 #include <lib3270/properties.h> 39 #include <lib3270/properties.h>
40 #include <lib3270/keyboard.h> 40 #include <lib3270/keyboard.h>
  41 + #include <lib3270/selection.h>
41 42
42 int lib3270_is_starting(const H3270 *hSession) 43 int lib3270_is_starting(const H3270 *hSession)
43 { 44 {
@@ -149,6 +150,13 @@ @@ -149,6 +150,13 @@
149 }, 150 },
150 151
151 { 152 {
  153 + .name = "can_paste_next", // Property name.
  154 + .description = N_( "Still have text to paste" ), // Property description.
  155 + .get = lib3270_can_paste_next, // Get value.
  156 + .set = NULL // Set value.
  157 + },
  158 +
  159 + {
152 .name = "starting", // Property name. 160 .name = "starting", // Property name.
153 .description = N_( "Is starting (no first screen)?" ), // Property description. 161 .description = N_( "Is starting (no first screen)?" ), // Property description.
154 .get = lib3270_is_starting, // Get value. 162 .get = lib3270_is_starting, // Get value.
src/include/lib3270/selection.h
@@ -117,14 +117,26 @@ @@ -117,14 +117,26 @@
117 /** 117 /**
118 * @brief Paste remaining string. 118 * @brief Paste remaining string.
119 * 119 *
120 - * @param h Session handle. 120 + * @param hSession Session handle.
121 * 121 *
122 * @see lib3270_paste_text. 122 * @see lib3270_paste_text.
123 * 123 *
124 * @return Non 0 if there's more to paste. 124 * @return Non 0 if there's more to paste.
125 * 125 *
126 */ 126 */
127 - LIB3270_EXPORT int lib3270_paste_next(H3270 *h); 127 + LIB3270_EXPORT int lib3270_paste_next(H3270 *hSession);
  128 +
  129 + /**
  130 + * @brief Check if can paste next.
  131 + *
  132 + * @param hSession Session handle.
  133 + *
  134 + * @see lib3270_paste_next.
  135 + *
  136 + * @return Non 0 if there's more to paste.
  137 + *
  138 + */
  139 + LIB3270_EXPORT int lib3270_can_paste_next(const H3270 *hSession);
128 140
129 /** 141 /**
130 * @brief Move selected box 1 char in the selected direction. 142 * @brief Move selected box 1 char in the selected direction.