diff --git a/macros.c b/macros.c index e459704..41ea30d 100644 --- a/macros.c +++ b/macros.c @@ -103,7 +103,7 @@ switch(argc) { case 1: // Get entire screen - buffer = lib3270_get_text(hSession,0,-1); + buffer = lib3270_get_text(hSession,0,-1,'\n'); break; /* diff --git a/screen.c b/screen.c index 3538d25..80489e3 100644 --- a/screen.c +++ b/screen.c @@ -374,7 +374,7 @@ void screen_update(H3270 *session, int bstart, int bend) #ifdef DEBUG { - char *text = lib3270_get_text(session,0,-1); + char *text = lib3270_get_text(session,0,-1,'\n'); trace("First screen:\n%s\n",text); lib3270_free(text); } diff --git a/selection.c b/selection.c index ac3f99a..4425a2c 100644 --- a/selection.c +++ b/selection.c @@ -475,7 +475,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u return lib3270_realloc(text,sz); } -LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) +LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len, char lf) { char * buffer; int maxlen; @@ -517,9 +517,9 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) offset++; len--; - if((offset%h->cols) == 0 && len > 0) + if(lf && (offset%h->cols) == 0 && len > 0) { - *(ptr++) = '\n'; + *(ptr++) = lf; len--; } } @@ -533,7 +533,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) { CHECK_SESSION_HANDLE(h); - return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len); + return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len, '\n'); } 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) if(first < 0) return NULL; - return lib3270_get_text(session,first,lib3270_field_length(session,first)+1); + return lib3270_get_text(session,first,lib3270_field_length(session,first)+1,0); } LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession) -- libgit2 0.21.2