Commit 2083e8680040715339f8c93883df51ba054df13b
1 parent
7c8e110b
Exists in
master
and in
3 other branches
Acessibilidade, incluindo limpeza da area selecionada ao mover o cursor, incluin…
…do tratamento multi-sessao em mais métodos de biblioteca
Showing
11 changed files
with
267 additions
and
358 deletions
Show diff stats
ansi.c
@@ -520,7 +520,7 @@ dec_restore_cursor(int ig1 unused, int ig2 unused) | @@ -520,7 +520,7 @@ dec_restore_cursor(int ig1 unused, int ig2 unused) | ||
520 | fg = saved_fg; | 520 | fg = saved_fg; |
521 | bg = saved_bg; | 521 | bg = saved_bg; |
522 | gr = saved_gr; | 522 | gr = saved_gr; |
523 | - cursor_move(saved_cursor); | 523 | + cursor_move(&h3270,saved_cursor); |
524 | held_wrap = False; | 524 | held_wrap = False; |
525 | return DATA; | 525 | return DATA; |
526 | } | 526 | } |
@@ -530,10 +530,10 @@ ansi_newline(int ig1 unused, int ig2 unused) | @@ -530,10 +530,10 @@ ansi_newline(int ig1 unused, int ig2 unused) | ||
530 | { | 530 | { |
531 | int nc; | 531 | int nc; |
532 | 532 | ||
533 | - cursor_move(h3270.cursor_addr - (h3270.cursor_addr % h3270.cols)); | 533 | + cursor_move(&h3270,h3270.cursor_addr - (h3270.cursor_addr % h3270.cols)); |
534 | nc = h3270.cursor_addr + h3270.cols; | 534 | nc = h3270.cursor_addr + h3270.cols; |
535 | if (nc < scroll_bottom * h3270.cols) | 535 | if (nc < scroll_bottom * h3270.cols) |
536 | - cursor_move(nc); | 536 | + cursor_move(&h3270,nc); |
537 | else | 537 | else |
538 | ansi_scroll(); | 538 | ansi_scroll(); |
539 | held_wrap = False; | 539 | held_wrap = False; |
@@ -549,9 +549,9 @@ ansi_cursor_up(int nn, int ig2 unused) | @@ -549,9 +549,9 @@ ansi_cursor_up(int nn, int ig2 unused) | ||
549 | nn = 1; | 549 | nn = 1; |
550 | rr = h3270.cursor_addr / h3270.cols; | 550 | rr = h3270.cursor_addr / h3270.cols; |
551 | if (rr - nn < 0) | 551 | if (rr - nn < 0) |
552 | - cursor_move(h3270.cursor_addr % h3270.cols); | 552 | + cursor_move(&h3270, h3270.cursor_addr % h3270.cols); |
553 | else | 553 | else |
554 | - cursor_move(h3270.cursor_addr - (nn * h3270.cols)); | 554 | + cursor_move(&h3270, h3270.cursor_addr - (nn * h3270.cols)); |
555 | held_wrap = False; | 555 | held_wrap = False; |
556 | return DATA; | 556 | return DATA; |
557 | } | 557 | } |
@@ -647,9 +647,9 @@ ansi_cursor_down(int nn, int ig2 unused) | @@ -647,9 +647,9 @@ ansi_cursor_down(int nn, int ig2 unused) | ||
647 | nn = 1; | 647 | nn = 1; |
648 | rr = h3270.cursor_addr / h3270.cols; | 648 | rr = h3270.cursor_addr / h3270.cols; |
649 | if (rr + nn >= h3270.cols) | 649 | if (rr + nn >= h3270.cols) |
650 | - cursor_move((h3270.cols-1)*h3270.cols + (h3270.cursor_addr%h3270.cols)); | 650 | + cursor_move(&h3270,(h3270.cols-1)*h3270.cols + (h3270.cursor_addr%h3270.cols)); |
651 | else | 651 | else |
652 | - cursor_move(h3270.cursor_addr + (nn * h3270.cols)); | 652 | + cursor_move(&h3270,h3270.cursor_addr + (nn * h3270.cols)); |
653 | held_wrap = False; | 653 | held_wrap = False; |
654 | return DATA; | 654 | return DATA; |
655 | } | 655 | } |
@@ -666,7 +666,7 @@ ansi_cursor_right(int nn, int ig2 unused) | @@ -666,7 +666,7 @@ ansi_cursor_right(int nn, int ig2 unused) | ||
666 | return DATA; | 666 | return DATA; |
667 | if (cc + nn >= h3270.cols) | 667 | if (cc + nn >= h3270.cols) |
668 | nn = h3270.cols - 1 - cc; | 668 | nn = h3270.cols - 1 - cc; |
669 | - cursor_move(h3270.cursor_addr + nn); | 669 | + cursor_move(&h3270,h3270.cursor_addr + nn); |
670 | held_wrap = False; | 670 | held_wrap = False; |
671 | return DATA; | 671 | return DATA; |
672 | } | 672 | } |
@@ -687,7 +687,7 @@ ansi_cursor_left(int nn, int ig2 unused) | @@ -687,7 +687,7 @@ ansi_cursor_left(int nn, int ig2 unused) | ||
687 | return DATA; | 687 | return DATA; |
688 | if (nn > cc) | 688 | if (nn > cc) |
689 | nn = cc; | 689 | nn = cc; |
690 | - cursor_move(h3270.cursor_addr - nn); | 690 | + cursor_move(&h3270,h3270.cursor_addr - nn); |
691 | return DATA; | 691 | return DATA; |
692 | } | 692 | } |
693 | 693 | ||
@@ -698,7 +698,7 @@ ansi_cursor_motion(int n1, int n2) | @@ -698,7 +698,7 @@ ansi_cursor_motion(int n1, int n2) | ||
698 | if (n1 > h3270.rows) n1 = h3270.rows; | 698 | if (n1 > h3270.rows) n1 = h3270.rows; |
699 | if (n2 < 1) n2 = 1; | 699 | if (n2 < 1) n2 = 1; |
700 | if (n2 > h3270.cols) n2 = h3270.cols; | 700 | if (n2 > h3270.cols) n2 = h3270.cols; |
701 | - cursor_move((n1 - 1) * h3270.cols + (n2 - 1)); | 701 | + cursor_move(&h3270,(n1 - 1) * h3270.cols + (n2 - 1)); |
702 | held_wrap = False; | 702 | held_wrap = False; |
703 | return DATA; | 703 | return DATA; |
704 | } | 704 | } |
@@ -936,10 +936,10 @@ ansi_backspace(int ig1 unused, int ig2 unused) | @@ -936,10 +936,10 @@ ansi_backspace(int ig1 unused, int ig2 unused) | ||
936 | } | 936 | } |
937 | if (rev_wraparound_mode) { | 937 | if (rev_wraparound_mode) { |
938 | if (h3270.cursor_addr > (scroll_top - 1) * h3270.cols) | 938 | if (h3270.cursor_addr > (scroll_top - 1) * h3270.cols) |
939 | - cursor_move(h3270.cursor_addr - 1); | 939 | + cursor_move(&h3270,h3270.cursor_addr - 1); |
940 | } else { | 940 | } else { |
941 | if (h3270.cursor_addr % h3270.cols) | 941 | if (h3270.cursor_addr % h3270.cols) |
942 | - cursor_move(h3270.cursor_addr - 1); | 942 | + cursor_move(&h3270,h3270.cursor_addr - 1); |
943 | } | 943 | } |
944 | return DATA; | 944 | return DATA; |
945 | } | 945 | } |
@@ -948,7 +948,7 @@ static enum state | @@ -948,7 +948,7 @@ static enum state | ||
948 | ansi_cr(int ig1 unused, int ig2 unused) | 948 | ansi_cr(int ig1 unused, int ig2 unused) |
949 | { | 949 | { |
950 | if (h3270.cursor_addr % h3270.cols) | 950 | if (h3270.cursor_addr % h3270.cols) |
951 | - cursor_move(h3270.cursor_addr - (h3270.cursor_addr % h3270.cols)); | 951 | + cursor_move(&h3270,h3270.cursor_addr - (h3270.cursor_addr % h3270.cols)); |
952 | if (auto_newline_mode) | 952 | if (auto_newline_mode) |
953 | (void) ansi_lf(0, 0); | 953 | (void) ansi_lf(0, 0); |
954 | held_wrap = False; | 954 | held_wrap = False; |
@@ -965,12 +965,12 @@ ansi_lf(int ig1 unused, int ig2 unused) | @@ -965,12 +965,12 @@ ansi_lf(int ig1 unused, int ig2 unused) | ||
965 | /* If we're below the scrolling region, don't scroll. */ | 965 | /* If we're below the scrolling region, don't scroll. */ |
966 | if ((h3270.cursor_addr / h3270.cols) >= scroll_bottom) { | 966 | if ((h3270.cursor_addr / h3270.cols) >= scroll_bottom) { |
967 | if (nc < h3270.rows * h3270.cols) | 967 | if (nc < h3270.rows * h3270.cols) |
968 | - cursor_move(nc); | 968 | + cursor_move(&h3270,nc); |
969 | return DATA; | 969 | return DATA; |
970 | } | 970 | } |
971 | 971 | ||
972 | if (nc < scroll_bottom * h3270.cols) | 972 | if (nc < scroll_bottom * h3270.cols) |
973 | - cursor_move(nc); | 973 | + cursor_move(&h3270,nc); |
974 | else | 974 | else |
975 | ansi_scroll(); | 975 | ansi_scroll(); |
976 | return DATA; | 976 | return DATA; |
@@ -988,7 +988,7 @@ ansi_htab(int ig1 unused, int ig2 unused) | @@ -988,7 +988,7 @@ ansi_htab(int ig1 unused, int ig2 unused) | ||
988 | for (i = col+1; i < h3270.cols-1; i++) | 988 | for (i = col+1; i < h3270.cols-1; i++) |
989 | if (tabs[i/8] & 1<<(i%8)) | 989 | if (tabs[i/8] & 1<<(i%8)) |
990 | break; | 990 | break; |
991 | - cursor_move(h3270.cursor_addr - col + i); | 991 | + cursor_move(&h3270,h3270.cursor_addr - col + i); |
992 | return DATA; | 992 | return DATA; |
993 | } | 993 | } |
994 | 994 | ||
@@ -1007,13 +1007,13 @@ ansi_nop(int ig1 unused, int ig2 unused) | @@ -1007,13 +1007,13 @@ ansi_nop(int ig1 unused, int ig2 unused) | ||
1007 | #define PWRAP { \ | 1007 | #define PWRAP { \ |
1008 | nc = h3270.cursor_addr + 1; \ | 1008 | nc = h3270.cursor_addr + 1; \ |
1009 | if (nc < scroll_bottom * h3270.cols) \ | 1009 | if (nc < scroll_bottom * h3270.cols) \ |
1010 | - cursor_move(nc); \ | 1010 | + cursor_move(&h3270,nc); \ |
1011 | else { \ | 1011 | else { \ |
1012 | if (h3270.cursor_addr / h3270.cols >= scroll_bottom) \ | 1012 | if (h3270.cursor_addr / h3270.cols >= scroll_bottom) \ |
1013 | - cursor_move(h3270.cursor_addr / h3270.cols * h3270.cols); \ | 1013 | + cursor_move(&h3270,h3270.cursor_addr / h3270.cols * h3270.cols); \ |
1014 | else { \ | 1014 | else { \ |
1015 | ansi_scroll(); \ | 1015 | ansi_scroll(); \ |
1016 | - cursor_move(nc - h3270.cols); \ | 1016 | + cursor_move(&h3270,nc - h3270.cols); \ |
1017 | } \ | 1017 | } \ |
1018 | } \ | 1018 | } \ |
1019 | } | 1019 | } |
@@ -1188,7 +1188,7 @@ ansi_printing(int ig1 unused, int ig2 unused) | @@ -1188,7 +1188,7 @@ ansi_printing(int ig1 unused, int ig2 unused) | ||
1188 | } | 1188 | } |
1189 | } else { | 1189 | } else { |
1190 | if ((h3270.cursor_addr % h3270.cols) != (h3270.cols - 1)) | 1190 | if ((h3270.cursor_addr % h3270.cols) != (h3270.cols - 1)) |
1191 | - cursor_move(h3270.cursor_addr + 1); | 1191 | + cursor_move(&h3270,h3270.cursor_addr + 1); |
1192 | } | 1192 | } |
1193 | return DATA; | 1193 | return DATA; |
1194 | } | 1194 | } |
@@ -1554,7 +1554,7 @@ dec_scrolling_region(int top, int bottom) | @@ -1554,7 +1554,7 @@ dec_scrolling_region(int top, int bottom) | ||
1554 | if (top <= bottom && (top > 1 || bottom < h3270.rows)) { | 1554 | if (top <= bottom && (top > 1 || bottom < h3270.rows)) { |
1555 | scroll_top = top; | 1555 | scroll_top = top; |
1556 | scroll_bottom = bottom; | 1556 | scroll_bottom = bottom; |
1557 | - cursor_move(0); | 1557 | + cursor_move(&h3270,0); |
1558 | } else { | 1558 | } else { |
1559 | scroll_top = 1; | 1559 | scroll_top = 1; |
1560 | scroll_bottom = h3270.rows; | 1560 | scroll_bottom = h3270.rows; |
@@ -399,11 +399,6 @@ | @@ -399,11 +399,6 @@ | ||
399 | // LOCAL_EXTERN void screen_suspend(H3270 *session); | 399 | // LOCAL_EXTERN void screen_suspend(H3270 *session); |
400 | LOCAL_EXTERN void screen_disp(H3270 *session); | 400 | LOCAL_EXTERN void screen_disp(H3270 *session); |
401 | 401 | ||
402 | - /* Cursor calls */ | ||
403 | - #define cursor_get_addr(void) lib3270_get_cursor_address(NULL) | ||
404 | - #define cursor_set_addr(x) lib3270_set_cursor_address(NULL,x) | ||
405 | - #define cursor_move(x) lib3270_set_cursor_address(NULL,x) | ||
406 | - | ||
407 | #include <lib3270/actions.h> | 402 | #include <lib3270/actions.h> |
408 | 403 | ||
409 | #define host_connect(n,wait) lib3270_connect(NULL,n,wait) | 404 | #define host_connect(n,wait) lib3270_connect(NULL,n,wait) |
ctlr.c
@@ -1093,7 +1093,7 @@ ctlr_erase_all_unprotected(void) | @@ -1093,7 +1093,7 @@ ctlr_erase_all_unprotected(void) | ||
1093 | do { | 1093 | do { |
1094 | INC_BA(baddr); | 1094 | INC_BA(baddr); |
1095 | if (!f) { | 1095 | if (!f) { |
1096 | - cursor_move(baddr); | 1096 | + cursor_move(&h3270,baddr); |
1097 | f = True; | 1097 | f = True; |
1098 | } | 1098 | } |
1099 | if (!h3270.ea_buf[baddr].fa) { | 1099 | if (!h3270.ea_buf[baddr].fa) { |
@@ -1108,7 +1108,7 @@ ctlr_erase_all_unprotected(void) | @@ -1108,7 +1108,7 @@ ctlr_erase_all_unprotected(void) | ||
1108 | } | 1108 | } |
1109 | } while (baddr != sbaddr); | 1109 | } while (baddr != sbaddr); |
1110 | if (!f) | 1110 | if (!f) |
1111 | - cursor_move(0); | 1111 | + cursor_move(&h3270,0); |
1112 | } else { | 1112 | } else { |
1113 | ctlr_clear(&h3270,True); | 1113 | ctlr_clear(&h3270,True); |
1114 | } | 1114 | } |
@@ -1264,7 +1264,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | @@ -1264,7 +1264,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase) | ||
1264 | if (previous != SBA) | 1264 | if (previous != SBA) |
1265 | trace_ds("%s",rcba(buffer_addr)); | 1265 | trace_ds("%s",rcba(buffer_addr)); |
1266 | previous = ORDER; | 1266 | previous = ORDER; |
1267 | - cursor_move(h3270.buffer_addr); | 1267 | + cursor_move(&h3270,h3270.buffer_addr); |
1268 | last_cmd = True; | 1268 | last_cmd = True; |
1269 | last_zpt = False; | 1269 | last_zpt = False; |
1270 | break; | 1270 | break; |
@@ -1989,7 +1989,7 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) | @@ -1989,7 +1989,7 @@ ctlr_write_sscp_lu(unsigned char buf[], int buflen) | ||
1989 | break; | 1989 | break; |
1990 | } | 1990 | } |
1991 | } | 1991 | } |
1992 | - cursor_move(h3270.buffer_addr); | 1992 | + cursor_move(&h3270,h3270.buffer_addr); |
1993 | sscp_start = h3270.buffer_addr; | 1993 | sscp_start = h3270.buffer_addr; |
1994 | 1994 | ||
1995 | /* Unlock the keyboard. */ | 1995 | /* Unlock the keyboard. */ |
@@ -2337,7 +2337,7 @@ ctlr_clear(H3270 *session, Boolean can_snap) | @@ -2337,7 +2337,7 @@ ctlr_clear(H3270 *session, Boolean can_snap) | ||
2337 | 2337 | ||
2338 | /* Clear the screen. */ | 2338 | /* Clear the screen. */ |
2339 | (void) memset((char *)session->ea_buf, 0, session->rows*session->cols*sizeof(struct ea)); | 2339 | (void) memset((char *)session->ea_buf, 0, session->rows*session->cols*sizeof(struct ea)); |
2340 | - cursor_move(0); | 2340 | + cursor_move(&h3270,0); |
2341 | session->buffer_addr = 0; | 2341 | session->buffer_addr = 0; |
2342 | lib3270_unselect(session); | 2342 | lib3270_unselect(session); |
2343 | session->formatted = False; | 2343 | session->formatted = False; |
@@ -2364,7 +2364,7 @@ ctlr_blanks(void) | @@ -2364,7 +2364,7 @@ ctlr_blanks(void) | ||
2364 | if (!h3270.ea_buf[baddr].fa) | 2364 | if (!h3270.ea_buf[baddr].fa) |
2365 | h3270.ea_buf[baddr].cc = EBC_space; | 2365 | h3270.ea_buf[baddr].cc = EBC_space; |
2366 | } | 2366 | } |
2367 | - cursor_move(0); | 2367 | + cursor_move(&h3270,0); |
2368 | h3270.buffer_addr = 0; | 2368 | h3270.buffer_addr = 0; |
2369 | lib3270_unselect(&h3270); | 2369 | lib3270_unselect(&h3270); |
2370 | h3270.formatted = False; | 2370 | h3270.formatted = False; |
globals.h
@@ -246,7 +246,8 @@ LIB3270_INTERNAL Widget toplevel; | @@ -246,7 +246,8 @@ LIB3270_INTERNAL Widget toplevel; | ||
246 | LIB3270_INTERNAL Boolean visible_control; | 246 | LIB3270_INTERNAL Boolean visible_control; |
247 | LIB3270_INTERNAL int *xtra_width; | 247 | LIB3270_INTERNAL int *xtra_width; |
248 | 248 | ||
249 | -#if defined(X3270_DISPLAY) /*[*/ | 249 | +/* |
250 | +#if defined(X3270_DISPLAY) | ||
250 | LIB3270_INTERNAL Atom a_delete_me; | 251 | LIB3270_INTERNAL Atom a_delete_me; |
251 | LIB3270_INTERNAL Atom a_save_yourself; | 252 | LIB3270_INTERNAL Atom a_save_yourself; |
252 | LIB3270_INTERNAL Atom a_state; | 253 | LIB3270_INTERNAL Atom a_state; |
@@ -257,7 +258,8 @@ LIB3270_INTERNAL int *xtra_width; | @@ -257,7 +258,8 @@ LIB3270_INTERNAL int *xtra_width; | ||
257 | LIB3270_INTERNAL Window root_window; | 258 | LIB3270_INTERNAL Window root_window; |
258 | LIB3270_INTERNAL char *user_title; | 259 | LIB3270_INTERNAL char *user_title; |
259 | LIB3270_INTERNAL unsigned char xk_selector; | 260 | LIB3270_INTERNAL unsigned char xk_selector; |
260 | -#endif /*]*/ | 261 | +#endif |
262 | +*/ | ||
261 | 263 | ||
262 | /* Connection state */ | 264 | /* Connection state */ |
263 | LIB3270_INTERNAL enum ft_state ft_state; | 265 | LIB3270_INTERNAL enum ft_state ft_state; |
@@ -372,6 +374,7 @@ enum keytype | @@ -372,6 +374,7 @@ enum keytype | ||
372 | 374 | ||
373 | 375 | ||
374 | /* Library internal calls */ | 376 | /* Library internal calls */ |
375 | -void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped); | ||
376 | -void lib3270_initialize(void); | 377 | +LIB3270_INTERNAL void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Boolean *skipped); |
378 | +LIB3270_INTERNAL void lib3270_initialize(void); | ||
379 | +LIB3270_INTERNAL int cursor_move(H3270 *session, int baddr); | ||
377 | 380 |
glue.c
@@ -126,7 +126,7 @@ static void initialize(void) | @@ -126,7 +126,7 @@ static void initialize(void) | ||
126 | #endif | 126 | #endif |
127 | 127 | ||
128 | h3270.selected = 0; | 128 | h3270.selected = 0; |
129 | - h3270.select.begin = h3270.select.end = 0; | 129 | + h3270.select.start = h3270.select.end = 0; |
130 | // initialize_toggles(&h3270); | 130 | // initialize_toggles(&h3270); |
131 | 131 | ||
132 | #if defined(_WIN32) | 132 | #if defined(_WIN32) |
init.c
@@ -103,6 +103,10 @@ static void update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | @@ -103,6 +103,10 @@ static void update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) | ||
103 | { | 103 | { |
104 | } | 104 | } |
105 | 105 | ||
106 | +static void update_selection(H3270 *session, int start, int end) | ||
107 | +{ | ||
108 | +} | ||
109 | + | ||
106 | static void lib3270_session_init(H3270 *hSession, const char *model) | 110 | static void lib3270_session_init(H3270 *hSession, const char *model) |
107 | { | 111 | { |
108 | int ovc, ovr; | 112 | int ovc, ovr; |
@@ -116,16 +120,17 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -116,16 +120,17 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
116 | initialize_toggles(hSession); | 120 | initialize_toggles(hSession); |
117 | 121 | ||
118 | // Dummy calls to avoid "ifs" | 122 | // Dummy calls to avoid "ifs" |
119 | - hSession->update = update_char; | ||
120 | - hSession->update_model = update_model; | ||
121 | - hSession->update_cursor = update_cursor; | ||
122 | - hSession->set_selection = nop_char; | ||
123 | - hSession->ctlr_done = nop; | ||
124 | - hSession->changed = changed; | ||
125 | - hSession->erase = screen_disp; | ||
126 | - hSession->suspend = nop; | ||
127 | - hSession->resume = screen_disp; | ||
128 | - hSession->update_oia = update_oia; | 123 | + hSession->update = update_char; |
124 | + hSession->update_model = update_model; | ||
125 | + hSession->update_cursor = update_cursor; | ||
126 | + hSession->set_selection = nop_char; | ||
127 | + hSession->ctlr_done = nop; | ||
128 | + hSession->changed = changed; | ||
129 | + hSession->erase = screen_disp; | ||
130 | + hSession->suspend = nop; | ||
131 | + hSession->resume = screen_disp; | ||
132 | + hSession->update_oia = update_oia; | ||
133 | + hSession->update_selection = update_selection; | ||
129 | 134 | ||
130 | hSession->sock = -1; | 135 | hSession->sock = -1; |
131 | hSession->model_num = -1; | 136 | hSession->model_num = -1; |
kybd.c
@@ -966,7 +966,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -966,7 +966,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
966 | else | 966 | else |
967 | INC_BA(baddr); | 967 | INC_BA(baddr); |
968 | } | 968 | } |
969 | - cursor_move(baddr); | 969 | + cursor_move(&h3270,baddr); |
970 | } | 970 | } |
971 | 971 | ||
972 | (void) ctlr_dbcs_postprocess(); | 972 | (void) ctlr_dbcs_postprocess(); |
@@ -1387,7 +1387,7 @@ LIB3270_KEY_ACTION( tab ) | @@ -1387,7 +1387,7 @@ LIB3270_KEY_ACTION( tab ) | ||
1387 | return 0; | 1387 | return 0; |
1388 | } | 1388 | } |
1389 | #endif /*]*/ | 1389 | #endif /*]*/ |
1390 | - cursor_move(next_unprotected(h3270.cursor_addr)); | 1390 | + cursor_move(&h3270,next_unprotected(h3270.cursor_addr)); |
1391 | return 0; | 1391 | return 0; |
1392 | } | 1392 | } |
1393 | 1393 | ||
@@ -1427,12 +1427,12 @@ LIB3270_KEY_ACTION( backtab ) | @@ -1427,12 +1427,12 @@ LIB3270_KEY_ACTION( backtab ) | ||
1427 | break; | 1427 | break; |
1428 | DEC_BA(baddr); | 1428 | DEC_BA(baddr); |
1429 | if (baddr == sbaddr) { | 1429 | if (baddr == sbaddr) { |
1430 | - cursor_move(0); | 1430 | + cursor_move(&h3270,0); |
1431 | return 0; | 1431 | return 0; |
1432 | } | 1432 | } |
1433 | } | 1433 | } |
1434 | INC_BA(baddr); | 1434 | INC_BA(baddr); |
1435 | - cursor_move(baddr); | 1435 | + cursor_move(&h3270,baddr); |
1436 | return 0; | 1436 | return 0; |
1437 | } | 1437 | } |
1438 | 1438 | ||
@@ -1546,11 +1546,11 @@ LIB3270_ACTION( firstfield ) | @@ -1546,11 +1546,11 @@ LIB3270_ACTION( firstfield ) | ||
1546 | return 0; | 1546 | return 0; |
1547 | } | 1547 | } |
1548 | #endif /*]*/ | 1548 | #endif /*]*/ |
1549 | - if (!h3270.formatted) { | ||
1550 | - cursor_move(0); | 1549 | + if (!hSession->formatted) { |
1550 | + cursor_move(hSession,0); | ||
1551 | return 0; | 1551 | return 0; |
1552 | } | 1552 | } |
1553 | - cursor_move(next_unprotected(h3270.rows*h3270.cols-1)); | 1553 | + cursor_move(hSession,next_unprotected(hSession->rows*hSession->cols-1)); |
1554 | 1554 | ||
1555 | return 0; | 1555 | return 0; |
1556 | } | 1556 | } |
@@ -1570,7 +1570,7 @@ do_left(void) | @@ -1570,7 +1570,7 @@ do_left(void) | ||
1570 | d = ctlr_dbcs_state(baddr); | 1570 | d = ctlr_dbcs_state(baddr); |
1571 | if (IS_LEFT(d)) | 1571 | if (IS_LEFT(d)) |
1572 | DEC_BA(baddr); | 1572 | DEC_BA(baddr); |
1573 | - cursor_move(baddr); | 1573 | + cursor_move(&h3270,baddr); |
1574 | } | 1574 | } |
1575 | 1575 | ||
1576 | /* | 1576 | /* |
@@ -1603,7 +1603,7 @@ LIB3270_CURSOR_ACTION( left ) | @@ -1603,7 +1603,7 @@ LIB3270_CURSOR_ACTION( left ) | ||
1603 | } | 1603 | } |
1604 | #endif /*]*/ | 1604 | #endif /*]*/ |
1605 | 1605 | ||
1606 | - if (!h3270.flipped) | 1606 | + if (!hSession->flipped) |
1607 | { | 1607 | { |
1608 | do_left(); | 1608 | do_left(); |
1609 | } | 1609 | } |
@@ -1611,10 +1611,10 @@ LIB3270_CURSOR_ACTION( left ) | @@ -1611,10 +1611,10 @@ LIB3270_CURSOR_ACTION( left ) | ||
1611 | { | 1611 | { |
1612 | register int baddr; | 1612 | register int baddr; |
1613 | 1613 | ||
1614 | - baddr = h3270.cursor_addr; | 1614 | + baddr = hSession->cursor_addr; |
1615 | INC_BA(baddr); | 1615 | INC_BA(baddr); |
1616 | /* XXX: DBCS? */ | 1616 | /* XXX: DBCS? */ |
1617 | - cursor_move(baddr); | 1617 | + lib3270_set_cursor_address(hSession,baddr); |
1618 | } | 1618 | } |
1619 | return 0; | 1619 | return 0; |
1620 | } | 1620 | } |
@@ -1720,7 +1720,7 @@ LIB3270_ACTION( delete ) | @@ -1720,7 +1720,7 @@ LIB3270_ACTION( delete ) | ||
1720 | 1720 | ||
1721 | DEC_BA(baddr); | 1721 | DEC_BA(baddr); |
1722 | if (!hSession->ea_buf[baddr].fa) | 1722 | if (!hSession->ea_buf[baddr].fa) |
1723 | - cursor_move(baddr); | 1723 | + cursor_move(hSession,baddr); |
1724 | } | 1724 | } |
1725 | screen_disp(hSession); | 1725 | screen_disp(hSession); |
1726 | return 0; | 1726 | return 0; |
@@ -1745,16 +1745,16 @@ LIB3270_ACTION( backspace ) | @@ -1745,16 +1745,16 @@ LIB3270_ACTION( backspace ) | ||
1745 | #endif /*]*/ | 1745 | #endif /*]*/ |
1746 | if (reverse) | 1746 | if (reverse) |
1747 | (void) do_delete(); | 1747 | (void) do_delete(); |
1748 | - else if (!h3270.flipped) | 1748 | + else if (!hSession->flipped) |
1749 | do_left(); | 1749 | do_left(); |
1750 | else { | 1750 | else { |
1751 | register int baddr; | 1751 | register int baddr; |
1752 | 1752 | ||
1753 | - baddr = h3270.cursor_addr; | 1753 | + baddr = hSession->cursor_addr; |
1754 | DEC_BA(baddr); | 1754 | DEC_BA(baddr); |
1755 | - cursor_move(baddr); | 1755 | + cursor_move(hSession,baddr); |
1756 | } | 1756 | } |
1757 | - screen_disp(&h3270); | 1757 | + screen_disp(hSession); |
1758 | return 0; | 1758 | return 0; |
1759 | } | 1759 | } |
1760 | 1760 | ||
@@ -1784,7 +1784,7 @@ do_erase(void) | @@ -1784,7 +1784,7 @@ do_erase(void) | ||
1784 | if (h3270.ea_buf[h3270.cursor_addr].cc == EBC_si) { | 1784 | if (h3270.ea_buf[h3270.cursor_addr].cc == EBC_si) { |
1785 | baddr = h3270.cursor_addr; | 1785 | baddr = h3270.cursor_addr; |
1786 | DEC_BA(baddr); | 1786 | DEC_BA(baddr); |
1787 | - cursor_move(baddr); | 1787 | + cursor_move(&h3270,baddr); |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | /* | 1790 | /* |
@@ -1797,7 +1797,7 @@ do_erase(void) | @@ -1797,7 +1797,7 @@ do_erase(void) | ||
1797 | if (IS_RIGHT(d)) { | 1797 | if (IS_RIGHT(d)) { |
1798 | baddr = h3270.cursor_addr; | 1798 | baddr = h3270.cursor_addr; |
1799 | DEC_BA(baddr); | 1799 | DEC_BA(baddr); |
1800 | - cursor_move(baddr); | 1800 | + cursor_move(&h3270,baddr); |
1801 | } | 1801 | } |
1802 | 1802 | ||
1803 | /* | 1803 | /* |
@@ -1813,7 +1813,7 @@ do_erase(void) | @@ -1813,7 +1813,7 @@ do_erase(void) | ||
1813 | baddr = h3270.cursor_addr; | 1813 | baddr = h3270.cursor_addr; |
1814 | DEC_BA(baddr); | 1814 | DEC_BA(baddr); |
1815 | if (h3270.ea_buf[baddr].cc == EBC_so && h3270.ea_buf[h3270.cursor_addr].cc == EBC_si) { | 1815 | if (h3270.ea_buf[baddr].cc == EBC_so && h3270.ea_buf[h3270.cursor_addr].cc == EBC_si) { |
1816 | - cursor_move(baddr); | 1816 | + cursor_move(&h3270,baddr); |
1817 | (void) do_delete(); | 1817 | (void) do_delete(); |
1818 | } | 1818 | } |
1819 | screen_disp(&h3270); | 1819 | screen_disp(&h3270); |
@@ -1863,14 +1863,14 @@ LIB3270_CURSOR_ACTION( right ) | @@ -1863,14 +1863,14 @@ LIB3270_CURSOR_ACTION( right ) | ||
1863 | return 0; | 1863 | return 0; |
1864 | } | 1864 | } |
1865 | #endif /*]*/ | 1865 | #endif /*]*/ |
1866 | - if (!h3270.flipped) | 1866 | + if (!hSession->flipped) |
1867 | { | 1867 | { |
1868 | - baddr = h3270.cursor_addr; | 1868 | + baddr = hSession->cursor_addr; |
1869 | INC_BA(baddr); | 1869 | INC_BA(baddr); |
1870 | d = ctlr_dbcs_state(baddr); | 1870 | d = ctlr_dbcs_state(baddr); |
1871 | if (IS_RIGHT(d)) | 1871 | if (IS_RIGHT(d)) |
1872 | INC_BA(baddr); | 1872 | INC_BA(baddr); |
1873 | - cursor_move(baddr); | 1873 | + lib3270_set_cursor_address(hSession,baddr); |
1874 | } | 1874 | } |
1875 | else | 1875 | else |
1876 | { | 1876 | { |
@@ -1937,30 +1937,30 @@ LIB3270_ACTION( previousword ) | @@ -1937,30 +1937,30 @@ LIB3270_ACTION( previousword ) | ||
1937 | if (IN_ANSI) | 1937 | if (IN_ANSI) |
1938 | return 0; | 1938 | return 0; |
1939 | #endif /*]*/ | 1939 | #endif /*]*/ |
1940 | - if (!h3270.formatted) | 1940 | + if (!hSession->formatted) |
1941 | return 0; | 1941 | return 0; |
1942 | 1942 | ||
1943 | - baddr = h3270.cursor_addr; | ||
1944 | - prot = FA_IS_PROTECTED(get_field_attribute(&h3270,baddr)); | 1943 | + baddr = hSession->cursor_addr; |
1944 | + prot = FA_IS_PROTECTED(get_field_attribute(hSession,baddr)); | ||
1945 | 1945 | ||
1946 | /* Skip to before this word, if in one now. */ | 1946 | /* Skip to before this word, if in one now. */ |
1947 | if (!prot) { | 1947 | if (!prot) { |
1948 | - c = h3270.ea_buf[baddr].cc; | ||
1949 | - while (!h3270.ea_buf[baddr].fa && c != EBC_space && c != EBC_null) { | 1948 | + c = hSession->ea_buf[baddr].cc; |
1949 | + while (!hSession->ea_buf[baddr].fa && c != EBC_space && c != EBC_null) { | ||
1950 | DEC_BA(baddr); | 1950 | DEC_BA(baddr); |
1951 | - if (baddr == h3270.cursor_addr) | 1951 | + if (baddr == hSession->cursor_addr) |
1952 | return 0; | 1952 | return 0; |
1953 | - c = h3270.ea_buf[baddr].cc; | 1953 | + c = hSession->ea_buf[baddr].cc; |
1954 | } | 1954 | } |
1955 | } | 1955 | } |
1956 | baddr0 = baddr; | 1956 | baddr0 = baddr; |
1957 | 1957 | ||
1958 | /* Find the end of the preceding word. */ | 1958 | /* Find the end of the preceding word. */ |
1959 | do { | 1959 | do { |
1960 | - c = h3270.ea_buf[baddr].cc; | ||
1961 | - if (h3270.ea_buf[baddr].fa) { | 1960 | + c = hSession->ea_buf[baddr].cc; |
1961 | + if (hSession->ea_buf[baddr].fa) { | ||
1962 | DEC_BA(baddr); | 1962 | DEC_BA(baddr); |
1963 | - prot = FA_IS_PROTECTED(get_field_attribute(&h3270,baddr)); | 1963 | + prot = FA_IS_PROTECTED(get_field_attribute(hSession,baddr)); |
1964 | continue; | 1964 | continue; |
1965 | } | 1965 | } |
1966 | if (!prot && c != EBC_space && c != EBC_null) | 1966 | if (!prot && c != EBC_space && c != EBC_null) |
@@ -1974,13 +1974,13 @@ LIB3270_ACTION( previousword ) | @@ -1974,13 +1974,13 @@ LIB3270_ACTION( previousword ) | ||
1974 | /* Go it its front. */ | 1974 | /* Go it its front. */ |
1975 | for (;;) { | 1975 | for (;;) { |
1976 | DEC_BA(baddr); | 1976 | DEC_BA(baddr); |
1977 | - c = h3270.ea_buf[baddr].cc; | ||
1978 | - if (h3270.ea_buf[baddr].fa || c == EBC_space || c == EBC_null) { | 1977 | + c = hSession->ea_buf[baddr].cc; |
1978 | + if (hSession->ea_buf[baddr].fa || c == EBC_space || c == EBC_null) { | ||
1979 | break; | 1979 | break; |
1980 | } | 1980 | } |
1981 | } | 1981 | } |
1982 | INC_BA(baddr); | 1982 | INC_BA(baddr); |
1983 | - cursor_move(baddr); | 1983 | + cursor_move(hSession,baddr); |
1984 | return 0; | 1984 | return 0; |
1985 | } | 1985 | } |
1986 | 1986 | ||
@@ -2088,62 +2088,54 @@ LIB3270_ACTION( nextword ) | @@ -2088,62 +2088,54 @@ LIB3270_ACTION( nextword ) | ||
2088 | if (IN_ANSI) | 2088 | if (IN_ANSI) |
2089 | return 0; | 2089 | return 0; |
2090 | #endif /*]*/ | 2090 | #endif /*]*/ |
2091 | - if (!h3270.formatted) | 2091 | + if (!hSession->formatted) |
2092 | return 0; | 2092 | return 0; |
2093 | 2093 | ||
2094 | /* If not in an unprotected field, go to the next unprotected word. */ | 2094 | /* If not in an unprotected field, go to the next unprotected word. */ |
2095 | - if (h3270.ea_buf[h3270.cursor_addr].fa || | ||
2096 | - FA_IS_PROTECTED(get_field_attribute(&h3270,h3270.cursor_addr))) { | ||
2097 | - baddr = nu_word(h3270.cursor_addr); | 2095 | + if (hSession->ea_buf[hSession->cursor_addr].fa || |
2096 | + FA_IS_PROTECTED(get_field_attribute(hSession,hSession->cursor_addr))) { | ||
2097 | + baddr = nu_word(hSession->cursor_addr); | ||
2098 | if (baddr != -1) | 2098 | if (baddr != -1) |
2099 | - cursor_move(baddr); | 2099 | + cursor_move(hSession,baddr); |
2100 | return 0; | 2100 | return 0; |
2101 | } | 2101 | } |
2102 | 2102 | ||
2103 | /* If there's another word in this field, go to it. */ | 2103 | /* If there's another word in this field, go to it. */ |
2104 | - baddr = nt_word(h3270.cursor_addr); | 2104 | + baddr = nt_word(hSession->cursor_addr); |
2105 | if (baddr != -1) { | 2105 | if (baddr != -1) { |
2106 | - cursor_move(baddr); | 2106 | + cursor_move(hSession,baddr); |
2107 | return 0; | 2107 | return 0; |
2108 | } | 2108 | } |
2109 | 2109 | ||
2110 | /* If in a word, go to just after its end. */ | 2110 | /* If in a word, go to just after its end. */ |
2111 | - c = h3270.ea_buf[h3270.cursor_addr].cc; | 2111 | + c = hSession->ea_buf[hSession->cursor_addr].cc; |
2112 | if (c != EBC_space && c != EBC_null) { | 2112 | if (c != EBC_space && c != EBC_null) { |
2113 | - baddr = h3270.cursor_addr; | 2113 | + baddr = hSession->cursor_addr; |
2114 | do { | 2114 | do { |
2115 | - c = h3270.ea_buf[baddr].cc; | 2115 | + c = hSession->ea_buf[baddr].cc; |
2116 | if (c == EBC_space || c == EBC_null) { | 2116 | if (c == EBC_space || c == EBC_null) { |
2117 | - cursor_move(baddr); | 2117 | + cursor_move(hSession,baddr); |
2118 | return 0; | 2118 | return 0; |
2119 | - } else if (h3270.ea_buf[baddr].fa) { | 2119 | + } else if (hSession->ea_buf[baddr].fa) { |
2120 | baddr = nu_word(baddr); | 2120 | baddr = nu_word(baddr); |
2121 | if (baddr != -1) | 2121 | if (baddr != -1) |
2122 | - cursor_move(baddr); | 2122 | + cursor_move(hSession,baddr); |
2123 | return 0; | 2123 | return 0; |
2124 | } | 2124 | } |
2125 | INC_BA(baddr); | 2125 | INC_BA(baddr); |
2126 | - } while (baddr != h3270.cursor_addr); | 2126 | + } while (baddr != hSession->cursor_addr); |
2127 | } | 2127 | } |
2128 | /* Otherwise, go to the next unprotected word. */ | 2128 | /* Otherwise, go to the next unprotected word. */ |
2129 | else { | 2129 | else { |
2130 | - baddr = nu_word(h3270.cursor_addr); | 2130 | + baddr = nu_word(hSession->cursor_addr); |
2131 | if (baddr != -1) | 2131 | if (baddr != -1) |
2132 | - cursor_move(baddr); | 2132 | + cursor_move(hSession,baddr); |
2133 | } | 2133 | } |
2134 | 2134 | ||
2135 | return 0; | 2135 | return 0; |
2136 | } | 2136 | } |
2137 | 2137 | ||
2138 | 2138 | ||
2139 | -/* | ||
2140 | - * Cursor up 1 position. | ||
2141 | - */ /* | ||
2142 | -void Up_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | ||
2143 | -{ | ||
2144 | - action_CursorUp(); | ||
2145 | -} | ||
2146 | -*/ | ||
2147 | 2139 | ||
2148 | /** | 2140 | /** |
2149 | * Cursor up 1 position. | 2141 | * Cursor up 1 position. |
@@ -2175,24 +2167,13 @@ LIB3270_CURSOR_ACTION( up ) | @@ -2175,24 +2167,13 @@ LIB3270_CURSOR_ACTION( up ) | ||
2175 | return 0; | 2167 | return 0; |
2176 | } | 2168 | } |
2177 | #endif /*]*/ | 2169 | #endif /*]*/ |
2178 | - baddr = h3270.cursor_addr - h3270.cols; | 2170 | + baddr = hSession->cursor_addr - hSession->cols; |
2179 | if (baddr < 0) | 2171 | if (baddr < 0) |
2180 | - baddr = (h3270.cursor_addr + (h3270.rows * h3270.cols)) - h3270.cols; | ||
2181 | - cursor_move(baddr); | 2172 | + baddr = (hSession->cursor_addr + (hSession->rows * hSession->cols)) - hSession->cols; |
2173 | + lib3270_set_cursor_address(hSession,baddr); | ||
2182 | return 0; | 2174 | return 0; |
2183 | } | 2175 | } |
2184 | 2176 | ||
2185 | - | ||
2186 | -/* | ||
2187 | - * Cursor down 1 position. | ||
2188 | - */ /* | ||
2189 | -void | ||
2190 | -Down_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | ||
2191 | -{ | ||
2192 | - action_CursorDown(); | ||
2193 | -} | ||
2194 | -*/ | ||
2195 | - | ||
2196 | /** | 2177 | /** |
2197 | * Cursor down 1 position. | 2178 | * Cursor down 1 position. |
2198 | * | 2179 | * |
@@ -2224,8 +2205,8 @@ LIB3270_CURSOR_ACTION( down ) | @@ -2224,8 +2205,8 @@ LIB3270_CURSOR_ACTION( down ) | ||
2224 | return 0; | 2205 | return 0; |
2225 | } | 2206 | } |
2226 | #endif /*]*/ | 2207 | #endif /*]*/ |
2227 | - baddr = (h3270.cursor_addr + h3270.cols) % (h3270.cols * h3270.rows); | ||
2228 | - cursor_move(baddr); | 2208 | + baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); |
2209 | + lib3270_set_cursor_address(hSession,baddr); | ||
2229 | return 0; | 2210 | return 0; |
2230 | } | 2211 | } |
2231 | 2212 | ||
@@ -2252,14 +2233,14 @@ LIB3270_CURSOR_ACTION( newline ) | @@ -2252,14 +2233,14 @@ LIB3270_CURSOR_ACTION( newline ) | ||
2252 | return 0; | 2233 | return 0; |
2253 | } | 2234 | } |
2254 | #endif /*]*/ | 2235 | #endif /*]*/ |
2255 | - baddr = (h3270.cursor_addr + h3270.cols) % (h3270.cols * h3270.rows); /* down */ | ||
2256 | - baddr = (baddr / h3270.cols) * h3270.cols; /* 1st col */ | ||
2257 | - faddr = find_field_attribute(&h3270,baddr); | ||
2258 | - fa = h3270.ea_buf[faddr].fa; | 2236 | + baddr = (hSession->cursor_addr + hSession->cols) % (hSession->cols * hSession->rows); /* down */ |
2237 | + baddr = (baddr / hSession->cols) * hSession->cols; /* 1st col */ | ||
2238 | + faddr = find_field_attribute(hSession,baddr); | ||
2239 | + fa = hSession->ea_buf[faddr].fa; | ||
2259 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) | 2240 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) |
2260 | - cursor_move(baddr); | 2241 | + cursor_move(hSession,baddr); |
2261 | else | 2242 | else |
2262 | - cursor_move(next_unprotected(baddr)); | 2243 | + cursor_move(hSession,next_unprotected(baddr)); |
2263 | 2244 | ||
2264 | return 0; | 2245 | return 0; |
2265 | } | 2246 | } |
@@ -2282,7 +2263,7 @@ LIB3270_ACTION( dup ) | @@ -2282,7 +2263,7 @@ LIB3270_ACTION( dup ) | ||
2282 | if (key_Character(EBC_dup, False, False, NULL)) | 2263 | if (key_Character(EBC_dup, False, False, NULL)) |
2283 | { | 2264 | { |
2284 | screen_disp(hSession); | 2265 | screen_disp(hSession); |
2285 | - cursor_move(next_unprotected(hSession->cursor_addr)); | 2266 | + cursor_move(hSession,next_unprotected(hSession->cursor_addr)); |
2286 | } | 2267 | } |
2287 | } | 2268 | } |
2288 | 2269 | ||
@@ -2369,8 +2350,8 @@ LIB3270_ACTION( clear ) | @@ -2369,8 +2350,8 @@ LIB3270_ACTION( clear ) | ||
2369 | } | 2350 | } |
2370 | #endif /*]*/ | 2351 | #endif /*]*/ |
2371 | h3270.buffer_addr = 0; | 2352 | h3270.buffer_addr = 0; |
2372 | - ctlr_clear(&h3270,True); | ||
2373 | - cursor_move(0); | 2353 | + ctlr_clear(hSession,True); |
2354 | + cursor_move(hSession,0); | ||
2374 | if (CONNECTED) | 2355 | if (CONNECTED) |
2375 | key_AID(AID_CLEAR); | 2356 | key_AID(AID_CLEAR); |
2376 | return 0; | 2357 | return 0; |
@@ -2626,37 +2607,37 @@ LIB3270_ACTION( eraseinput ) | @@ -2626,37 +2607,37 @@ LIB3270_ACTION( eraseinput ) | ||
2626 | /* find first field attribute */ | 2607 | /* find first field attribute */ |
2627 | baddr = 0; | 2608 | baddr = 0; |
2628 | do { | 2609 | do { |
2629 | - if (h3270.ea_buf[baddr].fa) | 2610 | + if (hSession->ea_buf[baddr].fa) |
2630 | break; | 2611 | break; |
2631 | INC_BA(baddr); | 2612 | INC_BA(baddr); |
2632 | } while (baddr != 0); | 2613 | } while (baddr != 0); |
2633 | sbaddr = baddr; | 2614 | sbaddr = baddr; |
2634 | f = False; | 2615 | f = False; |
2635 | do { | 2616 | do { |
2636 | - fa = h3270.ea_buf[baddr].fa; | 2617 | + fa = hSession->ea_buf[baddr].fa; |
2637 | if (!FA_IS_PROTECTED(fa)) { | 2618 | if (!FA_IS_PROTECTED(fa)) { |
2638 | mdt_clear(baddr); | 2619 | mdt_clear(baddr); |
2639 | do { | 2620 | do { |
2640 | INC_BA(baddr); | 2621 | INC_BA(baddr); |
2641 | if (!f) { | 2622 | if (!f) { |
2642 | - cursor_move(baddr); | 2623 | + cursor_move(hSession,baddr); |
2643 | f = True; | 2624 | f = True; |
2644 | } | 2625 | } |
2645 | - if (!h3270.ea_buf[baddr].fa) { | 2626 | + if (!hSession->ea_buf[baddr].fa) { |
2646 | ctlr_add(baddr, EBC_null, 0); | 2627 | ctlr_add(baddr, EBC_null, 0); |
2647 | } | 2628 | } |
2648 | - } while (!h3270.ea_buf[baddr].fa); | 2629 | + } while (!hSession->ea_buf[baddr].fa); |
2649 | } else { /* skip protected */ | 2630 | } else { /* skip protected */ |
2650 | do { | 2631 | do { |
2651 | INC_BA(baddr); | 2632 | INC_BA(baddr); |
2652 | - } while (!h3270.ea_buf[baddr].fa); | 2633 | + } while (!hSession->ea_buf[baddr].fa); |
2653 | } | 2634 | } |
2654 | } while (baddr != sbaddr); | 2635 | } while (baddr != sbaddr); |
2655 | if (!f) | 2636 | if (!f) |
2656 | - cursor_move(0); | 2637 | + cursor_move(hSession,0); |
2657 | } else { | 2638 | } else { |
2658 | ctlr_clear(hSession,True); | 2639 | ctlr_clear(hSession,True); |
2659 | - cursor_move(0); | 2640 | + cursor_move(hSession,0); |
2660 | } | 2641 | } |
2661 | screen_disp(hSession); | 2642 | screen_disp(hSession); |
2662 | return 0; | 2643 | return 0; |
@@ -2768,7 +2749,7 @@ LIB3270_ACTION( deletefield ) | @@ -2768,7 +2749,7 @@ LIB3270_ACTION( deletefield ) | ||
2768 | DEC_BA(baddr); | 2749 | DEC_BA(baddr); |
2769 | INC_BA(baddr); | 2750 | INC_BA(baddr); |
2770 | mdt_set(hSession->cursor_addr); | 2751 | mdt_set(hSession->cursor_addr); |
2771 | - cursor_move(baddr); | 2752 | + cursor_move(hSession,baddr); |
2772 | while (!hSession->ea_buf[baddr].fa) { | 2753 | while (!hSession->ea_buf[baddr].fa) { |
2773 | ctlr_add(baddr, EBC_null, 0); | 2754 | ctlr_add(baddr, EBC_null, 0); |
2774 | INC_BA(baddr); | 2755 | INC_BA(baddr); |
@@ -2883,10 +2864,10 @@ LIB3270_ACTION( fieldend ) | @@ -2883,10 +2864,10 @@ LIB3270_ACTION( fieldend ) | ||
2883 | } else { | 2864 | } else { |
2884 | baddr = last_nonblank; | 2865 | baddr = last_nonblank; |
2885 | INC_BA(baddr); | 2866 | INC_BA(baddr); |
2886 | - if (h3270.ea_buf[baddr].fa) | 2867 | + if (hSession->ea_buf[baddr].fa) |
2887 | baddr = last_nonblank; | 2868 | baddr = last_nonblank; |
2888 | } | 2869 | } |
2889 | - cursor_move(baddr); | 2870 | + cursor_move(hSession,baddr); |
2890 | return 0; | 2871 | return 0; |
2891 | } | 2872 | } |
2892 | 2873 | ||
@@ -2956,7 +2937,7 @@ remargin(int lmargin) | @@ -2956,7 +2937,7 @@ remargin(int lmargin) | ||
2956 | } | 2937 | } |
2957 | } | 2938 | } |
2958 | 2939 | ||
2959 | - cursor_move(baddr); | 2940 | + cursor_move(&h3270,baddr); |
2960 | return True; | 2941 | return True; |
2961 | } | 2942 | } |
2962 | 2943 | ||
@@ -3347,112 +3328,6 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | @@ -3347,112 +3328,6 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | ||
3347 | return len; | 3328 | return len; |
3348 | } | 3329 | } |
3349 | 3330 | ||
3350 | -/* | ||
3351 | - * Pretend that a sequence of hexadecimal characters was entered at the | ||
3352 | - * keyboard. The input is a sequence of hexadecimal bytes, 2 characters | ||
3353 | - * per byte. If connected in ANSI mode, these are treated as ASCII | ||
3354 | - * characters; if in 3270 mode, they are considered EBCDIC. | ||
3355 | - * | ||
3356 | - * Graphic Escapes are handled as \E. | ||
3357 | - */ /* | ||
3358 | -void | ||
3359 | -hex_input(char *s) | ||
3360 | -{ | ||
3361 | - char *t; | ||
3362 | - Boolean escaped; | ||
3363 | -#if defined(X3270_ANSI) | ||
3364 | - unsigned char *xbuf = (unsigned char *)NULL; | ||
3365 | - unsigned char *tbuf = (unsigned char *)NULL; | ||
3366 | - int nbytes = 0; | ||
3367 | -#endif | ||
3368 | - | ||
3369 | - // Validate the string. | ||
3370 | - if (strlen(s) % 2) { | ||
3371 | - popup_an_error("%s: Odd number of characters in specification", | ||
3372 | - action_name(HexString_action)); | ||
3373 | -// cancel_if_idle_command(); | ||
3374 | - return; | ||
3375 | - } | ||
3376 | - t = s; | ||
3377 | - escaped = False; | ||
3378 | - while (*t) { | ||
3379 | - if (isxdigit(*t) && isxdigit(*(t + 1))) { | ||
3380 | - escaped = False; | ||
3381 | -#if defined(X3270_ANSI) | ||
3382 | - nbytes++; | ||
3383 | -#endif | ||
3384 | - } else if (!strncmp(t, "\\E", 2) || !strncmp(t, "\\e", 2)) { | ||
3385 | - if (escaped) { | ||
3386 | - popup_an_error("%s: Double \\E", | ||
3387 | - action_name(HexString_action)); | ||
3388 | -// cancel_if_idle_command(); | ||
3389 | - return; | ||
3390 | - } | ||
3391 | - if (!IN_3270) { | ||
3392 | - popup_an_error("%s: \\E in ANSI mode", | ||
3393 | - action_name(HexString_action)); | ||
3394 | -// cancel_if_idle_command(); | ||
3395 | - return; | ||
3396 | - } | ||
3397 | - escaped = True; | ||
3398 | - } else { | ||
3399 | - popup_an_error("%s: Illegal character in specification", | ||
3400 | - action_name(HexString_action)); | ||
3401 | -// cancel_if_idle_command(); | ||
3402 | - return; | ||
3403 | - } | ||
3404 | - t += 2; | ||
3405 | - } | ||
3406 | - if (escaped) { | ||
3407 | - popup_an_error("%s: Nothing follows \\E", | ||
3408 | - action_name(HexString_action)); | ||
3409 | -// cancel_if_idle_command(); | ||
3410 | - return; | ||
3411 | - } | ||
3412 | - | ||
3413 | -#if defined(X3270_ANSI) | ||
3414 | - // Allocate a temporary buffer. | ||
3415 | - if (!IN_3270 && nbytes) | ||
3416 | - tbuf = xbuf = (unsigned char *)Malloc(nbytes); | ||
3417 | -#endif | ||
3418 | - | ||
3419 | - // Pump it in. | ||
3420 | - t = s; | ||
3421 | - escaped = False; | ||
3422 | - while (*t) { | ||
3423 | - if (isxdigit(*t) && isxdigit(*(t + 1))) { | ||
3424 | - unsigned c; | ||
3425 | - | ||
3426 | - c = (FROM_HEX(*t) * 16) + FROM_HEX(*(t + 1)); | ||
3427 | - if (IN_3270) | ||
3428 | - key_Character(c, escaped, True, NULL); | ||
3429 | -#if defined(X3270_ANSI) | ||
3430 | - else | ||
3431 | - *tbuf++ = (unsigned char)c; | ||
3432 | -#endif | ||
3433 | - escaped = False; | ||
3434 | - } else if (!strncmp(t, "\\E", 2) || !strncmp(t, "\\e", 2)) { | ||
3435 | - escaped = True; | ||
3436 | - } | ||
3437 | - t += 2; | ||
3438 | - } | ||
3439 | -#if defined(X3270_ANSI) | ||
3440 | - if (!IN_3270 && nbytes) { | ||
3441 | - net_hexansi_out(xbuf, nbytes); | ||
3442 | - Free(xbuf); | ||
3443 | - } | ||
3444 | -#endif | ||
3445 | -} | ||
3446 | -*/ | ||
3447 | - | ||
3448 | -/* | ||
3449 | -void | ||
3450 | -ignore_action(Widget w unused, XEvent *event, String *params, Cardinal *num_params) | ||
3451 | -{ | ||
3452 | -// reset_idle_timer(); | ||
3453 | -} | ||
3454 | -*/ | ||
3455 | - | ||
3456 | #if defined(X3270_FT) /*[*/ | 3331 | #if defined(X3270_FT) /*[*/ |
3457 | /* | 3332 | /* |
3458 | * Set up the cursor and input field for command input. | 3333 | * Set up the cursor and input field for command input. |
@@ -3496,7 +3371,7 @@ kybd_prime(void) | @@ -3496,7 +3371,7 @@ kybd_prime(void) | ||
3496 | } | 3371 | } |
3497 | 3372 | ||
3498 | /* Move the cursor to the beginning of the field. */ | 3373 | /* Move the cursor to the beginning of the field. */ |
3499 | - cursor_move(baddr); | 3374 | + cursor_move(&h3270,baddr); |
3500 | 3375 | ||
3501 | /* Erase it. */ | 3376 | /* Erase it. */ |
3502 | while (!h3270.ea_buf[baddr].fa) { | 3377 | while (!h3270.ea_buf[baddr].fa) { |
paste.c
@@ -128,7 +128,7 @@ | @@ -128,7 +128,7 @@ | ||
128 | } | 128 | } |
129 | 129 | ||
130 | } | 130 | } |
131 | - cursor_move(baddr); | 131 | + cursor_move(session,baddr); |
132 | } | 132 | } |
133 | 133 | ||
134 | return -1; | 134 | return -1; |
@@ -210,9 +210,9 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | @@ -210,9 +210,9 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | ||
210 | faddr = find_field_attribute(h,baddr); | 210 | faddr = find_field_attribute(h,baddr); |
211 | fa = h->ea_buf[faddr].fa; | 211 | fa = h->ea_buf[faddr].fa; |
212 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) | 212 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) |
213 | - cursor_move(baddr); | 213 | + cursor_move(h,baddr); |
214 | else | 214 | else |
215 | - cursor_move(next_unprotected(baddr)); | 215 | + cursor_move(h,next_unprotected(baddr)); |
216 | data.row = BA_TO_ROW(h->cursor_addr); | 216 | data.row = BA_TO_ROW(h->cursor_addr); |
217 | } | 217 | } |
218 | last = ' '; | 218 | last = ' '; |
screen.c
@@ -376,10 +376,18 @@ LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) | @@ -376,10 +376,18 @@ LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) | ||
376 | 376 | ||
377 | LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *h, int baddr) | 377 | LIB3270_EXPORT int lib3270_set_cursor_address(H3270 *h, int baddr) |
378 | { | 378 | { |
379 | - int ret; | ||
380 | - | ||
381 | CHECK_SESSION_HANDLE(h); | 379 | CHECK_SESSION_HANDLE(h); |
382 | 380 | ||
381 | + if(h->selected && !lib3270_get_toggle(h,LIB3270_TOGGLE_KEEP_SELECTED)) | ||
382 | + lib3270_unselect(h); | ||
383 | + | ||
384 | + return cursor_move(h,baddr); | ||
385 | +} | ||
386 | + | ||
387 | +int cursor_move(H3270 *h, int baddr) | ||
388 | +{ | ||
389 | + int ret; | ||
390 | + | ||
383 | ret = h->cursor_addr; | 391 | ret = h->cursor_addr; |
384 | 392 | ||
385 | if(ret == baddr) | 393 | if(ret == baddr) |
selection.c
@@ -40,20 +40,20 @@ | @@ -40,20 +40,20 @@ | ||
40 | #define SELECTION_BOTTOM 0x08 | 40 | #define SELECTION_BOTTOM 0x08 |
41 | #define SELECTION_ACTIVE 0x10 | 41 | #define SELECTION_ACTIVE 0x10 |
42 | 42 | ||
43 | - static void update_selection(H3270 *session); | 43 | + static void select_region(H3270 *h, int start, int end); |
44 | 44 | ||
45 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | 45 | + /*--[ Implement ]------------------------------------------------------------------------------------*/ |
46 | 46 | ||
47 | -static void get_selected_addr(H3270 *session, int *begin, int *end) | 47 | +static void get_selected_addr(H3270 *session, int *start, int *end) |
48 | { | 48 | { |
49 | - if(session->select.begin > session->select.end) | 49 | + if(session->select.start > session->select.end) |
50 | { | 50 | { |
51 | - *end = session->select.begin; | ||
52 | - *begin = session->select.end; | 51 | + *end = session->select.start; |
52 | + *start = session->select.end; | ||
53 | } | 53 | } |
54 | else | 54 | else |
55 | { | 55 | { |
56 | - *begin = session->select.begin; | 56 | + *start = session->select.start; |
57 | *end = session->select.end; | 57 | *end = session->select.end; |
58 | } | 58 | } |
59 | } | 59 | } |
@@ -161,23 +161,6 @@ static void update_selected_region(H3270 *session) | @@ -161,23 +161,6 @@ static void update_selected_region(H3270 *session) | ||
161 | 161 | ||
162 | } | 162 | } |
163 | 163 | ||
164 | -void update_selection(H3270 *session) | ||
165 | -{ | ||
166 | - if(lib3270_get_toggle(session,LIB3270_TOGGLE_RECTANGLE_SELECT)) | ||
167 | - update_selected_rectangle(session); | ||
168 | - else | ||
169 | - update_selected_region(session); | ||
170 | -} | ||
171 | - | ||
172 | -static void set_selected(H3270 *session) | ||
173 | -{ | ||
174 | - if(session->selected) | ||
175 | - return; | ||
176 | - | ||
177 | - session->selected = 1; | ||
178 | - session->set_selection(session,1); | ||
179 | -} | ||
180 | - | ||
181 | void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) | 164 | void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt) |
182 | { | 165 | { |
183 | if(!session->selected) | 166 | if(!session->selected) |
@@ -195,42 +178,86 @@ LIB3270_ACTION(unselect) | @@ -195,42 +178,86 @@ LIB3270_ACTION(unselect) | ||
195 | 178 | ||
196 | CHECK_SESSION_HANDLE(hSession); | 179 | CHECK_SESSION_HANDLE(hSession); |
197 | 180 | ||
198 | - if(!hSession->selected) | ||
199 | - return 0; | ||
200 | - | ||
201 | - hSession->selected = 0; | ||
202 | - | ||
203 | - for(a = 0; a < hSession->rows*hSession->cols; a++) | 181 | + if(hSession->selected) |
204 | { | 182 | { |
205 | - if(hSession->text[a].attr & LIB3270_ATTR_SELECTED) | 183 | + hSession->selected = 0; |
184 | + | ||
185 | + for(a = 0; a < hSession->rows*hSession->cols; a++) | ||
206 | { | 186 | { |
207 | - hSession->text[a].attr &= ~LIB3270_ATTR_SELECTED; | ||
208 | - if(hSession->update) | ||
209 | - hSession->update(hSession,a,hSession->text[a].chr,hSession->text[a].attr,a == hSession->cursor_addr); | 187 | + if(hSession->text[a].attr & LIB3270_ATTR_SELECTED) |
188 | + { | ||
189 | + hSession->text[a].attr &= ~LIB3270_ATTR_SELECTED; | ||
190 | + if(hSession->update) | ||
191 | + hSession->update(hSession,a,hSession->text[a].chr,hSession->text[a].attr,a == hSession->cursor_addr); | ||
192 | + } | ||
210 | } | 193 | } |
211 | - } | ||
212 | 194 | ||
213 | - hSession->set_selection(hSession,0); | 195 | + hSession->set_selection(hSession,0); |
196 | + hSession->update_selection(hSession,-1,-1); | ||
197 | + } | ||
214 | 198 | ||
215 | return 0; | 199 | return 0; |
216 | } | 200 | } |
217 | 201 | ||
218 | LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr) | 202 | LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr) |
219 | { | 203 | { |
204 | + int start, end; | ||
205 | + | ||
220 | CHECK_SESSION_HANDLE(session); | 206 | CHECK_SESSION_HANDLE(session); |
221 | 207 | ||
222 | if(!lib3270_connected(session)) | 208 | if(!lib3270_connected(session)) |
223 | return; | 209 | return; |
224 | 210 | ||
225 | - if(!session->selected) | 211 | + start = session->selected ? session->select.start : session->cursor_addr; |
212 | + | ||
213 | + cursor_move(session,end = baddr); | ||
214 | + | ||
215 | + select_region(session,start,end); | ||
216 | + | ||
217 | +} | ||
218 | + | ||
219 | +LIB3270_EXPORT void lib3270_select_region(H3270 *h, int start, int end) | ||
220 | +{ | ||
221 | + int maxlen; | ||
222 | + | ||
223 | + CHECK_SESSION_HANDLE(h); | ||
224 | + | ||
225 | + if(!lib3270_connected(h)) | ||
226 | + return; | ||
227 | + | ||
228 | + maxlen = (h->rows * h->cols); | ||
229 | + | ||
230 | + // Check bounds | ||
231 | + if(start < 0 || start > maxlen || end < 0 || end > maxlen || start > end) | ||
232 | + return; | ||
233 | + | ||
234 | + select_region(h,start,end); | ||
235 | + cursor_move(h,h->select.end); | ||
236 | + | ||
237 | +} | ||
238 | + | ||
239 | +static void select_region(H3270 *h, int start, int end) | ||
240 | +{ | ||
241 | + | ||
242 | + // Do we really need to change selection? | ||
243 | + if(start == h->select.start && end == h->select.end && h->selected) | ||
244 | + return; | ||
245 | + | ||
246 | + h->select.start = start; | ||
247 | + h->select.end = end; | ||
248 | + | ||
249 | + if(lib3270_get_toggle(h,LIB3270_TOGGLE_RECTANGLE_SELECT)) | ||
250 | + update_selected_rectangle(h); | ||
251 | + else | ||
252 | + update_selected_region(h); | ||
253 | + | ||
254 | + if(!h->selected) | ||
226 | { | 255 | { |
227 | - session->select.begin = session->cursor_addr; | ||
228 | - set_selected(session); | 256 | + h->selected = 1; |
257 | + h->set_selection(h,1); | ||
229 | } | 258 | } |
230 | 259 | ||
231 | - lib3270_set_cursor_address(session,session->select.end = baddr); | ||
232 | - | ||
233 | - update_selection(session); | 260 | + h->update_selection(h,start,end); |
234 | 261 | ||
235 | } | 262 | } |
236 | 263 | ||
@@ -265,7 +292,7 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba | @@ -265,7 +292,7 @@ LIB3270_EXPORT unsigned char lib3270_get_selection_flags(H3270 *hSession, int ba | ||
265 | 292 | ||
266 | LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr) | 293 | LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr) |
267 | { | 294 | { |
268 | - int pos, len; | 295 | + int pos, len, start, end; |
269 | 296 | ||
270 | CHECK_SESSION_HANDLE(session); | 297 | CHECK_SESSION_HANDLE(session); |
271 | 298 | ||
@@ -275,20 +302,20 @@ LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr) | @@ -275,20 +302,20 @@ LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr) | ||
275 | return; | 302 | return; |
276 | } | 303 | } |
277 | 304 | ||
305 | + start = session->select.start; | ||
278 | for(pos = baddr; pos > 0 && !isspace(session->text[pos].chr);pos--); | 306 | for(pos = baddr; pos > 0 && !isspace(session->text[pos].chr);pos--); |
279 | - session->select.begin = pos > 0 ? pos+1 : 0; | 307 | + start = pos > 0 ? pos+1 : 0; |
280 | 308 | ||
281 | len = session->rows * session->cols; | 309 | len = session->rows * session->cols; |
282 | for(pos = baddr; pos < len && !isspace(session->text[pos].chr);pos++); | 310 | for(pos = baddr; pos < len && !isspace(session->text[pos].chr);pos++); |
283 | - session->select.end = pos < len ? pos-1 : len; | 311 | + end = pos < len ? pos-1 : len; |
284 | 312 | ||
285 | - set_selected(session); | ||
286 | - update_selected_region(session); | 313 | + select_region(session,start,end); |
287 | } | 314 | } |
288 | 315 | ||
289 | LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr) | 316 | LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr) |
290 | { | 317 | { |
291 | - int start,len; | 318 | + int start, end,len; |
292 | 319 | ||
293 | CHECK_SESSION_HANDLE(session); | 320 | CHECK_SESSION_HANDLE(session); |
294 | 321 | ||
@@ -306,16 +333,14 @@ LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr) | @@ -306,16 +333,14 @@ LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr) | ||
306 | return -1; | 333 | return -1; |
307 | } | 334 | } |
308 | 335 | ||
309 | - session->select.begin = (start+1); | 336 | + start++; |
310 | 337 | ||
311 | len = (session->rows * session->cols)-1; | 338 | len = (session->rows * session->cols)-1; |
339 | + end = start + lib3270_field_length(session,start); | ||
340 | + if(end > len) | ||
341 | + end = len; | ||
312 | 342 | ||
313 | - session->select.end = start + lib3270_field_length(session,start); | ||
314 | - if(session->select.end > len) | ||
315 | - session->select.end = len; | ||
316 | - | ||
317 | - set_selected(session); | ||
318 | - update_selected_region(session); | 343 | + select_region(session,start,end); |
319 | 344 | ||
320 | return 0; | 345 | return 0; |
321 | } | 346 | } |
@@ -332,9 +357,11 @@ LIB3270_ACTION( selectall ) | @@ -332,9 +357,11 @@ LIB3270_ACTION( selectall ) | ||
332 | int len, baddr; | 357 | int len, baddr; |
333 | 358 | ||
334 | CHECK_SESSION_HANDLE(hSession); | 359 | CHECK_SESSION_HANDLE(hSession); |
360 | + | ||
361 | + select_region(hSession,0,hSession->rows*hSession->cols); | ||
362 | +/* | ||
335 | len = hSession->rows*hSession->cols; | 363 | len = hSession->rows*hSession->cols; |
336 | 364 | ||
337 | - // First remove unselected areas | ||
338 | for(baddr = 0; baddr < len; baddr++) | 365 | for(baddr = 0; baddr < len; baddr++) |
339 | { | 366 | { |
340 | if(!(hSession->text[baddr].attr & LIB3270_ATTR_SELECTED)) | 367 | if(!(hSession->text[baddr].attr & LIB3270_ATTR_SELECTED)) |
@@ -345,19 +372,20 @@ LIB3270_ACTION( selectall ) | @@ -345,19 +372,20 @@ LIB3270_ACTION( selectall ) | ||
345 | } | 372 | } |
346 | 373 | ||
347 | set_selected(hSession); | 374 | set_selected(hSession); |
348 | - | 375 | +*/ |
349 | return 0; | 376 | return 0; |
350 | } | 377 | } |
351 | 378 | ||
352 | LIB3270_ACTION( reselect ) | 379 | LIB3270_ACTION( reselect ) |
353 | { | 380 | { |
381 | + int start, end; | ||
382 | + | ||
354 | CHECK_SESSION_HANDLE(hSession); | 383 | CHECK_SESSION_HANDLE(hSession); |
355 | 384 | ||
356 | - if(!lib3270_connected(hSession) || hSession->select.begin == hSession->select.end || hSession->selected) | 385 | + if(!lib3270_connected(hSession) || hSession->select.start == hSession->select.end || hSession->selected) |
357 | return 0; | 386 | return 0; |
358 | 387 | ||
359 | - update_selection(hSession); | ||
360 | - set_selected(hSession); | 388 | + select_region(hSession, hSession->select.start,hSession->select.end); |
361 | 389 | ||
362 | return 0; | 390 | return 0; |
363 | } | 391 | } |
@@ -463,7 +491,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -463,7 +491,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
463 | buffer = malloc(len+1); | 491 | buffer = malloc(len+1); |
464 | ptr = buffer; | 492 | ptr = buffer; |
465 | 493 | ||
466 | - trace("len=%d buffer=%p",len,buffer); | 494 | +// trace("len=%d buffer=%p",len,buffer); |
467 | 495 | ||
468 | while(len > 0) | 496 | while(len > 0) |
469 | { | 497 | { |
@@ -484,7 +512,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -484,7 +512,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
484 | len--; | 512 | len--; |
485 | } | 513 | } |
486 | } | 514 | } |
487 | - trace("len=%d buffer=%p pos=%d",len,buffer,ptr-buffer); | 515 | +// trace("len=%d buffer=%p pos=%d",len,buffer,ptr-buffer); |
488 | 516 | ||
489 | *ptr = 0; | 517 | *ptr = 0; |
490 | 518 | ||
@@ -493,7 +521,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | @@ -493,7 +521,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) | ||
493 | 521 | ||
494 | LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession) | 522 | LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession) |
495 | { | 523 | { |
496 | - if(!hSession->selected || hSession->select.begin == hSession->select.end) | 524 | + if(!hSession->selected || hSession->select.start == hSession->select.end) |
497 | return NULL; | 525 | return NULL; |
498 | 526 | ||
499 | if(!lib3270_connected(hSession)) | 527 | if(!lib3270_connected(hSession)) |
@@ -509,18 +537,18 @@ LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int | @@ -509,18 +537,18 @@ LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int | ||
509 | 537 | ||
510 | CHECK_SESSION_HANDLE(hSession); | 538 | CHECK_SESSION_HANDLE(hSession); |
511 | 539 | ||
512 | - if(!hSession->selected || hSession->select.begin == hSession->select.end) | 540 | + if(!hSession->selected || hSession->select.start == hSession->select.end) |
513 | return 0; | 541 | return 0; |
514 | 542 | ||
515 | - if(hSession->select.end > hSession->select.begin) | 543 | + if(hSession->select.end > hSession->select.start) |
516 | { | 544 | { |
517 | - first = hSession->select.begin; | 545 | + first = hSession->select.start; |
518 | last = hSession->select.end; | 546 | last = hSession->select.end; |
519 | } | 547 | } |
520 | else | 548 | else |
521 | { | 549 | { |
522 | first = hSession->select.end; | 550 | first = hSession->select.end; |
523 | - last = hSession->select.begin; | 551 | + last = hSession->select.start; |
524 | } | 552 | } |
525 | 553 | ||
526 | if(start) | 554 | if(start) |
@@ -535,7 +563,7 @@ LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int | @@ -535,7 +563,7 @@ LIB3270_EXPORT int lib3270_get_selection_bounds(H3270 *hSession, int *start, int | ||
535 | LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) | 563 | LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) |
536 | { | 564 | { |
537 | int pos[2]; | 565 | int pos[2]; |
538 | - int rows, cols, f, step; | 566 | + int rows, cols, f, step, start, end; |
539 | 567 | ||
540 | if(!lib3270_get_selection_bounds(hSession,&pos[0],&pos[1])) | 568 | if(!lib3270_get_selection_bounds(hSession,&pos[0],&pos[1])) |
541 | return from; | 569 | return from; |
@@ -561,13 +589,10 @@ LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) | @@ -561,13 +589,10 @@ LIB3270_EXPORT int lib3270_move_selected_area(H3270 *hSession, int from, int to) | ||
561 | cols = hSession->cols - ((pos[f] % hSession->cols)+1); | 589 | cols = hSession->cols - ((pos[f] % hSession->cols)+1); |
562 | } | 590 | } |
563 | 591 | ||
564 | - step = (rows * hSession->cols) + cols; | 592 | + step = (rows * hSession->cols) + cols; |
565 | 593 | ||
566 | - hSession->select.begin += step; | ||
567 | - hSession->select.end += step; | ||
568 | - | ||
569 | - update_selection(hSession); | ||
570 | - lib3270_set_cursor_address(hSession,hSession->select.end); | 594 | + select_region(hSession,hSession->select.start + step,hSession->select.end + step); |
595 | + cursor_move(hSession,hSession->select.end); | ||
571 | 596 | ||
572 | return from+step; | 597 | return from+step; |
573 | } | 598 | } |
@@ -601,19 +626,12 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig | @@ -601,19 +626,12 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig | ||
601 | if(flag & SELECTION_BOTTOM) // Update bottom margin | 626 | if(flag & SELECTION_BOTTOM) // Update bottom margin |
602 | origin = last = (row*h->cols) + (last%h->cols); | 627 | origin = last = (row*h->cols) + (last%h->cols); |
603 | 628 | ||
604 | - if(h->select.begin < h->select.end) | ||
605 | - { | ||
606 | - h->select.begin = first; | ||
607 | - h->select.end = last; | ||
608 | - } | 629 | + if(first < last) |
630 | + select_region(h,first,last); | ||
609 | else | 631 | else |
610 | - { | ||
611 | - h->select.begin = last; | ||
612 | - h->select.end = first; | ||
613 | - } | 632 | + select_region(h,last,first); |
614 | 633 | ||
615 | - update_selection(h); | ||
616 | - lib3270_set_cursor_address(h,h->select.end); | 634 | + cursor_move(h,h->select.end); |
617 | 635 | ||
618 | return origin; | 636 | return origin; |
619 | } | 637 | } |
@@ -621,45 +639,50 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig | @@ -621,45 +639,50 @@ LIB3270_EXPORT int lib3270_drag_selection(H3270 *h, unsigned char flag, int orig | ||
621 | 639 | ||
622 | LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir) | 640 | LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir) |
623 | { | 641 | { |
624 | - if(!hSession->selected || hSession->select.begin == hSession->select.end) | 642 | + int start, end; |
643 | + | ||
644 | + if(!hSession->selected || hSession->select.start == hSession->select.end) | ||
625 | return ENOENT; | 645 | return ENOENT; |
626 | 646 | ||
647 | + start = hSession->select.start; | ||
648 | + end = hSession->select.end; | ||
649 | + | ||
627 | switch(dir) | 650 | switch(dir) |
628 | { | 651 | { |
629 | case LIB3270_DIR_UP: | 652 | case LIB3270_DIR_UP: |
630 | - if(hSession->select.begin <= hSession->cols) | 653 | + if(start <= hSession->cols) |
631 | return EINVAL; | 654 | return EINVAL; |
632 | - hSession->select.begin -= hSession->cols; | ||
633 | - hSession->select.end -= hSession->cols; | 655 | + start -= hSession->cols; |
656 | + end -= hSession->cols; | ||
634 | break; | 657 | break; |
635 | 658 | ||
636 | case LIB3270_DIR_DOWN: | 659 | case LIB3270_DIR_DOWN: |
637 | - if(hSession->select.end >= (hSession->cols * (hSession->rows-1))) | 660 | + if(end >= (hSession->cols * (hSession->rows-1))) |
638 | return EINVAL; | 661 | return EINVAL; |
639 | - hSession->select.begin += hSession->cols; | ||
640 | - hSession->select.end += hSession->cols; | 662 | + start += hSession->cols; |
663 | + end += hSession->cols; | ||
641 | break; | 664 | break; |
642 | 665 | ||
643 | case LIB3270_DIR_LEFT: | 666 | case LIB3270_DIR_LEFT: |
644 | - if( (hSession->select.begin % hSession->cols) < 1) | 667 | + if( (start % hSession->cols) < 1) |
645 | return EINVAL; | 668 | return EINVAL; |
646 | - hSession->select.begin--; | ||
647 | - hSession->select.end--; | 669 | + start--; |
670 | + end--; | ||
648 | break; | 671 | break; |
649 | 672 | ||
650 | case LIB3270_DIR_RIGHT: | 673 | case LIB3270_DIR_RIGHT: |
651 | - if( (hSession->select.end % hSession->cols) >= (hSession->cols-1)) | 674 | + if( (end % hSession->cols) >= (hSession->cols-1)) |
652 | return EINVAL; | 675 | return EINVAL; |
653 | - hSession->select.begin++; | ||
654 | - hSession->select.end++; | 676 | + start++; |
677 | + end++; | ||
655 | break; | 678 | break; |
656 | 679 | ||
657 | default: | 680 | default: |
658 | return -1; | 681 | return -1; |
659 | } | 682 | } |
660 | 683 | ||
661 | - update_selection(hSession); | ||
662 | - lib3270_set_cursor_address(hSession,hSession->select.end); | 684 | + select_region(hSession,start,end); |
685 | + cursor_move(hSession,hSession->select.end); | ||
663 | 686 | ||
664 | return 0; | 687 | return 0; |
665 | } | 688 | } |
@@ -704,6 +727,6 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u | @@ -704,6 +727,6 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u | ||
704 | if(sel) | 727 | if(sel) |
705 | lib3270_select_to(hSession,cursor_addr); | 728 | lib3270_select_to(hSession,cursor_addr); |
706 | else | 729 | else |
707 | - lib3270_set_cursor_address(hSession,cursor_addr); | ||
708 | - | 730 | + cursor_move(hSession,cursor_addr); |
709 | } | 731 | } |
732 | + |
@@ -572,7 +572,7 @@ sf_create_partition(unsigned char buf[], int buflen) | @@ -572,7 +572,7 @@ sf_create_partition(unsigned char buf[], int buflen) | ||
572 | ph = *char_height; | 572 | ph = *char_height; |
573 | trace_ds(")\n"); | 573 | trace_ds(")\n"); |
574 | 574 | ||
575 | - cursor_move(0); | 575 | + cursor_move(&h3270,0); |
576 | h3270.buffer_addr = 0; | 576 | h3270.buffer_addr = 0; |
577 | 577 | ||
578 | return PDS_OKAY_NO_OUTPUT; | 578 | return PDS_OKAY_NO_OUTPUT; |