Commit 1e6e062f9716c1a129d71ab98b1844dea0c90711
1 parent
954cd60b
Exists in
master
and in
3 other branches
Fixing error on select from keyboard.
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
src/lib3270/cursor.c
@@ -77,6 +77,8 @@ static int cursor_end(H3270 *hSession); | @@ -77,6 +77,8 @@ static int cursor_end(H3270 *hSession); | ||
77 | */ | 77 | */ |
78 | LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, unsigned char sel) | 78 | LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, unsigned char sel) |
79 | { | 79 | { |
80 | + int select_from = -1; | ||
81 | + | ||
80 | FAIL_IF_NOT_ONLINE(hSession); | 82 | FAIL_IF_NOT_ONLINE(hSession); |
81 | 83 | ||
82 | if(dir < 0 || dir >= LIB3270_DIR_COUNT) | 84 | if(dir < 0 || dir >= LIB3270_DIR_COUNT) |
@@ -102,12 +104,16 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u | @@ -102,12 +104,16 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u | ||
102 | } | 104 | } |
103 | } | 105 | } |
104 | 106 | ||
107 | + if(sel) { | ||
108 | + select_from = (hSession->selected ? hSession->select.start : hSession->cursor_addr); | ||
109 | + } | ||
110 | + | ||
105 | int rc = calls[dir].exec(hSession); | 111 | int rc = calls[dir].exec(hSession); |
106 | if(rc) | 112 | if(rc) |
107 | return rc; | 113 | return rc; |
108 | 114 | ||
109 | if(sel) | 115 | if(sel) |
110 | - lib3270_select_to(hSession,hSession->cursor_addr); | 116 | + lib3270_select_region(hSession, select_from, hSession->cursor_addr); |
111 | else if(hSession->selected && !lib3270_get_toggle(hSession,LIB3270_TOGGLE_KEEP_SELECTED)) | 117 | else if(hSession->selected && !lib3270_get_toggle(hSession,LIB3270_TOGGLE_KEEP_SELECTED)) |
112 | lib3270_unselect(hSession); | 118 | lib3270_unselect(hSession); |
113 | 119 |