Commit 70c33ef26da1b7e99656777490ecdf4d5e2840f8
1 parent
261603b3
Exists in
master
and in
3 other branches
Adding method to erase selected inputs.
Showing
5 changed files
with
42 additions
and
4 deletions
Show diff stats
src/include/lib3270/selection.h
@@ -183,4 +183,12 @@ | @@ -183,4 +183,12 @@ | ||
183 | */ | 183 | */ |
184 | LIB3270_EXPORT int lib3270_select_region(H3270 *h, int start, int end); | 184 | LIB3270_EXPORT int lib3270_select_region(H3270 *h, int start, int end); |
185 | 185 | ||
186 | + /** | ||
187 | + * @brief Erase selected inputs. | ||
188 | + * | ||
189 | + * @param hSession Session handle. | ||
190 | + * | ||
191 | + */ | ||
192 | + LIB3270_EXPORT int lib3270_erase_selected(H3270 *hSession); | ||
193 | + | ||
186 | #endif // LIB3270_SELECTION_H_INCLUDED | 194 | #endif // LIB3270_SELECTION_H_INCLUDED |
src/lib3270/paste.c
@@ -108,7 +108,7 @@ | @@ -108,7 +108,7 @@ | ||
108 | if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_MARGINED_PASTE)) | 108 | if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_MARGINED_PASTE)) |
109 | { | 109 | { |
110 | baddr = hSession->cursor_addr; | 110 | baddr = hSession->cursor_addr; |
111 | - while(BA_TO_COL(baddr) < lmargin) | 111 | + while(BA_TO_COL(baddr) < ((unsigned int) lmargin)) |
112 | { | 112 | { |
113 | baddr = ROWCOL_TO_BA(BA_TO_ROW(baddr), lmargin); | 113 | baddr = ROWCOL_TO_BA(BA_TO_ROW(baddr), lmargin); |
114 | if (!ever) | 114 | if (!ever) |
@@ -151,7 +151,7 @@ | @@ -151,7 +151,7 @@ | ||
151 | 151 | ||
152 | data->qtd++; | 152 | data->qtd++; |
153 | 153 | ||
154 | - if(BA_TO_ROW(hSession->cursor_addr) != data->row) | 154 | + if(BA_TO_ROW(hSession->cursor_addr) != ((unsigned int) data->row)) |
155 | { | 155 | { |
156 | trace("Row changed from %d to %d",data->row,BA_TO_ROW(hSession->cursor_addr)); | 156 | trace("Row changed from %d to %d",data->row,BA_TO_ROW(hSession->cursor_addr)); |
157 | if(!remargin(hSession,data->orig_col)) | 157 | if(!remargin(hSession,data->orig_col)) |
src/lib3270/private.h
@@ -735,8 +735,10 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); | @@ -735,8 +735,10 @@ LIB3270_INTERNAL int non_blocking(H3270 *session, Boolean on); | ||
735 | #ifdef SSL_ENABLE_CRL_CHECK | 735 | #ifdef SSL_ENABLE_CRL_CHECK |
736 | LIB3270_INTERNAL int lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message); | 736 | LIB3270_INTERNAL int lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message); |
737 | LIB3270_INTERNAL int lib3270_check_X509_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message); | 737 | LIB3270_INTERNAL int lib3270_check_X509_crl(H3270 *hSession, SSL_ERROR_MESSAGE * message); |
738 | - | ||
739 | #endif // SSL_ENABLE_CRL_CHECK | 738 | #endif // SSL_ENABLE_CRL_CHECK |
740 | 739 | ||
740 | + /// @brief Clear element at adress. | ||
741 | + LIB3270_INTERNAL void clear_chr(H3270 *hSession, int baddr); | ||
742 | + | ||
741 | #endif | 743 | #endif |
742 | 744 |
src/lib3270/selection/get.c
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | 35 | ||
36 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 36 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
37 | 37 | ||
38 | -static void clear_chr(H3270 *hSession, int baddr) | 38 | +void clear_chr(H3270 *hSession, int baddr) |
39 | { | 39 | { |
40 | hSession->text[baddr].chr = ' '; | 40 | hSession->text[baddr].chr = ' '; |
41 | 41 |
src/lib3270/selection/selection.c
@@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
33 | #include <lib3270/session.h> | 33 | #include <lib3270/session.h> |
34 | #include <lib3270/selection.h> | 34 | #include <lib3270/selection.h> |
35 | #include "3270ds.h" | 35 | #include "3270ds.h" |
36 | + #include "kybdc.h" | ||
36 | 37 | ||
37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 38 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
38 | 39 | ||
@@ -431,3 +432,30 @@ LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int | @@ -431,3 +432,30 @@ LIB3270_EXPORT int lib3270_get_selection_rectangle(H3270 *hSession, unsigned int | ||
431 | return 0; | 432 | return 0; |
432 | } | 433 | } |
433 | 434 | ||
435 | +LIB3270_EXPORT int lib3270_erase_selected(H3270 *hSession) | ||
436 | +{ | ||
437 | + FAIL_IF_NOT_ONLINE(hSession); | ||
438 | + | ||
439 | + if (hSession->kybdlock) | ||
440 | + { | ||
441 | + enq_action(hSession, lib3270_erase_selected); | ||
442 | + return 0; | ||
443 | + } | ||
444 | + | ||
445 | + unsigned int baddr = 0; | ||
446 | + unsigned char fa = 0; | ||
447 | + | ||
448 | + for(baddr = 0; baddr < lib3270_get_length(hSession); baddr++) | ||
449 | + { | ||
450 | + if(hSession->ea_buf[baddr].fa) { | ||
451 | + fa = hSession->ea_buf[baddr].fa; | ||
452 | + } | ||
453 | + | ||
454 | + if( (hSession->text[baddr].attr & LIB3270_ATTR_SELECTED) && !FA_IS_PROTECTED(fa)) | ||
455 | + { | ||
456 | + clear_chr(hSession,baddr); | ||
457 | + } | ||
458 | + } | ||
459 | + | ||
460 | + return -1; | ||
461 | +} |