Commit 835ec4d31814c8b138f1f659e8e016b5278847c4
1 parent
83f82697
Exists in
master
and in
5 other branches
Rômulo Silva Neiva - 29 de agosto de 2012 07:54
* a rolagem do cursor para nas bordas superior e inferior ou seja, não percorre a janela ciclicamente.
Showing
2 changed files
with
18 additions
and
5 deletions
Show diff stats
po/pt_BR.po
| ... | ... | @@ -5,7 +5,7 @@ msgid "" |
| 5 | 5 | msgstr "" |
| 6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
| 7 | 7 | "Report-Msgid-Bugs-To: \n" |
| 8 | -"POT-Creation-Date: 2012-08-28 07:32-0300\n" | |
| 8 | +"POT-Creation-Date: 2012-08-28 10:10-0300\n" | |
| 9 | 9 | "PO-Revision-Date: 2012-08-27 09:01-0300\n" |
| 10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
| 11 | 11 | "Language-Team: Português do Brasil <>\n" | ... | ... |
src/lib3270/selection.c
| ... | ... | @@ -695,6 +695,7 @@ LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir |
| 695 | 695 | LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, unsigned char sel) |
| 696 | 696 | { |
| 697 | 697 | int cursor_addr = hSession->cursor_addr; |
| 698 | + int maxlen = hSession->cols * hSession->rows; | |
| 698 | 699 | |
| 699 | 700 | if(!lib3270_connected(hSession)) |
| 700 | 701 | return -1; |
| ... | ... | @@ -702,25 +703,25 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u |
| 702 | 703 | switch(dir) |
| 703 | 704 | { |
| 704 | 705 | case LIB3270_DIR_UP: |
| 705 | - if(cursor_addr <= hSession->cols) | |
| 706 | + if(sel && cursor_addr <= hSession->cols) | |
| 706 | 707 | return EINVAL; |
| 707 | 708 | cursor_addr -= hSession->cols; |
| 708 | 709 | break; |
| 709 | 710 | |
| 710 | 711 | case LIB3270_DIR_DOWN: |
| 711 | - if(cursor_addr >= (hSession->cols * (hSession->rows-1))) | |
| 712 | + if(sel && cursor_addr >= (hSession->cols * (hSession->rows-1))) | |
| 712 | 713 | return EINVAL; |
| 713 | 714 | cursor_addr += hSession->cols; |
| 714 | 715 | break; |
| 715 | 716 | |
| 716 | 717 | case LIB3270_DIR_LEFT: |
| 717 | - if( (cursor_addr % hSession->cols) < 1) | |
| 718 | + if(sel && (cursor_addr % hSession->cols) < 1) | |
| 718 | 719 | return EINVAL; |
| 719 | 720 | cursor_addr--; |
| 720 | 721 | break; |
| 721 | 722 | |
| 722 | 723 | case LIB3270_DIR_RIGHT: |
| 723 | - if( (cursor_addr % hSession->cols) >= (hSession->cols-1)) | |
| 724 | + if(sel && (cursor_addr % hSession->cols) >= (hSession->cols-1)) | |
| 724 | 725 | return EINVAL; |
| 725 | 726 | cursor_addr++; |
| 726 | 727 | break; |
| ... | ... | @@ -730,9 +731,21 @@ LIB3270_EXPORT int lib3270_move_cursor(H3270 *hSession, LIB3270_DIRECTION dir, u |
| 730 | 731 | } |
| 731 | 732 | |
| 732 | 733 | if(sel) |
| 734 | + { | |
| 733 | 735 | lib3270_select_to(hSession,cursor_addr); |
| 736 | + } | |
| 737 | + else if(cursor_addr >= maxlen) | |
| 738 | + { | |
| 739 | + cursor_move(hSession,cursor_addr % maxlen); | |
| 740 | + } | |
| 741 | + else if(cursor_addr < 0) | |
| 742 | + { | |
| 743 | + cursor_move(hSession,cursor_addr + maxlen); | |
| 744 | + } | |
| 734 | 745 | else |
| 746 | + { | |
| 735 | 747 | cursor_move(hSession,cursor_addr); |
| 748 | + } | |
| 736 | 749 | |
| 737 | 750 | return 0; |
| 738 | 751 | } | ... | ... |