From 1e6e062f9716c1a129d71ab98b1844dea0c90711 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Mon, 29 Apr 2019 15:53:41 -0300 Subject: [PATCH] Fixing error on select from keyboard. --- src/lib3270/cursor.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib3270/cursor.c b/src/lib3270/cursor.c index 1ffa6cb..c45d79f 100644 --- a/src/lib3270/cursor.c +++ b/src/lib3270/cursor.c @@ -77,6 +77,8 @@ static int cursor_end(H3270 *hSession); */ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, unsigned char sel) { + int select_from = -1; + FAIL_IF_NOT_ONLINE(hSession); if(dir < 0 || dir >= LIB3270_DIR_COUNT) @@ -102,12 +104,16 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u } } + if(sel) { + select_from = (hSession->selected ? hSession->select.start : hSession->cursor_addr); + } + int rc = calls[dir].exec(hSession); if(rc) return rc; if(sel) - lib3270_select_to(hSession,hSession->cursor_addr); + lib3270_select_region(hSession, select_from, hSession->cursor_addr); else if(hSession->selected && !lib3270_get_toggle(hSession,LIB3270_TOGGLE_KEEP_SELECTED)) lib3270_unselect(hSession); -- libgit2 0.21.2