Commit f15159b75566e7e11d7eee61f8296ed40205f8d6
1 parent
80332fed
Exists in
master
and in
3 other branches
Iniciando inclusão da ação "pastenext"
Showing
1 changed file
with
18 additions
and
13 deletions
Show diff stats
paste.c
... | ... | @@ -99,7 +99,7 @@ |
99 | 99 | * Move the cursor back within the legal paste area. |
100 | 100 | * Returns a Boolean indicating success. |
101 | 101 | */ |
102 | - static int remargin(int lmargin) | |
102 | + static int remargin(H3270 *session, int lmargin) | |
103 | 103 | { |
104 | 104 | int ever = False; |
105 | 105 | int baddr, b0 = 0; |
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | |
109 | 109 | if(toggled(MARGINED_PASTE)) |
110 | 110 | { |
111 | - baddr = h3270.cursor_addr; | |
111 | + baddr = session->cursor_addr; | |
112 | 112 | while(BA_TO_COL(baddr) < lmargin) |
113 | 113 | { |
114 | 114 | baddr = ROWCOL_TO_BA(BA_TO_ROW(baddr), lmargin); |
... | ... | @@ -118,8 +118,8 @@ |
118 | 118 | ever = True; |
119 | 119 | } |
120 | 120 | |
121 | - faddr = find_field_attribute(&h3270,baddr); | |
122 | - fa = h3270.ea_buf[faddr].fa; | |
121 | + faddr = find_field_attribute(session,baddr); | |
122 | + fa = session->ea_buf[faddr].fa; | |
123 | 123 | if (faddr == baddr || FA_IS_PROTECTED(fa)) |
124 | 124 | { |
125 | 125 | baddr = next_unprotected(baddr); |
... | ... | @@ -152,12 +152,12 @@ |
152 | 152 | |
153 | 153 | data->qtd++; |
154 | 154 | |
155 | - if(BA_TO_ROW(h3270.cursor_addr) != data->row) | |
155 | + if(BA_TO_ROW(session->cursor_addr) != data->row) | |
156 | 156 | { |
157 | - Trace("Row changed from %d to %d",data->row,BA_TO_ROW(h3270.cursor_addr)); | |
158 | - if(!remargin(data->orig_col)) | |
157 | + Trace("Row changed from %d to %d",data->row,BA_TO_ROW(session->cursor_addr)); | |
158 | + if(!remargin(session,data->orig_col)) | |
159 | 159 | return 0; |
160 | - data->row = BA_TO_ROW(h3270.cursor_addr); | |
160 | + data->row = BA_TO_ROW(session->cursor_addr); | |
161 | 161 | return '\n'; |
162 | 162 | } |
163 | 163 | |
... | ... | @@ -177,9 +177,6 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) |
177 | 177 | { |
178 | 178 | PASTE_DATA data; |
179 | 179 | unsigned char last = 1; |
180 | - int baddr; | |
181 | - int faddr; | |
182 | - unsigned char fa; | |
183 | 180 | |
184 | 181 | CHECK_SESSION_HANDLE(h); |
185 | 182 | |
... | ... | @@ -204,10 +201,14 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) |
204 | 201 | case '\n': |
205 | 202 | if(last != '\n') |
206 | 203 | { |
204 | + int baddr; | |
205 | + int faddr; | |
206 | + unsigned char fa; | |
207 | + | |
207 | 208 | baddr = (h->cursor_addr + h->cols) % (h->cols * h->rows); /* down */ |
208 | 209 | baddr = (baddr / h->cols) * h->cols; /* 1st col */ |
209 | 210 | faddr = find_field_attribute(h,baddr); |
210 | - fa = h3270.ea_buf[faddr].fa; | |
211 | + fa = h->ea_buf[faddr].fa; | |
211 | 212 | if (faddr != baddr && !FA_IS_PROTECTED(fa)) |
212 | 213 | cursor_move(baddr); |
213 | 214 | else |
... | ... | @@ -226,12 +227,16 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) |
226 | 227 | |
227 | 228 | if(IN_3270 && toggled(MARGINED_PASTE) && BA_TO_COL(h->cursor_addr) < data.orig_col) |
228 | 229 | { |
229 | - if(!remargin(data.orig_col)) | |
230 | + if(!remargin(h,data.orig_col)) | |
230 | 231 | last = 0; |
231 | 232 | } |
233 | + | |
234 | + if(h->cursor_addr == data.orig_addr) | |
235 | + break; | |
232 | 236 | } |
233 | 237 | |
234 | 238 | h->resume(h); |
239 | + | |
235 | 240 | return data.qtd; |
236 | 241 | } |
237 | 242 | ... | ... |