diff --git a/src/include/lib3270.h b/src/include/lib3270.h
index 26c84d8..93335fd 100644
--- a/src/include/lib3270.h
+++ b/src/include/lib3270.h
@@ -921,11 +921,12 @@
* @param row Desired row.
* @param col Desired col.
* @param length Text length
+ * @param lf Line break char (0 to disable line breaks).
*
* @return Contents at position if available, or NULL. Release it with lib3270_free()
*
*/
- LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len);
+ LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len, char lf);
/**
* Check for text at requested position
@@ -934,11 +935,12 @@
* @param row Desired row.
* @param col Desired col.
* @param text Text to check.
+ * @param lf Line break char (0 to disable line breaks).
*
* @return Test result from strcmp
*
*/
- LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text);
+ LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text, char lf);
/**
diff --git a/src/include/pw3270/ipcpackets.h b/src/include/pw3270/ipcpackets.h
index 5365386..c90038d 100644
--- a/src/include/pw3270/ipcpackets.h
+++ b/src/include/pw3270/ipcpackets.h
@@ -141,6 +141,7 @@ struct hllapi_packet_text_at
unsigned char packet_id;
unsigned short row;
unsigned short col;
+ char lf;
char text[1];
};
@@ -150,6 +151,7 @@ struct hllapi_packet_query_at
unsigned short row;
unsigned short col;
unsigned short len;
+ char lf;
};
struct hllapi_packet_wait
diff --git a/src/include/pw3270cpp.h b/src/include/pw3270cpp.h
index 7c4cc21..34fd815 100644
--- a/src/include/pw3270cpp.h
+++ b/src/include/pw3270cpp.h
@@ -274,11 +274,11 @@
session();
// Get/Set/Test without charset translation
- virtual string get_text(int baddr = 0, size_t len = 1, bool lf = false) = 0;
- virtual string get_text_at(int row, int col, size_t sz) = 0;
- virtual int set_text_at(int row, int col, const char *str) = 0;
- virtual int cmp_text_at(int row, int col, const char *text) = 0;
- virtual int emulate_input(const char *str) = 0;
+ virtual string get_text(int baddr = 0, size_t len = 1, bool lf = false) = 0;
+ virtual string get_text_at(int row, int col, size_t sz, bool lf = false) = 0;
+ virtual int set_text_at(int row, int col, const char *str) = 0;
+ virtual int cmp_text_at(int row, int col, const char *text, bool lf = false) = 0;
+ virtual int emulate_input(const char *str) = 0;
virtual int wait_for_text_at(int row, int col, const char *key, int timeout);
private:
diff --git a/src/lib3270/selection.c b/src/lib3270/selection.c
index 4425a2c..81888cc 100644
--- a/src/lib3270/selection.c
+++ b/src/lib3270/selection.c
@@ -530,19 +530,19 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len, char lf)
return buffer;
}
-LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len)
+LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len, char lf)
{
CHECK_SESSION_HANDLE(h);
- return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len, '\n');
+ return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len, lf);
}
-LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text)
+LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text, char lf)
{
int rc;
size_t sz = strlen(text);
char * contents;
- contents = lib3270_get_text_at(h,row,col,sz);
+ contents = lib3270_get_text_at(h,row,col,sz,lf);
if(!contents)
return -1;
diff --git a/src/libpw3270cpp/local.cc b/src/libpw3270cpp/local.cc
index 4da465c..e2aa2e9 100644
--- a/src/libpw3270cpp/local.cc
+++ b/src/libpw3270cpp/local.cc
@@ -138,8 +138,8 @@
int (*_pakey)(H3270 *hSession, int key);
int (*_wait_for_ready)(H3270 *hSession, int seconds);
char * (*_get_text)(H3270 *h, int offset, int len, char lf);
- char * (*_get_text_at)(H3270 *h, int row, int col, int len);
- int (*_cmp_text_at)(H3270 *h, int row, int col, const char *text);
+ char * (*_get_text_at)(H3270 *h, int row, int col, int len, char lf);
+ int (*_cmp_text_at)(H3270 *h, int row, int col, const char *text, char lf);
int (*_set_text_at)(H3270 *h, int row, int col, const unsigned char *str);
int (*_is_ready)(H3270 *h);
int (*_set_cursor_position)(H3270 *h, int row, int col);
@@ -353,10 +353,10 @@
return 0;
}
- string get_text_at(int row, int col, size_t sz)
+ string get_text_at(int row, int col, size_t sz, bool lf)
{
string rc;
- char * ptr = _get_text_at(hSession,row,col,sz);
+ char * ptr = _get_text_at(hSession,row,col,sz,lf ? '\n' : 0);
if(ptr)
{
@@ -372,9 +372,9 @@
return _set_text_at(hSession,row,col,(const unsigned char *) str);
}
- int cmp_text_at(int row, int col, const char *text)
+ int cmp_text_at(int row, int col, const char *text, bool lf)
{
- return _cmp_text_at(hSession,row,col,text);
+ return _cmp_text_at(hSession,row,col,text,lf ? '\n' : 0);
}
string get_text(int offset, size_t len, bool lf)
diff --git a/src/libpw3270cpp/remote.cc b/src/libpw3270cpp/remote.cc
index 326bdf5..1c0fd72 100644
--- a/src/libpw3270cpp/remote.cc
+++ b/src/libpw3270cpp/remote.cc
@@ -1031,11 +1031,11 @@
#endif
}
- string get_text_at(int row, int col, size_t sz)
+ string get_text_at(int row, int col, size_t sz, bool lf)
{
#if defined(WIN32)
- struct hllapi_packet_query_at query = { HLLAPI_PACKET_GET_TEXT_AT, (unsigned short) row, (unsigned short) col, (unsigned short) sz };
+ struct hllapi_packet_query_at query = { HLLAPI_PACKET_GET_TEXT_AT, (unsigned short) row, (unsigned short) col, (unsigned short) sz, lf ? '\n' : 0 };
return query_string(&query,sizeof(query),sz);
@@ -1044,13 +1044,14 @@
dbus_int32_t r = (dbus_int32_t) row;
dbus_int32_t c = (dbus_int32_t) col;
dbus_int32_t l = (dbus_int32_t) sz;
+ unsigned char d = lf ? '\n' : 0;
DBusMessage * msg = create_message("getTextAt");
if(!msg)
return NULL;
trace("%s(%d,%d,%d)",__FUNCTION__,r,c,l);
- dbus_message_append_args(msg, DBUS_TYPE_INT32, &r, DBUS_TYPE_INT32, &c, DBUS_TYPE_INT32, &l, DBUS_TYPE_INVALID);
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &r, DBUS_TYPE_INT32, &c, DBUS_TYPE_INT32, &l, DBUS_TYPE_BYTE, &d, DBUS_TYPE_INVALID);
return get_string(call(msg));
@@ -1097,7 +1098,7 @@
}
- int cmp_text_at(int row, int col, const char *text)
+ int cmp_text_at(int row, int col, const char *text, bool lf)
{
debug("%s(%d,%d,\"%s\")",__FUNCTION__,row,col,text);
@@ -1110,6 +1111,7 @@
query->packet_id = HLLAPI_PACKET_CMP_TEXT_AT;
query->row = row;
query->col = col;
+ query->lf = lf ? '\n' : 0
strcpy(query->text,text);
return query_intval((void *) query, cbSize, true);
@@ -1118,8 +1120,9 @@
dbus_int32_t r = (dbus_int32_t) row;
dbus_int32_t c = (dbus_int32_t) col;
+ unsigned char d = lf ? '\n' : 0;
- return query_intval("cmpTextAt", DBUS_TYPE_INT32, &r, DBUS_TYPE_INT32, &c, DBUS_TYPE_STRING, &text, DBUS_TYPE_INVALID);
+ return query_intval("cmpTextAt", DBUS_TYPE_INT32, &r, DBUS_TYPE_INT32, &c, DBUS_TYPE_STRING, &text, DBUS_TYPE_BYTE, &d, DBUS_TYPE_INVALID);
#endif
@@ -1135,7 +1138,7 @@
if(!is_connected())
return ENOTCONN;
- if(!cmp_text_at(row,col,key))
+ if(!cmp_text_at(row,col,key,false))
return 0;
#ifdef WIN32
diff --git a/src/libpw3270cpp/service.cc b/src/libpw3270cpp/service.cc
index c6bfa23..ac4816d 100644
--- a/src/libpw3270cpp/service.cc
+++ b/src/libpw3270cpp/service.cc
@@ -213,17 +213,19 @@
}
- virtual string get_text_at(int row, int col, size_t sz)
+ virtual string get_text_at(int row, int col, size_t sz, bool lf = true)
{
dbus_int32_t r = (dbus_int32_t) row;
dbus_int32_t c = (dbus_int32_t) col;
dbus_int32_t s = (dbus_int32_t) sz;
+ char l = lf ? '\n' : 0;
return getString( "getTextAt",
DBUS_TYPE_STRING, &this->id,
DBUS_TYPE_INT32, &r,
DBUS_TYPE_INT32, &c,
DBUS_TYPE_INT32, &s,
+ DBUS_TYPE_BYTE, &l,
DBUS_TYPE_INVALID);
}
@@ -241,16 +243,18 @@
DBUS_TYPE_INVALID);
}
- virtual int cmp_text_at(int row, int col, const char *str)
+ virtual int cmp_text_at(int row, int col, const char *str, bool lf)
{
dbus_int32_t r = (dbus_int32_t) row;
dbus_int32_t c = (dbus_int32_t) col;
+ char l = lf ? '\n' : 0;
return getInteger( "cmpTextAt",
DBUS_TYPE_STRING, &this->id,
DBUS_TYPE_INT32, &r,
DBUS_TYPE_INT32, &c,
DBUS_TYPE_STRING, &str,
+ DBUS_TYPE_BYTE, &l,
DBUS_TYPE_INVALID);
}
diff --git a/src/plugins/dbus3270/gobject.c b/src/plugins/dbus3270/gobject.c
index ecec062..0417c8b 100644
--- a/src/plugins/dbus3270/gobject.c
+++ b/src/plugins/dbus3270/gobject.c
@@ -286,7 +286,7 @@ void pw3270_dbus_input(PW3270Dbus *object, const gchar *utftext, DBusGMethodInvo
}
-void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBusGMethodInvocation *context)
+void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, char lf, DBusGMethodInvocation *context)
{
gchar * text;
H3270 * hSession = pw3270_dbus_get_session_handle(object);
@@ -295,7 +295,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus
if(pw3270_dbus_check_valid_state(object,context))
return;
- text = lib3270_get_text_at(hSession, row, col, len);
+ text = lib3270_get_text_at(hSession, row, col, len, lf);
if(!text)
{
GError *error = pw3270_dbus_get_error_from_errno(errno);
@@ -415,7 +415,7 @@ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBus
dbus_g_method_return(context,lib3270_set_toggle(pw3270_dbus_get_session_handle(object),id,value));
}
-void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *utftext, DBusGMethodInvocation *context)
+void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *utftext, char lf, DBusGMethodInvocation *context)
{
gchar * text;
H3270 * hSession = pw3270_dbus_get_session_handle(object);
@@ -426,7 +426,7 @@ void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *
text = g_convert_with_fallback(utftext,-1,lib3270_get_display_charset(hSession),"UTF-8","?",NULL,NULL,NULL);
- dbus_g_method_return(context,lib3270_cmp_text_at(hSession,row,col,text));
+ dbus_g_method_return(context,lib3270_cmp_text_at(hSession,row,col,text,lf));
g_free(text);
}
diff --git a/src/plugins/dbus3270/pw3270dbus.xml b/src/plugins/dbus3270/pw3270dbus.xml
index f289efc..aee27c0 100644
--- a/src/plugins/dbus3270/pw3270dbus.xml
+++ b/src/plugins/dbus3270/pw3270dbus.xml
@@ -73,6 +73,7 @@
+
@@ -162,6 +163,7 @@
+
diff --git a/src/plugins/dbus3270/service.h b/src/plugins/dbus3270/service.h
index a98d382..aba8322 100644
--- a/src/plugins/dbus3270/service.h
+++ b/src/plugins/dbus3270/service.h
@@ -112,9 +112,9 @@
void pw3270_dbus_pf_key(PW3270Dbus *object, int key, DBusGMethodInvocation *context);
void pw3270_dbus_pa_key(PW3270Dbus *object, int key, DBusGMethodInvocation *context);
void pw3270_dbus_set_text_at(PW3270Dbus *object, int row, int col, const gchar *text, DBusGMethodInvocation *context);
- void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, DBusGMethodInvocation *context);
+ void pw3270_dbus_get_text_at(PW3270Dbus *object, int row, int col, int len, char lf, DBusGMethodInvocation *context);
void pw3270_dbus_get_text(PW3270Dbus *object, int offset, int len, char lf, DBusGMethodInvocation *context);
- void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *text, DBusGMethodInvocation *context);
+ void pw3270_dbus_cmp_text_at(PW3270Dbus *object, int row, int col, const gchar *text, char lf, DBusGMethodInvocation *context);
void pw3270_dbus_input(PW3270Dbus *object, const gchar *utftext, DBusGMethodInvocation *context);
void pw3270_dbus_set_clipboard(PW3270Dbus *object, const gchar *text, DBusGMethodInvocation *context);
--
libgit2 0.21.2