From 1a1e8112973d5ada9af132185af3eb4501695451 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 25 Sep 2019 12:47:22 -0300 Subject: [PATCH] Debugging the new set_field method. --- src/core/keyboard/kybd.c | 1 + src/core/paste.c | 2 +- src/testprogram/testprogram.c | 21 ++++++++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/core/keyboard/kybd.c b/src/core/keyboard/kybd.c index 2ea5768..003e909 100644 --- a/src/core/keyboard/kybd.c +++ b/src/core/keyboard/kybd.c @@ -1666,6 +1666,7 @@ int lib3270_get_field_end(H3270 *hSession, int baddr) if (hSession->ea_buf[baddr].fa) baddr = last_nonblank; } + return baddr; } diff --git a/src/core/paste.c b/src/core/paste.c index 2accbc3..fb306b3 100644 --- a/src/core/paste.c +++ b/src/core/paste.c @@ -323,7 +323,7 @@ LIB3270_EXPORT int lib3270_set_field(H3270 *hSession, const char *text, int leng lib3270_unselect(hSession); hSession->cbk.suspend(hSession); - hSession->cursor_addr = addr; + hSession->cursor_addr = ++addr; numchars = set_string(hSession, (const unsigned char *) text, length); hSession->cbk.resume(hSession); diff --git a/src/testprogram/testprogram.c b/src/testprogram/testprogram.c index 31cd0ca..8d90523 100644 --- a/src/testprogram/testprogram.c +++ b/src/testprogram/testprogram.c @@ -110,9 +110,24 @@ int main(int argc, char *argv[]) lib3270_enter(h); lib3270_wait(h,5); - lib3270_autoptr(char) text = lib3270_get_string_at_address(h,0,-1,'\n'); - if(text) - printf("Screen:\n[%s]\n",text); + { + lib3270_autoptr(char) text = lib3270_get_string_at_address(h,0,-1,'\n'); + if(text) + printf("Screen:\n[%s]\n",text); + + lib3270_wait(h,2); + + } + + { + printf("\n\nSet field exits with %d\n",lib3270_set_field(h,"aaa",-1)); + printf("\n\nSet field exits with %d\n",lib3270_set_field(h,"bbb",-1)); + printf("\n\nSet field exits with %d\n",lib3270_set_field(h,"ccc",-1)); + + lib3270_autoptr(char) text = lib3270_get_string_at_address(h,0,-1,'\n'); + if(text) + printf("Screen:\n[%s]\n",text); + } } -- libgit2 0.21.2