From d033acda77de7e4b5b6eeb5b03265425ec431bd4 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 14 Feb 2018 15:06:15 -0200 Subject: [PATCH] Incluindo tratamento de quebras de linha nas capturas de tela. --- src/include/pw3270/ipcpackets.h | 1 + src/include/pw3270cpp.h | 4 ++-- src/libpw3270cpp/remote.cc | 2 +- src/libpw3270cpp/session.cc | 8 ++++---- src/plugins/hllapi/pluginmain.c | 6 ++++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/include/pw3270/ipcpackets.h b/src/include/pw3270/ipcpackets.h index c90038d..8095a8e 100644 --- a/src/include/pw3270/ipcpackets.h +++ b/src/include/pw3270/ipcpackets.h @@ -134,6 +134,7 @@ struct hllapi_packet_at unsigned short row; unsigned short col; unsigned short len; + char lf; }; struct hllapi_packet_text_at diff --git a/src/include/pw3270cpp.h b/src/include/pw3270cpp.h index 34fd815..93b634d 100644 --- a/src/include/pw3270cpp.h +++ b/src/include/pw3270cpp.h @@ -204,9 +204,9 @@ // Get/Set/Text with charset translation string get_string(int baddr = 0, size_t len = -1, bool lf = false); - string get_string_at(int row, int col, size_t sz); + string get_string_at(int row, int col, size_t sz, bool lf = false); int set_string_at(int row, int col, const char *str); - int cmp_string_at(int row, int col, const char *text); + int cmp_string_at(int row, int col, const char *text, bool lf = false); int wait_for_string_at(int row, int col, const char *key, int timeout); int input_string(const char *str); string get_contents(bool lf = true); diff --git a/src/libpw3270cpp/remote.cc b/src/libpw3270cpp/remote.cc index 1c0fd72..d62f853 100644 --- a/src/libpw3270cpp/remote.cc +++ b/src/libpw3270cpp/remote.cc @@ -1111,7 +1111,7 @@ query->packet_id = HLLAPI_PACKET_CMP_TEXT_AT; query->row = row; query->col = col; - query->lf = lf ? '\n' : 0 + query->lf = lf ? '\n' : 0; strcpy(query->text,text); return query_intval((void *) query, cbSize, true); diff --git a/src/libpw3270cpp/session.cc b/src/libpw3270cpp/session.cc index 86ce0f6..b3dafc8 100644 --- a/src/libpw3270cpp/session.cc +++ b/src/libpw3270cpp/session.cc @@ -515,9 +515,9 @@ return rc; } - string session::get_string_at(int row, int col, size_t sz) + string session::get_string_at(int row, int col, size_t sz, bool lf) { - return this->get_local_text(this->get_text_at(row,col,sz).c_str()); + return this->get_local_text(this->get_text_at(row,col,sz,lf).c_str()); } int session::set_string_at(int row, int col, const char *str) @@ -586,9 +586,9 @@ } - int session::cmp_string_at(int row, int col, const char *text) + int session::cmp_string_at(int row, int col, const char *text, bool lf) { - return cmp_text_at(row,col,get_3270_text(text).c_str()); + return cmp_text_at(row,col,get_3270_text(text).c_str(),lf); } int session::wait_for_string_at(int row, int col, const char *key, int timeout) diff --git a/src/plugins/hllapi/pluginmain.c b/src/plugins/hllapi/pluginmain.c index 6d7ca54..cc9b21b 100644 --- a/src/plugins/hllapi/pluginmain.c +++ b/src/plugins/hllapi/pluginmain.c @@ -300,7 +300,8 @@ send_text(source,lib3270_get_text_at( lib3270_get_default_session_handle(), ((struct hllapi_packet_at *) source->buffer)->row, ((struct hllapi_packet_at *) source->buffer)->col, - ((struct hllapi_packet_at *) source->buffer)->len)); + ((struct hllapi_packet_at *) source->buffer)->len, + ((struct hllapi_packet_at *) source->buffer)->lf)); break; case HLLAPI_PACKET_GET_TEXT_AT_OFFSET: @@ -314,7 +315,8 @@ send_result(source,lib3270_cmp_text_at( lib3270_get_default_session_handle(), ((struct hllapi_packet_text_at *) source->buffer)->row, ((struct hllapi_packet_text_at *) source->buffer)->col, - ((struct hllapi_packet_text_at *) source->buffer)->text)); + ((struct hllapi_packet_text_at *) source->buffer)->text, + ((struct hllapi_packet_text_at *) source->buffer)->lf)); break; case HLLAPI_PACKET_INPUT_STRING: -- libgit2 0.21.2