Commit f731fcdfbab33937bc642f420c426eaab99e18df
1 parent
df26bc3c
Exists in
master
and in
5 other branches
Incluindo opção para definir o delimitador de linha ao carregar o conteúdo da tela.
Showing
11 changed files
with
21 additions
and
20 deletions
Show diff stats
android/jni/main.cpp
| @@ -78,7 +78,7 @@ static void changed(H3270 *session, int offset, int len) | @@ -78,7 +78,7 @@ static void changed(H3270 *session, int offset, int len) | ||
| 78 | trace("%s: offset=%d len=%d",__FUNCTION__,offset,len); | 78 | trace("%s: offset=%d len=%d",__FUNCTION__,offset,len); |
| 79 | 79 | ||
| 80 | { | 80 | { |
| 81 | - char *text = lib3270_get_text(PW3270_SESSION,0,-1); | 81 | + char *text = lib3270_get_text(PW3270_SESSION,0,-1,'\n'); |
| 82 | if(text) | 82 | if(text) |
| 83 | { | 83 | { |
| 84 | char *strtok_r(char *str, const char *delim, char **saveptr); | 84 | char *strtok_r(char *str, const char *delim, char **saveptr); |
android/jni/text.cpp
| @@ -76,7 +76,7 @@ JNIEXPORT jbyteArray JNICALL Java_br_com_bb_pw3270_lib3270_getText(JNIEnv *env, | @@ -76,7 +76,7 @@ JNIEXPORT jbyteArray JNICALL Java_br_com_bb_pw3270_lib3270_getText(JNIEnv *env, | ||
| 76 | 76 | ||
| 77 | // trace("%s starts",__FUNCTION__); | 77 | // trace("%s starts",__FUNCTION__); |
| 78 | 78 | ||
| 79 | - char *text = lib3270_get_text(PW3270_SESSION,0,-1); | 79 | + char *text = lib3270_get_text(PW3270_SESSION,0,-1,'\n'); |
| 80 | 80 | ||
| 81 | if(text) | 81 | if(text) |
| 82 | { | 82 | { |
src/include/lib3270.h
| @@ -907,11 +907,12 @@ | @@ -907,11 +907,12 @@ | ||
| 907 | * @param h Session Handle. | 907 | * @param h Session Handle. |
| 908 | * @param offset Start position. | 908 | * @param offset Start position. |
| 909 | * @param len Text length or -1 to all text. | 909 | * @param len Text length or -1 to all text. |
| 910 | + * @param lf Line break char (0 to disable line breaks). | ||
| 910 | * | 911 | * |
| 911 | * @return Contents at position if available, or NULL. Release it with lib3270_free() | 912 | * @return Contents at position if available, or NULL. Release it with lib3270_free() |
| 912 | * | 913 | * |
| 913 | */ | 914 | */ |
| 914 | - LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len); | 915 | + LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len, char lf); |
| 915 | 916 | ||
| 916 | /** | 917 | /** |
| 917 | * Get text at requested position | 918 | * Get text at requested position |
src/lib3270/macros.c
src/lib3270/screen.c
| @@ -374,7 +374,7 @@ void screen_update(H3270 *session, int bstart, int bend) | @@ -374,7 +374,7 @@ void screen_update(H3270 *session, int bstart, int bend) | ||
| 374 | 374 | ||
| 375 | #ifdef DEBUG | 375 | #ifdef DEBUG |
| 376 | { | 376 | { |
| 377 | - char *text = lib3270_get_text(session,0,-1); | 377 | + char *text = lib3270_get_text(session,0,-1,'\n'); |
| 378 | trace("First screen:\n%s\n",text); | 378 | trace("First screen:\n%s\n",text); |
| 379 | lib3270_free(text); | 379 | lib3270_free(text); |
| 380 | } | 380 | } |
src/lib3270/selection.c
| @@ -475,7 +475,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u | @@ -475,7 +475,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u | ||
| 475 | return lib3270_realloc(text,sz); | 475 | return lib3270_realloc(text,sz); |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | -LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | 478 | +LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len, char lf) |
| 479 | { | 479 | { |
| 480 | char * buffer; | 480 | char * buffer; |
| 481 | int maxlen; | 481 | int maxlen; |
| @@ -517,9 +517,9 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -517,9 +517,9 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
| 517 | offset++; | 517 | offset++; |
| 518 | len--; | 518 | len--; |
| 519 | 519 | ||
| 520 | - if((offset%h->cols) == 0 && len > 0) | 520 | + if(lf && (offset%h->cols) == 0 && len > 0) |
| 521 | { | 521 | { |
| 522 | - *(ptr++) = '\n'; | 522 | + *(ptr++) = lf; |
| 523 | len--; | 523 | len--; |
| 524 | } | 524 | } |
| 525 | } | 525 | } |
| @@ -533,7 +533,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -533,7 +533,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
| 533 | LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) | 533 | LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) |
| 534 | { | 534 | { |
| 535 | CHECK_SESSION_HANDLE(h); | 535 | CHECK_SESSION_HANDLE(h); |
| 536 | - return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len); | 536 | + return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len, '\n'); |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text) | 539 | LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text) |
| @@ -569,7 +569,7 @@ LIB3270_EXPORT char * lib3270_get_field_at(H3270 *session, int baddr) | @@ -569,7 +569,7 @@ LIB3270_EXPORT char * lib3270_get_field_at(H3270 *session, int baddr) | ||
| 569 | if(first < 0) | 569 | if(first < 0) |
| 570 | return NULL; | 570 | return NULL; |
| 571 | 571 | ||
| 572 | - return lib3270_get_text(session,first,lib3270_field_length(session,first)+1); | 572 | + return lib3270_get_text(session,first,lib3270_field_length(session,first)+1,0); |
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession) | 575 | LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession) |
src/libpw3270cpp/local.cc
| @@ -137,7 +137,7 @@ | @@ -137,7 +137,7 @@ | ||
| 137 | int (*_pfkey)(H3270 *hSession, int key); | 137 | int (*_pfkey)(H3270 *hSession, int key); |
| 138 | int (*_pakey)(H3270 *hSession, int key); | 138 | int (*_pakey)(H3270 *hSession, int key); |
| 139 | int (*_wait_for_ready)(H3270 *hSession, int seconds); | 139 | int (*_wait_for_ready)(H3270 *hSession, int seconds); |
| 140 | - char * (*_get_text)(H3270 *h, int offset, int len); | 140 | + char * (*_get_text)(H3270 *h, int offset, int len, char lf); |
| 141 | char * (*_get_text_at)(H3270 *h, int row, int col, int len); | 141 | char * (*_get_text_at)(H3270 *h, int row, int col, int len); |
| 142 | int (*_cmp_text_at)(H3270 *h, int row, int col, const char *text); | 142 | int (*_cmp_text_at)(H3270 *h, int row, int col, const char *text); |
| 143 | int (*_set_text_at)(H3270 *h, int row, int col, const unsigned char *str); | 143 | int (*_set_text_at)(H3270 *h, int row, int col, const unsigned char *str); |
| @@ -380,7 +380,7 @@ | @@ -380,7 +380,7 @@ | ||
| 380 | string get_text(int offset, size_t len) | 380 | string get_text(int offset, size_t len) |
| 381 | { | 381 | { |
| 382 | string rc; | 382 | string rc; |
| 383 | - char * ptr = _get_text(hSession,offset,len); | 383 | + char * ptr = _get_text(hSession,offset,len,'\n'); |
| 384 | 384 | ||
| 385 | if(ptr) | 385 | if(ptr) |
| 386 | { | 386 | { |
src/plugins/dbus3270/gobject.c
| @@ -230,7 +230,7 @@ void pw3270_dbus_get_screen_contents(PW3270Dbus *object, DBusGMethodInvocation * | @@ -230,7 +230,7 @@ void pw3270_dbus_get_screen_contents(PW3270Dbus *object, DBusGMethodInvocation * | ||
| 230 | if(pw3270_dbus_check_valid_state(object,context)) | 230 | if(pw3270_dbus_check_valid_state(object,context)) |
| 231 | return; | 231 | return; |
| 232 | 232 | ||
| 233 | - text = lib3270_get_text(hSession,0,-1); | 233 | + text = lib3270_get_text(hSession,0,-1,'\n'); |
| 234 | 234 | ||
| 235 | utftext = g_convert_with_fallback(text,-1,"UTF-8",lib3270_get_display_charset(hSession),"?",NULL,NULL,NULL); | 235 | utftext = g_convert_with_fallback(text,-1,"UTF-8",lib3270_get_display_charset(hSession),"?",NULL,NULL,NULL); |
| 236 | 236 | ||
| @@ -323,7 +323,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus | @@ -323,7 +323,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus | ||
| 323 | if(pw3270_dbus_check_valid_state(object,context)) | 323 | if(pw3270_dbus_check_valid_state(object,context)) |
| 324 | return; | 324 | return; |
| 325 | 325 | ||
| 326 | - text = lib3270_get_text(hSession,offset,len); | 326 | + text = lib3270_get_text(hSession,offset,len,'\n'); |
| 327 | if(!text) | 327 | if(!text) |
| 328 | { | 328 | { |
| 329 | GError *error = pw3270_dbus_get_error_from_errno(errno); | 329 | GError *error = pw3270_dbus_get_error_from_errno(errno); |
src/pw3270/v3270/accessible.c
| @@ -185,7 +185,7 @@ static gunichar v3270_accessible_get_character_at_offset(AtkText *atk_text, gint | @@ -185,7 +185,7 @@ static gunichar v3270_accessible_get_character_at_offset(AtkText *atk_text, gint | ||
| 185 | if(widget == NULL) | 185 | if(widget == NULL) |
| 186 | { | 186 | { |
| 187 | H3270 * host = v3270_get_session(widget); | 187 | H3270 * host = v3270_get_session(widget); |
| 188 | - gchar * text = lib3270_get_text(host,offset,1); | 188 | + gchar * text = lib3270_get_text(host,offset,1,'\n'); |
| 189 | 189 | ||
| 190 | if(text) | 190 | if(text) |
| 191 | { | 191 | { |
| @@ -346,7 +346,7 @@ static gchar * v3270_accessible_get_text_at_offset(AtkText *atk_text, gint offse | @@ -346,7 +346,7 @@ static gchar * v3270_accessible_get_text_at_offset(AtkText *atk_text, gint offse | ||
| 346 | case ATK_TEXT_BOUNDARY_CHAR: // Boundary is the boundary between characters | 346 | case ATK_TEXT_BOUNDARY_CHAR: // Boundary is the boundary between characters |
| 347 | // (including non-printing characters) | 347 | // (including non-printing characters) |
| 348 | 348 | ||
| 349 | - text = lib3270_get_text(host,offset,1); | 349 | + text = lib3270_get_text(host,offset,1,'\n'); |
| 350 | break; | 350 | break; |
| 351 | 351 | ||
| 352 | case ATK_TEXT_BOUNDARY_WORD_START: // Boundary is the start (i.e. first character) of a word. | 352 | case ATK_TEXT_BOUNDARY_WORD_START: // Boundary is the start (i.e. first character) of a word. |
| @@ -373,7 +373,7 @@ static gchar * v3270_accessible_get_text_at_offset(AtkText *atk_text, gint offse | @@ -373,7 +373,7 @@ static gchar * v3270_accessible_get_text_at_offset(AtkText *atk_text, gint offse | ||
| 373 | pos = (offset/cols)*cols; | 373 | pos = (offset/cols)*cols; |
| 374 | if(pos == offset) | 374 | if(pos == offset) |
| 375 | offset++; | 375 | offset++; |
| 376 | - text = lib3270_get_text(host,pos,(offset-pos)); | 376 | + text = lib3270_get_text(host,pos,(offset-pos),'\n'); |
| 377 | break; | 377 | break; |
| 378 | 378 | ||
| 379 | 379 | ||
| @@ -426,7 +426,7 @@ static gchar * v3270_accessible_get_text(AtkText *atk_text, gint start_pos, gint | @@ -426,7 +426,7 @@ static gchar * v3270_accessible_get_text(AtkText *atk_text, gint start_pos, gint | ||
| 426 | if(!lib3270_connected(host)) | 426 | if(!lib3270_connected(host)) |
| 427 | return g_strdup( "" ); | 427 | return g_strdup( "" ); |
| 428 | 428 | ||
| 429 | - text = lib3270_get_text(host,start_pos,end_pos < start_pos ? -1 : (end_pos - start_pos)); | 429 | + text = lib3270_get_text(host,start_pos,end_pos < start_pos ? -1 : (end_pos - start_pos),'\n'); |
| 430 | 430 | ||
| 431 | if(text) | 431 | if(text) |
| 432 | { | 432 | { |
src/pw3270/v3270/selection.c
| @@ -99,7 +99,7 @@ gchar * v3270_get_text(GtkWidget *widget, int offset, int len) | @@ -99,7 +99,7 @@ gchar * v3270_get_text(GtkWidget *widget, int offset, int len) | ||
| 99 | 99 | ||
| 100 | terminal = GTK_V3270(widget); | 100 | terminal = GTK_V3270(widget); |
| 101 | 101 | ||
| 102 | - str = lib3270_get_text(terminal->host, offset, len); | 102 | + str = lib3270_get_text(terminal->host, offset, len, '\n'); |
| 103 | 103 | ||
| 104 | if(!str) | 104 | if(!str) |
| 105 | return NULL; | 105 | return NULL; |
src/pw3270/v3270/widget.c
| @@ -826,7 +826,7 @@ static void changed(H3270 *session, int offset, int len) | @@ -826,7 +826,7 @@ static void changed(H3270 *session, int offset, int len) | ||
| 826 | { | 826 | { |
| 827 | // Get new text, notify atk | 827 | // Get new text, notify atk |
| 828 | gsize bytes_written = 0; | 828 | gsize bytes_written = 0; |
| 829 | - char * text = lib3270_get_text(session,offset,len); | 829 | + char * text = lib3270_get_text(session,offset,len,'\n'); |
| 830 | 830 | ||
| 831 | if(text) | 831 | if(text) |
| 832 | { | 832 | { |