Rev 259 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
178 | heavyiron | 1 | key: |
2 | mov ecx,1 |
||
3 | mcall 66,3 |
||
4 | xor ebx,ebx |
||
5 | test al,0x03 |
||
6 | jz @f |
||
7 | or ebx,KM_SHIFT |
||
8 | @@: test al,0x0C |
||
9 | jz @f |
||
10 | or ebx,KM_CTRL |
||
11 | @@: test al,0x30 |
||
12 | jz @f |
||
13 | or ebx,KM_ALT |
||
14 | @@: mov [shi],ebx |
||
15 | test al,0x03 |
||
16 | jz @f |
||
17 | inc cl |
||
18 | @@: mcall 26,2,,key1 |
||
19 | |||
20 | mcall 2 |
||
21 | cmp al,0 |
||
22 | jne still.skip_write |
||
23 | shr eax,8 |
||
24 | cmp al,224 |
||
25 | jne @f |
||
26 | mov [ext],0x01 |
||
27 | jmp still.skip_write |
||
28 | @@: cmp al,225 |
||
29 | jne @f |
||
30 | mov [ext],0x02 |
||
31 | jmp still.skip_write |
||
32 | @@: |
||
33 | mov ah,[ext] |
||
34 | mov [ext],0 |
||
35 | or eax,[shi] |
||
36 | |||
37 | test al,0x80 |
||
38 | jnz still.skip_write |
||
39 | mov [chr],al |
||
40 | |||
41 | cmp [bot_mode],0 |
||
42 | je @f |
||
43 | mov ebx,eax |
||
44 | mov al,2 |
||
45 | call [bot_dlg_handler] |
||
46 | jmp still |
||
47 | @@: |
||
48 | |||
49 | mov esi,accel_table |
||
50 | .acc: cmp eax,[esi] |
||
51 | jne @f |
||
52 | test [options],OPTS_SECURESEL |
||
53 | jz .lp1 |
||
54 | m2m [sel.x],[pos.x] |
||
55 | m2m [sel.y],[pos.y] |
||
56 | .lp1: mov [s_status],0 |
||
57 | call dword[esi+4] |
||
58 | jmp still |
||
59 | @@: add esi,8 |
||
60 | cmp byte[esi],0 |
||
61 | jne .acc |
||
62 | |||
63 | test dword[shi],KM_CTRLALT |
||
64 | jnz still.skip_write |
||
65 | |||
66 | mov [s_status],0 |
||
67 | |||
68 | movzx eax,[chr] |
||
69 | movzx eax,[eax+key0] |
||
70 | or al,al |
||
71 | jz still.skip_write |
||
72 | movzx eax,[eax+key1] |
||
73 | push eax |
||
74 | |||
75 | test [options],OPTS_SECURESEL |
||
76 | jz .lp2 |
||
77 | m2m [sel.x],[pos.x] |
||
78 | m2m [sel.y],[pos.y] |
||
79 | jmp .put |
||
80 | .lp2: call delete_selection |
||
81 | |||
82 | test [options],OPTS_AUTOBRACES |
||
83 | jz .put |
||
84 | cmp al,'[' |
||
85 | jne @f |
||
86 | mov al,']' |
||
87 | call .lp3 |
||
88 | dec [pos.x] |
||
89 | jmp .put |
||
90 | @@: cmp al,'(' |
||
91 | jne @f |
||
92 | mov al,')' |
||
93 | call .lp3 |
||
94 | dec [pos.x] |
||
95 | jmp .put |
||
96 | @@: cmp al,'{' |
||
97 | jne .put |
||
98 | mov al,'}' |
||
99 | call .lp3 |
||
100 | dec [pos.x] |
||
101 | |||
102 | .put: pop eax |
||
103 | push still |
||
104 | inc [sel.x] |
||
105 | .lp3: push [pos.x] eax |
||
106 | inc dword[esp+4] |
||
107 | mov eax,1 |
||
108 | jmp key.tab.direct |
||
109 | |||
110 | ;----------------------------------------------------------------------------- |
||
111 | func key.ctrl_a ;///// SELECT ALL DOCUMENT /////////////////////////////////// |
||
112 | ;----------------------------------------------------------------------------- |
||
113 | xor eax,eax |
||
114 | mov [sel.x],eax |
||
115 | mov [sel.y],eax |
||
116 | mov ecx,[lines] |
||
117 | dec ecx |
||
118 | mov [pos.y],ecx |
||
119 | call get_line_offset |
||
120 | call get_real_length |
||
121 | mov [pos.x],eax |
||
122 | call draw_file |
||
123 | ret |
||
124 | endf |
||
125 | |||
126 | ;----------------------------------------------------------------------------- |
||
127 | func key.ctrl_o ;///// ENTER OPEN FILENAME /////////////////////////////////// |
||
128 | ;----------------------------------------------------------------------------- |
||
129 | mov [bot_dlg_mode2],0 |
||
130 | |||
131 | .direct: |
||
132 | mov [s_status],s_enter_filename |
||
133 | |||
134 | mov [bot_mode],1 |
||
135 | mov [bot_dlg_height],16*2+4*2-1 |
||
136 | mov [bot_dlg_handler],osdlg_handler |
||
137 | mov [focused_tb],tb_opensave |
||
138 | |||
139 | mov ecx,[f_info.length] |
||
140 | mov [tb_opensave.length],cl |
||
141 | jecxz @f |
||
142 | mov esi,f_info.path |
||
143 | mov edi,tb_opensave.text |
||
144 | cld |
||
145 | rep movsb |
||
146 | |||
147 | @@: mov al,[tb_opensave.length] |
||
148 | mov [tb_opensave.pos.x],al |
||
149 | mov [tb_opensave.sel.x],0 |
||
150 | mov [tb_casesen],1 |
||
151 | call drawwindow |
||
152 | ret |
||
153 | endf |
||
154 | |||
155 | ;----------------------------------------------------------------------------- |
||
156 | func key.ctrl_s ;///// ENTER SAVE FILENAME /////////////////////////////////// |
||
157 | ;----------------------------------------------------------------------------- |
||
158 | cmp [modified],0 |
||
159 | je .exit |
||
160 | cmp [f_info.length],0 |
||
161 | je key.shift_ctrl_s |
||
162 | call save_file |
||
163 | call drawwindow |
||
164 | .exit: |
||
165 | ret |
||
166 | |||
167 | key.shift_ctrl_s: |
||
168 | mov [bot_dlg_mode2],1 |
||
169 | jmp key.ctrl_o.direct |
||
170 | endf |
||
171 | |||
172 | ;----------------------------------------------------------------------------- |
||
173 | func key.ctrl_n ;///// ENTER SAVE FILENAME /////////////////////////////////// |
||
174 | ;----------------------------------------------------------------------------- |
||
175 | call new_file |
||
176 | ret |
||
177 | endf |
||
178 | |||
179 | ;----------------------------------------------------------------------------- |
||
180 | func key.ctrl_f ;///// ENTER KEYWORD TO FIND ///////////////////////////////// |
||
181 | ;----------------------------------------------------------------------------- |
||
182 | mov [bot_dlg_mode2],0 |
||
183 | mov [bot_dlg_height],16*2+4*2-1 |
||
184 | |||
185 | mov [s_status],s_enter_text_to_find |
||
186 | |||
187 | .direct: |
||
188 | mov [bot_mode],1 |
||
189 | mov [bot_dlg_handler],finddlg_handler |
||
190 | mov [focused_tb],tb_find |
||
191 | |||
192 | mov ecx,[s_search.size] |
||
193 | mov [tb_find.length],cl |
||
194 | jecxz @f |
||
195 | mov esi,s_search |
||
196 | mov edi,tb_find.text |
||
197 | cld |
||
198 | rep movsb |
||
199 | |||
200 | @@: mov al,[tb_find.length] |
||
201 | mov [tb_find.pos.x],al |
||
202 | mov [tb_find.sel.x],0 |
||
203 | mov [tb_casesen],0 |
||
204 | call drawwindow |
||
205 | ret |
||
206 | endf |
||
207 | |||
208 | func key.ctrl_h |
||
209 | mov [bot_dlg_mode2],1 |
||
210 | mov [bot_dlg_height],16*3+4*2+1 |
||
211 | |||
212 | mov [s_status],s_enter_text_to_replace |
||
213 | |||
214 | jmp key.ctrl_f.direct |
||
215 | endf |
||
216 | |||
217 | func key.ctrl_g |
||
218 | ret |
||
219 | macro comment { |
||
220 | mov [bot_dlg_mode2],0 |
||
221 | mov [bot_dlg_height],16*2+4*2-1 |
||
222 | |||
223 | mov [bot_mode],1 |
||
224 | mov [bot_dlg_handler],gotodlg_handler |
||
225 | mov [focused_tb],tb_gotorow |
||
226 | |||
227 | mov al,[tb_gotorow.length] |
||
228 | mov [tb_gotorow.pos.x],al |
||
229 | mov [tb_gotorow.sel.x],0 |
||
230 | mov [tb_casesen],0 |
||
231 | call drawwindow |
||
232 | ret |
||
233 | } |
||
234 | endf |
||
235 | |||
236 | ; CHANGE_LANG_LAYOUT { ; Ctrl + F8 |
||
237 | ; 3 times english -> russian |
||
238 | ; 2 times russian -> english |
||
239 | ; call layout |
||
240 | ; jmp still |
||
241 | ; CHANGE_LANG_LAYOUT } |
||
242 | |||
243 | ;----------------------------------------------------------------------------- |
||
244 | func key.ctrl_left ;///// GO TO PREVIOUS WORD //////////////////////////////// |
||
245 | ;----------------------------------------------------------------------------- |
||
246 | call clear_selection |
||
247 | |||
248 | ;----------------------------------------------------------------------------- |
||
249 | key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION ///////// |
||
250 | ;----------------------------------------------------------------------------- |
||
251 | mov ebx,[pos.y] |
||
252 | mov edx,[pos.x] |
||
253 | cld |
||
254 | mov ecx,ebx |
||
255 | call get_line_offset |
||
256 | .lp1: cmp dx,[esi] |
||
257 | jle @f |
||
258 | movzx edx,word[esi] |
||
259 | @@: dec edx |
||
260 | jl .nx1 |
||
261 | add esi,4 |
||
262 | add esi,edx |
||
263 | mov ecx,edx |
||
264 | @@: push ecx |
||
265 | mov edi,symbols_ex |
||
266 | mov ecx,symbols_ex.size+symbols.size |
||
267 | mov al,[esi] |
||
268 | dec esi |
||
269 | repne scasb |
||
270 | pop ecx |
||
271 | jne @f |
||
272 | dec edx |
||
273 | dec ecx |
||
274 | jnz @b |
||
275 | .nx1: dec ebx |
||
276 | js .exit.2 |
||
277 | mov ecx,ebx |
||
278 | call get_line_offset |
||
279 | movzx edx,word[esi] |
||
280 | dec edx |
||
281 | jmp .lp1 |
||
282 | @@: |
||
283 | mov ecx,ebx |
||
284 | call get_line_offset |
||
285 | .lp2: cmp dx,[esi] |
||
286 | jle @f |
||
287 | movzx edx,word[esi] |
||
288 | @@: or edx,edx |
||
289 | jl .nx2 |
||
290 | add esi,4 |
||
291 | add esi,edx |
||
292 | @@: mov edi,symbols_ex |
||
293 | mov ecx,symbols_ex.size+symbols.size |
||
294 | mov al,[esi] |
||
295 | dec esi |
||
296 | repne scasb |
||
297 | je @f |
||
298 | dec edx |
||
299 | jns @b |
||
300 | jmp @f |
||
301 | .nx2: dec ebx |
||
302 | js .exit.2 |
||
303 | mov ecx,ebx |
||
304 | call get_line_offset |
||
305 | movzx edx,word[esi] |
||
306 | dec edx |
||
307 | jmp .lp2 |
||
308 | @@: |
||
309 | inc edx |
||
310 | mov [pos.y],ebx |
||
311 | mov [pos.x],edx |
||
312 | test byte[shi+2],0x01 |
||
313 | jnz @f |
||
314 | mov [sel.y],ebx |
||
315 | mov [sel.x],edx |
||
316 | @@: sub ebx,[top_line] |
||
317 | jge @f |
||
318 | add [top_line],ebx |
||
319 | @@: mov eax,edx |
||
320 | sub eax,[left_col] |
||
321 | cmp eax,[columns.scr] |
||
322 | jl @f |
||
323 | sub eax,[columns.scr] |
||
324 | inc eax |
||
325 | add [left_col],eax |
||
326 | jmp .exit |
||
327 | @@: cmp edx,[left_col] |
||
328 | jge .exit |
||
329 | mov [left_col],edx |
||
330 | .exit: |
||
331 | call draw_file |
||
332 | .exit.2: |
||
333 | ret |
||
334 | endf |
||
335 | |||
336 | ;----------------------------------------------------------------------------- |
||
337 | func key.ctrl_right ;///// GO TO NEXT WORD /////////////////////////////////// |
||
338 | ;----------------------------------------------------------------------------- |
||
339 | call clear_selection |
||
340 | |||
341 | ;----------------------------------------------------------------------------- |
||
342 | key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION //////////// |
||
343 | ;----------------------------------------------------------------------------- |
||
344 | mov ebx,[pos.y] |
||
345 | mov edx,[pos.x] |
||
346 | cld |
||
347 | .lp1: mov ecx,ebx |
||
348 | call get_line_offset |
||
349 | movzx ecx,word[esi] |
||
350 | cmp edx,ecx |
||
351 | jge .nx1 |
||
352 | add esi,4 |
||
353 | add esi,edx |
||
354 | sub ecx,edx |
||
355 | @@: push ecx |
||
356 | mov edi,symbols_ex |
||
357 | mov ecx,symbols_ex.size+symbols.size |
||
358 | lodsb |
||
359 | repne scasb |
||
360 | pop ecx |
||
361 | je @f |
||
362 | inc edx |
||
363 | dec ecx |
||
364 | jnz @b |
||
365 | .nx1: inc ebx |
||
366 | cmp ebx,[lines] |
||
367 | jge .exit.2 |
||
368 | xor edx,edx |
||
369 | jmp .lp1 |
||
370 | @@: |
||
371 | |||
372 | .lp2: mov ecx,ebx |
||
373 | call get_line_offset |
||
374 | movzx ecx,word[esi] |
||
375 | cmp edx,ecx |
||
376 | jge .nx2 |
||
377 | add esi,4 |
||
378 | add esi,edx |
||
379 | sub ecx,edx |
||
380 | @@: push ecx |
||
381 | mov edi,symbols_ex |
||
382 | mov ecx,symbols_ex.size+symbols.size |
||
383 | lodsb |
||
384 | repne scasb |
||
385 | pop ecx |
||
386 | jne @f |
||
387 | inc edx |
||
388 | dec ecx |
||
389 | jnz @b |
||
390 | .nx2: inc ebx |
||
391 | cmp ebx,[lines] |
||
392 | jge .exit.2 |
||
393 | xor edx,edx |
||
394 | jmp .lp2 |
||
395 | @@: |
||
396 | mov [pos.y],ebx |
||
397 | mov [pos.x],edx |
||
398 | test byte[shi+2],0x01 |
||
399 | jnz @f |
||
400 | mov [sel.y],ebx |
||
401 | mov [sel.x],edx |
||
402 | @@: sub ebx,[top_line] |
||
403 | cmp ebx,[lines.scr] |
||
404 | jl @f |
||
405 | sub ebx,[lines.scr] |
||
406 | inc ebx |
||
407 | add [top_line],ebx |
||
408 | @@: mov eax,edx |
||
409 | sub eax,[left_col] |
||
410 | cmp eax,[columns.scr] |
||
411 | jl @f |
||
412 | sub eax,[columns.scr] |
||
413 | inc eax |
||
414 | add [left_col],eax |
||
415 | jmp .exit |
||
416 | @@: cmp edx,[left_col] |
||
417 | jge .exit |
||
418 | mov [left_col],edx |
||
419 | .exit: |
||
420 | call draw_file |
||
421 | .exit.2: |
||
422 | ret |
||
423 | endf |
||
424 | |||
425 | ;----------------------------------------------------------------------------- |
||
426 | func key.ctrl_x |
||
427 | cmp [sel.selected],0 |
||
428 | je @f |
||
429 | call key.ctrl_c |
||
430 | call key.del |
||
431 | mov [modified],1 |
||
432 | @@: ret |
||
433 | endf |
||
434 | |||
435 | ;----------------------------------------------------------------------------- |
||
436 | func key.ctrl_c |
||
437 | mov [copy_size],0 |
||
438 | cmp [sel.selected],0 |
||
439 | je .exit |
||
440 | cld |
||
441 | mov eax,[sel.begin.y] |
||
442 | cmp eax,[sel.end.y] |
||
443 | je .single_line |
||
444 | mov ecx,[sel.begin.y] |
||
445 | call get_line_offset |
||
446 | inc ecx |
||
447 | push ecx |
||
448 | mov edi,AREA_CBUF |
||
449 | call get_real_length |
||
450 | sub eax,[sel.begin.x] |
||
451 | jge @f |
||
452 | xor eax,eax |
||
453 | @@: add esi,[sel.begin.x] |
||
454 | add esi,4 |
||
455 | stosd |
||
456 | mov ecx,eax |
||
457 | jecxz @f |
||
458 | rep movsb |
||
459 | @@: mov ecx,[sel.end.y] |
||
460 | call get_line_offset |
||
461 | pop ecx |
||
462 | cmp ecx,[sel.end.y] |
||
463 | je @f |
||
464 | mov eax,esi |
||
465 | call get_line_offset |
||
466 | sub eax,esi |
||
467 | mov ecx,eax |
||
468 | rep movsb |
||
469 | mov ecx,[sel.end.y] |
||
470 | @@: call get_line_offset |
||
471 | movzx eax,word[esi] |
||
472 | add esi,4 |
||
473 | ; lodsd |
||
474 | cmp eax,[sel.end.x] |
||
475 | jle @f |
||
476 | mov eax,[sel.end.x] |
||
477 | @@: mov ebx,edi |
||
478 | stosd |
||
479 | ; add esi,eax |
||
480 | mov ecx,eax |
||
481 | jecxz @f |
||
482 | rep movsb |
||
483 | sub eax,[sel.end.x] |
||
484 | jz @f |
||
485 | neg eax |
||
486 | mov ecx,eax |
||
487 | add [ebx],eax |
||
488 | mov al,' ' |
||
489 | rep stosb |
||
490 | @@: sub edi,AREA_CBUF |
||
491 | mov [copy_size],edi |
||
492 | mov eax,[sel.end.y] |
||
493 | sub eax,[sel.begin.y] |
||
494 | inc eax |
||
495 | mov [copy_count],eax |
||
496 | .exit: |
||
497 | ret |
||
498 | |||
499 | .single_line: |
||
500 | mov eax,[sel.end.x] |
||
501 | sub eax,[sel.begin.x] |
||
502 | mov edi,AREA_CBUF |
||
503 | stosd |
||
504 | mov ecx,[sel.begin.y] |
||
505 | call get_line_offset |
||
506 | mov ebx,[sel.begin.x] |
||
507 | mov ecx,[sel.end.x] |
||
508 | cmp ebx,[esi] |
||
509 | jge .add_spaces |
||
510 | cmp ecx,[esi] |
||
511 | jle .lp1 |
||
512 | mov ecx,[esi] |
||
513 | .lp1: sub ecx,[sel.begin.x] |
||
514 | sub eax,ecx |
||
515 | lea esi,[esi+ebx+4] |
||
516 | rep movsb |
||
517 | |||
518 | .add_spaces: |
||
519 | mov ecx,eax |
||
520 | mov al,' ' |
||
521 | jecxz @b |
||
522 | rep stosb |
||
523 | jmp @b |
||
524 | endf |
||
525 | |||
526 | ;----------------------------------------------------------------------------- |
||
527 | func key.ctrl_v |
||
528 | cmp [copy_size],0 |
||
529 | je .exit |
||
530 | |||
531 | call delete_selection |
||
532 | |||
533 | mov ecx,[pos.y] |
||
534 | call get_line_offset |
||
535 | pushd [esi] esi |
||
536 | mov ecx,[pos.x] |
||
537 | call line_add_spaces |
||
538 | mov ecx,[copy_size] |
||
539 | sub ecx,4 |
||
540 | mov edi,AREA_TEMP2 |
||
541 | mov eax,esi |
||
542 | mov esi,edi |
||
543 | sub esi,ecx |
||
544 | lea ecx,[eax+4] |
||
545 | add ecx,[pos.x] |
||
546 | neg ecx |
||
547 | lea ecx,[esi+ecx+1] |
||
548 | std |
||
549 | rep movsb |
||
550 | |||
551 | mov ecx,[copy_count] |
||
552 | dec ecx |
||
553 | jz .single_line |
||
554 | |||
555 | cld |
||
556 | pop edi |
||
557 | add edi,4 |
||
558 | mov esi,AREA_CBUF |
||
559 | lodsd |
||
560 | |||
561 | mov ebx,[pos.x] |
||
562 | add eax,ebx |
||
563 | mov [edi-4],ax |
||
564 | sub eax,ebx |
||
565 | call .check_columns |
||
566 | add edi,ebx |
||
567 | @@: push ecx |
||
568 | mov ecx,eax |
||
569 | rep movsb |
||
570 | lodsd |
||
571 | and eax,0x0000FFFF |
||
572 | stosd |
||
573 | or dword[edi-4],0x00010000 |
||
574 | pop ecx |
||
575 | loop @b |
||
576 | |||
577 | pop ecx |
||
578 | sub ecx,ebx |
||
579 | add [edi-4],cx |
||
580 | call .check_columns |
||
581 | mov ecx,eax |
||
582 | rep movsb |
||
583 | |||
584 | mov [pos.x],eax |
||
585 | mov [sel.x],eax |
||
586 | mov eax,[copy_count] |
||
587 | dec eax |
||
588 | add [pos.y],eax |
||
589 | add [sel.y],eax |
||
590 | add [lines],eax |
||
591 | |||
592 | call check_inv_all |
||
593 | mov [modified],1 |
||
594 | jmp .exit |
||
595 | |||
596 | .single_line: |
||
597 | cld |
||
598 | pop edi |
||
599 | add edi,4 |
||
600 | mov esi,AREA_CBUF |
||
601 | lodsd |
||
602 | add [edi-4],ax |
||
603 | and dword[edi-4],not 0x00020000 |
||
604 | or dword[edi-4],0x00010000 |
||
605 | call .check_columns |
||
606 | add edi,[pos.x] |
||
607 | add esp,4 |
||
608 | mov ecx,eax |
||
609 | rep movsb |
||
610 | |||
611 | add [pos.x],eax |
||
612 | add [sel.x],eax |
||
613 | |||
614 | call check_inv_all |
||
615 | mov [modified],1 |
||
616 | |||
617 | .exit: |
||
618 | ret |
||
619 | |||
620 | .check_columns: |
||
621 | push eax |
||
622 | movzx eax,word[edi-4] |
||
623 | cmp eax,[columns] |
||
624 | jbe @f |
||
625 | mov [columns],eax |
||
626 | @@: pop eax |
||
627 | ret |
||
628 | ; push eax ebx esi |
||
629 | ; add esi,eax |
||
630 | ; xor ebx,ebx |
||
631 | ; neg eax |
||
632 | ; jz .lp1 |
||
633 | ; @@: cmp byte[esi+ebx-1],' ' |
||
634 | ; jne .lp1 |
||
635 | ; dec ebx |
||
636 | ; cmp ebx,eax |
||
637 | ; jg @b |
||
638 | ; .lp1: add ebx,[edi-4] |
||
639 | ; cmp [columns],ebx |
||
640 | ; jae @f |
||
641 | ; mov [columns],ebx |
||
642 | ; @@: pop esi ebx eax |
||
643 | ; ret |
||
644 | |||
645 | endf |
||
646 | |||
647 | ;----------------------------------------------------------------------------- |
||
648 | func key.ctrl_d ;///// INSERT SEPARATOR ////////////////////////////////////// |
||
649 | ;----------------------------------------------------------------------------- |
||
650 | mov ecx,[pos.y] |
||
651 | call get_line_offset |
||
652 | mov ebx,esi |
||
653 | |||
654 | mov ecx,[lines] |
||
655 | call get_line_offset |
||
656 | lea edi,[esi+90+4] |
||
657 | lea ecx,[esi+4] |
||
658 | sub ecx,ebx |
||
659 | std |
||
660 | rep movsb |
||
661 | |||
662 | lea edi,[ebx+5] |
||
663 | mov word[ebx],90 |
||
664 | mov al,ASEPC |
||
665 | mov ecx,79 |
||
666 | cld |
||
667 | rep stosb |
||
668 | mov al,' ' |
||
669 | mov ecx,10 |
||
670 | rep stosb |
||
671 | mov byte[ebx+4],';' |
||
672 | |||
673 | inc [lines] |
||
674 | inc [pos.y] |
||
675 | m2m [sel.y],[pos.y] |
||
676 | |||
677 | call check_inv_all |
||
678 | mov [modified],1 |
||
679 | |||
680 | .exit: |
||
681 | ret |
||
682 | endf |
||
683 | |||
684 | ;----------------------------------------------------------------------------- |
||
685 | func key.ctrl_y ;///// DELETE CURRENT LINE /////////////////////////////////// |
||
686 | ;----------------------------------------------------------------------------- |
||
687 | mov eax,[pos.y] |
||
688 | inc eax |
||
689 | cmp eax,[lines] |
||
690 | jge .exit |
||
691 | |||
692 | mov ecx,[pos.y] |
||
693 | call get_line_offset |
||
694 | mov edi,esi |
||
695 | lodsd |
||
696 | add esi,eax |
||
697 | |||
698 | dec [lines] |
||
699 | mov ecx,AREA_TEMP2 |
||
700 | sub ecx,esi |
||
701 | shr ecx,2 ;// fixed (was 4) |
||
702 | cld |
||
703 | rep movsd |
||
704 | call check_inv_all |
||
705 | mov [modified],1 |
||
706 | |||
707 | .exit: |
||
708 | ret |
||
709 | endf |
||
710 | |||
711 | ;----------------------------------------------------------------------------- |
||
712 | func key.up ;///// GO TO PREVIOUS LINE /////////////////////////////////////// |
||
713 | ;----------------------------------------------------------------------------- |
||
714 | call clear_selection |
||
715 | |||
716 | ;----------------------------------------------------------------------------- |
||
717 | key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION //////////////// |
||
718 | ;----------------------------------------------------------------------------- |
||
719 | mov eax,[pos.y] |
||
720 | dec eax |
||
721 | jns @f |
||
722 | xor eax,eax |
||
723 | @@: mov ecx,[top_line] |
||
724 | cmp eax,ecx |
||
725 | jae @f |
||
726 | dec ecx |
||
727 | jns @f |
||
728 | xor ecx,ecx |
||
729 | @@: test byte[shi+2],0x01 |
||
730 | jnz @f |
||
731 | mov [sel.y],eax |
||
732 | @@: call check_inv_all.skip_init |
||
733 | |||
734 | .exit: |
||
735 | ret |
||
736 | endf |
||
737 | |||
738 | ;----------------------------------------------------------------------------- |
||
739 | func key.down ;///// GO TO NEXT LINE ///////////////////////////////////////// |
||
740 | ;----------------------------------------------------------------------------- |
||
741 | call clear_selection |
||
742 | |||
743 | ;----------------------------------------------------------------------------- |
||
744 | key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION ////////////////// |
||
745 | ;----------------------------------------------------------------------------- |
||
746 | |||
747 | mov eax,[pos.y] |
||
748 | inc eax |
||
749 | cmp eax,[lines] |
||
750 | jb @f |
||
751 | dec eax |
||
752 | @@: mov ecx,[top_line] |
||
753 | mov edx,eax |
||
754 | sub edx,ecx |
||
755 | cmp edx,[lines.scr] |
||
756 | jb @f |
||
757 | inc ecx |
||
758 | @@: test byte[shi+2],0x01 |
||
759 | jnz @f |
||
760 | mov [sel.y],eax |
||
761 | @@: call check_inv_all.skip_init |
||
762 | |||
763 | .exit: |
||
764 | ret |
||
765 | endf |
||
766 | |||
767 | ;----------------------------------------------------------------------------- |
||
768 | func key.left ;///// GO TO PREVIOUS CHAR ///////////////////////////////////// |
||
769 | ;----------------------------------------------------------------------------- |
||
770 | call clear_selection |
||
771 | |||
772 | ;----------------------------------------------------------------------------- |
||
773 | key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION ////////////// |
||
774 | ;----------------------------------------------------------------------------- |
||
775 | mov eax,[pos.x] |
||
776 | dec eax |
||
777 | jns @f |
||
778 | inc eax |
||
779 | @@: test byte[shi+2],0x01 |
||
780 | jnz @f |
||
781 | mov [sel.x],eax |
||
782 | @@: mov [pos.x],eax |
||
783 | call check_inv_all |
||
784 | |||
785 | .exit: |
||
786 | ret |
||
787 | endf |
||
788 | |||
789 | ;----------------------------------------------------------------------------- |
||
790 | func key.right ;///// GO TO NEXT CHAR //////////////////////////////////////// |
||
791 | ;----------------------------------------------------------------------------- |
||
792 | call clear_selection |
||
793 | |||
794 | ;----------------------------------------------------------------------------- |
||
795 | key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION ///////////////// |
||
796 | ;----------------------------------------------------------------------------- |
||
797 | mov eax,[pos.x] |
||
798 | inc eax |
||
799 | cmp eax,[columns] |
||
800 | jbe @f |
||
801 | dec eax |
||
802 | @@: test byte[shi+2],0x01 |
||
803 | jnz @f |
||
804 | mov [sel.x],eax |
||
805 | @@: mov [pos.x],eax |
||
806 | call check_inv_all |
||
807 | |||
808 | .exit: |
||
809 | ret |
||
810 | endf |
||
811 | |||
812 | ;----------------------------------------------------------------------------- |
||
813 | func key.pgup ;///// GO TO PREVIOUS PAGE ///////////////////////////////////// |
||
814 | ;----------------------------------------------------------------------------- |
||
815 | call clear_selection |
||
816 | |||
817 | ;----------------------------------------------------------------------------- |
||
818 | key.shift_pgup: ;///// GO TO PREVIOUS PAGE, WITH SELECTION ////////////// |
||
819 | ;----------------------------------------------------------------------------- |
||
820 | mov edx,[lines.scr] |
||
821 | dec edx |
||
822 | mov eax,[pos.y] |
||
823 | mov ecx,[top_line] |
||
824 | sub eax,edx |
||
825 | jns @f |
||
826 | xor eax,eax |
||
827 | @@: sub ecx,edx |
||
828 | jns @f |
||
829 | xor ecx,ecx |
||
830 | @@: test byte[shi+2],0x01 |
||
831 | jnz @f |
||
832 | mov [sel.y],eax |
||
833 | @@: call check_inv_all.skip_init |
||
834 | |||
835 | .exit: |
||
836 | ret |
||
837 | endf |
||
838 | |||
839 | ;----------------------------------------------------------------------------- |
||
840 | func key.pgdn ;///// GO TO NEXT PAGE ///////////////////////////////////////// |
||
841 | ;----------------------------------------------------------------------------- |
||
842 | call clear_selection |
||
843 | |||
844 | ;----------------------------------------------------------------------------- |
||
845 | key.shift_pgdn: ;///// GO TO NEXT PAGE, WITH SELECTION ////////////////// |
||
846 | ;----------------------------------------------------------------------------- |
||
847 | mov edx,[lines.scr] |
||
848 | dec edx |
||
849 | mov eax,[pos.y] |
||
850 | mov ecx,[top_line] |
||
851 | add eax,edx |
||
852 | add ecx,edx |
||
853 | cmp eax,[lines] |
||
854 | jb @f |
||
855 | mov eax,[lines] |
||
856 | dec eax |
||
857 | @@: test byte[shi+2],0x01 |
||
858 | jnz @f |
||
859 | mov [sel.y],eax |
||
860 | @@: call check_inv_all.skip_init |
||
861 | |||
862 | .exit: |
||
863 | ret |
||
864 | endf |
||
865 | |||
866 | ;----------------------------------------------------------------------------- |
||
867 | func key.home ;///// GO TO LINE START //////////////////////////////////////// |
||
868 | ;----------------------------------------------------------------------------- |
||
869 | call clear_selection |
||
870 | |||
871 | ;----------------------------------------------------------------------------- |
||
872 | key.shift_home: ;///// GO TO LINE START, WITH SELECTION ///////////////// |
||
873 | ;----------------------------------------------------------------------------- |
||
874 | mov [pos.x],0 |
||
875 | test byte[shi+2],0x01 |
||
876 | jnz @f |
||
877 | mov [sel.x],0 |
||
878 | @@: call check_inv_all |
||
879 | |||
880 | .exit: |
||
881 | ret |
||
882 | endf |
||
883 | |||
884 | ;----------------------------------------------------------------------------- |
||
885 | func key.end ;///// GO TO LINE END /////////////////////////////////////////// |
||
886 | ;----------------------------------------------------------------------------- |
||
887 | call clear_selection |
||
888 | |||
889 | ;----------------------------------------------------------------------------- |
||
890 | key.shift_end: ;///// GO TO LINE END, WITH SELECTION //////////////////// |
||
891 | ;----------------------------------------------------------------------------- |
||
892 | mov ecx,[pos.y] |
||
893 | call get_line_offset |
||
894 | call get_real_length |
||
895 | mov [pos.x],eax |
||
896 | test byte[shi+2],0x01 |
||
897 | jnz @f |
||
898 | mov [sel.x],eax |
||
899 | @@: call check_inv_all |
||
900 | |||
901 | .exit: |
||
902 | ret |
||
903 | endf |
||
904 | |||
905 | ;----------------------------------------------------------------------------- |
||
906 | func key.ctrl_home ;///// GO TO PAGE START /////////////////////////////////// |
||
907 | ;----------------------------------------------------------------------------- |
||
908 | call clear_selection |
||
909 | |||
910 | ;----------------------------------------------------------------------------- |
||
911 | key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION //////////// |
||
912 | ;----------------------------------------------------------------------------- |
||
913 | mov eax,[top_line] |
||
914 | mov ecx,eax |
||
915 | test byte[shi+2],0x01 |
||
916 | jnz @f |
||
917 | mov [sel.y],eax |
||
918 | @@: call check_inv_all.skip_init |
||
919 | |||
920 | .exit: |
||
921 | ret |
||
922 | endf |
||
923 | |||
924 | ;----------------------------------------------------------------------------- |
||
925 | func key.ctrl_end ;///// GO TO PAGE END ////////////////////////////////////// |
||
926 | ;----------------------------------------------------------------------------- |
||
927 | call clear_selection |
||
928 | |||
929 | ;----------------------------------------------------------------------------- |
||
930 | key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION /////////////// |
||
931 | ;----------------------------------------------------------------------------- |
||
932 | mov ecx,[top_line] |
||
933 | mov eax,[lines.scr] |
||
934 | cmp eax,[lines] |
||
935 | jle @f |
||
936 | mov eax,[lines] |
||
937 | @@: add eax,ecx |
||
938 | dec eax |
||
939 | test byte[shi+2],0x01 |
||
940 | jnz @f |
||
941 | mov [sel.y],eax |
||
942 | @@: call check_inv_all.skip_init |
||
943 | |||
944 | .exit: |
||
945 | ret |
||
946 | endf |
||
947 | |||
948 | ;----------------------------------------------------------------------------- |
||
949 | func key.ctrl_pgup ;///// GO TO DOCUMENT START /////////////////////////////// |
||
950 | ;----------------------------------------------------------------------------- |
||
951 | call clear_selection |
||
952 | |||
953 | ;----------------------------------------------------------------------------- |
||
954 | key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION //////// |
||
955 | ;----------------------------------------------------------------------------- |
||
956 | xor eax,eax |
||
957 | mov [top_line],eax |
||
958 | mov [pos.y],eax |
||
959 | test byte[shi+2],0x01 |
||
960 | jnz @f |
||
961 | mov [sel.y],eax |
||
962 | @@: call check_inv_all.skip_check |
||
963 | |||
964 | .exit: |
||
965 | ret |
||
966 | endf |
||
967 | |||
968 | ;----------------------------------------------------------------------------- |
||
969 | func key.ctrl_pgdn ;///// GO TO DOCUMENT END ///////////////////////////////// |
||
970 | ;----------------------------------------------------------------------------- |
||
971 | call clear_selection |
||
972 | |||
973 | ;----------------------------------------------------------------------------- |
||
974 | key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION ////////// |
||
975 | ;----------------------------------------------------------------------------- |
||
976 | mov eax,[lines] ; eax = lines in the file |
||
977 | mov [pos.y],eax |
||
978 | sub eax,[lines.scr] ; eax -= lines on the screen |
||
979 | jns @f |
||
980 | xor eax,eax |
||
981 | @@: mov [top_line],eax |
||
982 | dec [pos.y] |
||
983 | test byte[shi+2],0x01 |
||
984 | jnz @f |
||
985 | push [pos.y] |
||
986 | pop [sel.y] |
||
987 | @@: call check_inv_all.skip_check |
||
988 | |||
989 | .exit: |
||
990 | ret |
||
991 | endf |
||
992 | |||
993 | ;----------------------------------------------------------------------------- |
||
994 | func key.del ;///// DELETE NEXT CHAR OR SELECTION //////////////////////////// |
||
995 | ;----------------------------------------------------------------------------- |
||
996 | call delete_selection |
||
997 | jnc .exit.2 |
||
998 | |||
999 | mov ecx,[pos.y] |
||
1000 | call get_line_offset |
||
1001 | and dword[esi],not 0x00020000 |
||
1002 | or dword[esi],0x00010000 |
||
1003 | lea ebx,[esi+4] |
||
1004 | mov ebp,esi |
||
1005 | |||
1006 | call get_real_length |
||
1007 | or eax,eax |
||
1008 | je .line_up |
||
1009 | |||
1010 | mov ecx,[pos.x] |
||
1011 | cmp ecx,eax |
||
1012 | jae .line_up |
||
1013 | lea edi,[ebx+ecx] |
||
1014 | neg ecx |
||
1015 | movzx eax,word[ebp] |
||
1016 | add ecx,eax;[ebp] |
||
1017 | repe scasb |
||
1018 | je .line_up |
||
1019 | |||
1020 | mov edi,ebx |
||
1021 | mov ecx,[pos.x] |
||
1022 | add edi,ecx |
||
1023 | lea esi,[edi+1] |
||
1024 | neg ecx |
||
1025 | movzx eax,word[ebp] |
||
1026 | add ecx,eax;[ebp] |
||
1027 | dec ecx |
||
1028 | rep movsb |
||
1029 | mov byte[edi],' ' |
||
1030 | |||
1031 | m2m [sel.x],[pos.x] |
||
1032 | m2m [sel.y],[pos.y] |
||
1033 | call check_inv_all |
||
1034 | mov [modified],1 |
||
1035 | ret |
||
1036 | |||
1037 | .line_up: |
||
1038 | mov eax,[lines] |
||
1039 | dec eax |
||
1040 | cmp eax,[pos.y] |
||
1041 | je .exit |
||
1042 | mov edi,AREA_TEMP+4 |
||
1043 | mov esi,ebx |
||
1044 | mov ecx,[pos.x] |
||
1045 | rep movsb |
||
1046 | mov ecx,[pos.x] |
||
1047 | mov [AREA_TEMP],ecx |
||
1048 | cmp cx,[ebp] |
||
1049 | jbe @f |
||
1050 | movzx eax,word[ebp] |
||
1051 | sub ecx,eax;[ebp] |
||
1052 | sub edi,ecx |
||
1053 | mov al,' ' |
||
1054 | rep stosb |
||
1055 | @@: lea esi,[ebx+4] |
||
1056 | movzx eax,word[ebp] |
||
1057 | add esi,eax;[ebp] |
||
1058 | movzx ecx,word[esi-4] |
||
1059 | add [AREA_TEMP],ecx |
||
1060 | or dword[AREA_TEMP],0x00010000 |
||
1061 | rep movsb |
||
1062 | |||
1063 | lea ecx,[edi-AREA_TEMP] |
||
1064 | |||
1065 | mov esi,AREA_TEMP |
||
1066 | call get_real_length |
||
1067 | cmp eax,[columns] |
||
1068 | jbe @f |
||
1069 | mov [columns],eax |
||
1070 | @@: |
||
1071 | push ecx |
||
1072 | mov edi,AREA_TEMP2 |
||
1073 | lea esi,[edi+8] |
||
1074 | sub esi,ecx |
||
1075 | movzx eax,word[ebp] |
||
1076 | add esi,eax;[ebp] |
||
1077 | ; lea eax,[ebp+4] |
||
1078 | ; add eax,[ebp] |
||
1079 | movzx eax,word[ebp] |
||
1080 | movzx eax,word[ebp+eax+4] |
||
1081 | add esi,eax;[eax] |
||
1082 | lea ecx,[esi-4] |
||
1083 | sub ecx,ebp |
||
1084 | std |
||
1085 | cmp esi,edi |
||
1086 | jb @f |
||
1087 | jz .lp1 |
||
1088 | mov edi,ebp |
||
1089 | add edi,[esp] |
||
1090 | lea esi,[ebp+8] |
||
1091 | movzx eax,word[esi-8] |
||
1092 | add esi,eax;[esi-8] |
||
1093 | movzx eax,word[esi-4] |
||
1094 | add esi,eax;[esi-4] |
||
1095 | mov ecx,AREA_TEMP2 |
||
1096 | sub ecx,esi |
||
1097 | cld |
||
1098 | @@: rep movsb |
||
1099 | .lp1: pop ecx |
||
1100 | mov esi,AREA_TEMP |
||
1101 | mov edi,ebp |
||
1102 | cld |
||
1103 | rep movsb |
||
1104 | |||
1105 | .ok.dec.lines: |
||
1106 | dec [lines] |
||
1107 | mov eax,[lines] |
||
1108 | cmp [pos.y],eax |
||
1109 | jb @f |
||
1110 | dec eax |
||
1111 | mov [pos.y],eax |
||
1112 | @@: m2m [sel.x],[pos.x] |
||
1113 | m2m [sel.y],[pos.y] |
||
1114 | |||
1115 | mov [modified],1 |
||
1116 | .exit.2: |
||
1117 | call check_inv_all |
||
1118 | |||
1119 | .exit: |
||
1120 | ret |
||
1121 | endf |
||
1122 | |||
1123 | ;----------------------------------------------------------------------------- |
||
1124 | ; INSERT { |
||
1125 | key.ins: |
||
1126 | ;// ... toggle insert/overwrite mode here ... |
||
1127 | xor [ins_mode],1 |
||
1128 | call check_inv_str |
||
1129 | ret |
||
1130 | ; INSERT } |
||
1131 | |||
1132 | ;----------------------------------------------------------------------------- |
||
1133 | func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION //////////////////// |
||
1134 | ;----------------------------------------------------------------------------- |
||
1135 | call delete_selection |
||
1136 | jnc key.del.exit.2 |
||
1137 | |||
1138 | mov eax,[pos.x] |
||
1139 | dec eax |
||
1140 | js .line_up |
||
1141 | |||
1142 | dec [pos.x] |
||
1143 | mov ecx,[pos.y] |
||
1144 | call get_line_offset |
||
1145 | and dword[esi],not 0x00020000 |
||
1146 | or dword[esi],0x00010000 |
||
1147 | |||
1148 | mov ebx,eax |
||
1149 | call get_real_length |
||
1150 | cmp eax,[pos.x] |
||
1151 | jae @f |
||
1152 | m2m [sel.x],[pos.x] |
||
1153 | call check_inv_all |
||
1154 | mov [modified],1 |
||
1155 | ret |
||
1156 | |||
1157 | @@: lea edi,[esi+4+ebx] |
||
1158 | mov ecx,ebx |
||
1159 | neg ecx |
||
1160 | movzx eax,word[esi] |
||
1161 | add ecx,eax;[esi] |
||
1162 | dec ecx |
||
1163 | lea esi,[edi+1] |
||
1164 | cld |
||
1165 | rep movsb |
||
1166 | mov byte[edi],' ' |
||
1167 | |||
1168 | m2m [sel.x],[pos.x] |
||
1169 | m2m [sel.y],[pos.y] |
||
1170 | call check_inv_str |
||
1171 | mov [modified],1 |
||
1172 | ret |
||
1173 | |||
1174 | .line_up: |
||
1175 | cmp [pos.y],0 |
||
1176 | jne @f |
||
1177 | ret |
||
1178 | @@: mov ecx,[pos.y] |
||
1179 | dec ecx |
||
1180 | call get_line_offset |
||
1181 | and dword[esi],not 0x00020000 |
||
1182 | or dword[esi],0x00010000 |
||
1183 | |||
1184 | mov ebp,esi |
||
1185 | lea ebx,[esi+4] |
||
1186 | movzx ecx,word[ebp] |
||
1187 | @@: cmp byte[ebx+ecx-1],' ' |
||
1188 | jne @f |
||
1189 | dec ecx |
||
1190 | jg @b |
||
1191 | @@: mov [pos.x],ecx |
||
1192 | dec [pos.y] |
||
1193 | cld |
||
1194 | jmp key.del.line_up |
||
1195 | endf |
||
1196 | |||
1197 | ;----------------------------------------------------------------------------- |
||
1198 | func key.tab ;///// TABULATE ///////////////////////////////////////////////// |
||
1199 | ;----------------------------------------------------------------------------- |
||
1200 | call delete_selection |
||
1201 | mov eax,[pos.x] |
||
1202 | |||
1203 | mov ecx,eax |
||
1204 | add eax,ATABW |
||
1205 | and eax,not(ATABW-1) |
||
1206 | push eax ' ' |
||
1207 | sub eax,ecx |
||
1208 | .direct: |
||
1209 | mov ecx,[pos.y] |
||
1210 | call get_line_offset |
||
1211 | and dword[esi],not 0x00020000 |
||
1212 | or dword[esi],0x00010000 |
||
1213 | |||
1214 | xchg eax,ecx |
||
1215 | |||
1216 | call get_real_length |
||
1217 | cmp eax,[pos.x] |
||
1218 | jae @f |
||
1219 | mov eax,[pos.x] |
||
1220 | @@: movzx edx,word[esi] |
||
1221 | sub edx,eax |
||
1222 | cmp ecx,edx |
||
1223 | jl @f |
||
1224 | pushad; esi ecx eax |
||
1225 | mov ecx,AREA_TEMP2-10+1 |
||
1226 | ; lea eax,[esi+4] |
||
1227 | ; add eax,[esi] |
||
1228 | movzx eax,word[esi] |
||
1229 | lea eax,word[esi+eax+4] |
||
1230 | sub ecx,eax |
||
1231 | mov edi,AREA_TEMP2 |
||
1232 | mov esi,AREA_TEMP2-10 |
||
1233 | std |
||
1234 | rep movsb |
||
1235 | mov ecx,10 |
||
1236 | mov al,' ' |
||
1237 | rep stosb |
||
1238 | popad; eax ecx esi |
||
1239 | add word[esi],10 |
||
1240 | jmp @b |
||
1241 | @@: lea ebx,[esi+4] |
||
1242 | push ecx |
||
1243 | ; lea edi,[ebx-1] |
||
1244 | ; add edi,[esi] |
||
1245 | movzx edi,word[esi] |
||
1246 | lea edi,[ebx+edi-1] |
||
1247 | mov esi,edi |
||
1248 | sub esi,ecx |
||
1249 | lea ecx,[esi+1] |
||
1250 | sub ecx,ebx |
||
1251 | sub ecx,[pos.x] |
||
1252 | std |
||
1253 | rep movsb |
||
1254 | .ok: pop ecx ;******* |
||
1255 | pop eax |
||
1256 | rep stosb |
||
1257 | cld |
||
1258 | pop [pos.x] |
||
1259 | lea esi,[ebx-4] |
||
1260 | call get_real_length |
||
1261 | cmp eax,[pos.x] |
||
1262 | jae @f |
||
1263 | mov eax,[pos.x] |
||
1264 | @@: cmp eax,[columns] |
||
1265 | jbe @f |
||
1266 | mov [columns],eax |
||
1267 | @@: m2m [sel.x],[pos.x] |
||
1268 | m2m [sel.y],[pos.y] |
||
1269 | call check_inv_all |
||
1270 | mov [modified],1 |
||
1271 | |||
1272 | .exit: |
||
1273 | ret |
||
1274 | endf |
||
1275 | |||
1276 | ;----------------------------------------------------------------------------- |
||
1277 | func key.return ;///// CARRIAGE RETURN /////////////////////////////////////// |
||
1278 | ;----------------------------------------------------------------------------- |
||
1279 | call delete_selection |
||
1280 | |||
1281 | mov ecx,[pos.y] |
||
1282 | call get_line_offset |
||
1283 | |||
1284 | mov ebx,[pos.x] |
||
1285 | cmp bx,[esi] |
||
1286 | jb @f |
||
1287 | movzx ebx,word[esi] |
||
1288 | dec ebx |
||
1289 | jns @f |
||
1290 | xor ebx,ebx |
||
1291 | @@: |
||
1292 | cld |
||
1293 | |||
1294 | mov edi,AREA_TEMP |
||
1295 | mov ebp,esi |
||
1296 | mov ecx,ebx |
||
1297 | inc ecx |
||
1298 | @@: dec ecx |
||
1299 | jz @f |
||
1300 | cmp byte[esi+ecx+4-1],' ' |
||
1301 | je @b |
||
1302 | @@: lea eax,[ecx+10] |
||
1303 | or eax,0x00010000 |
||
1304 | stosd |
||
1305 | jecxz @f |
||
1306 | push esi |
||
1307 | add esi,4 |
||
1308 | rep movsb |
||
1309 | pop esi |
||
1310 | @@: mov al,' ' |
||
1311 | mov ecx,10 |
||
1312 | rep stosb |
||
1313 | |||
1314 | movzx ecx,word[esi] |
||
1315 | sub ecx,ebx;[pos.x] |
||
1316 | add esi,ebx;[pos.x] |
||
1317 | add esi,4 |
||
1318 | inc ecx |
||
1319 | @@: dec ecx |
||
1320 | jz @f |
||
1321 | cmp byte[esi+ecx-1],' ' |
||
1322 | je @b |
||
1323 | @@: jz .lp1 |
||
1324 | @@: cmp byte[esi],' ' |
||
1325 | jne .lp1 |
||
1326 | inc esi |
||
1327 | loop @b |
||
1328 | .lp1: test [options],OPTS_AUTOINDENT |
||
1329 | jz .lp2 |
||
1330 | push edi ecx |
||
1331 | movzx ecx,word[ebp] |
||
1332 | lea edi,[ebp+4] |
||
1333 | mov al,' ' |
||
1334 | repe scasb |
||
1335 | mov eax,ecx |
||
1336 | pop ecx edi |
||
1337 | je .lp2 |
||
1338 | neg eax |
||
1339 | movzx edx,word[ebp] |
||
1340 | add eax,edx;[ebp] |
||
1341 | dec eax |
||
1342 | jmp @f |
||
1343 | .lp2: xor eax,eax |
||
1344 | @@: mov edx,edi |
||
1345 | add edi,4 |
||
1346 | mov [pos.x],eax |
||
1347 | jecxz @f |
||
1348 | push ecx |
||
1349 | mov ecx,eax |
||
1350 | mov al,' ' |
||
1351 | rep stosb |
||
1352 | pop ecx |
||
1353 | @@: jecxz @f |
||
1354 | rep movsb |
||
1355 | @@: mov ecx,10 |
||
1356 | mov al,' ' |
||
1357 | rep stosb |
||
1358 | |||
1359 | lea eax,[edi-4] |
||
1360 | sub eax,edx |
||
1361 | or eax,0x00010000 |
||
1362 | mov [edx],eax |
||
1363 | |||
1364 | lea ecx,[edi-AREA_TEMP] |
||
1365 | |||
1366 | push ecx |
||
1367 | mov edi,AREA_TEMP2 |
||
1368 | lea esi,[edi+4] |
||
1369 | sub esi,ecx |
||
1370 | movzx ecx,word[ebp] |
||
1371 | add esi,ecx;[ebp] |
||
1372 | lea ecx,[esi-4] |
||
1373 | sub ecx,ebp |
||
1374 | std |
||
1375 | cmp esi,edi |
||
1376 | jb @f |
||
1377 | je .lp3 |
||
1378 | lea esi,[ebp+4] |
||
1379 | mov eax,[esp] |
||
1380 | lea edi,[esi+eax-4] |
||
1381 | movzx ecx,word[ebp] |
||
1382 | add esi,ecx;[ebp] |
||
1383 | mov ecx,AREA_TEMP2 |
||
1384 | sub ecx,esi |
||
1385 | cld |
||
1386 | @@: rep movsb |
||
1387 | .lp3: pop ecx |
||
1388 | mov esi,AREA_TEMP |
||
1389 | mov edi,ebp |
||
1390 | cld |
||
1391 | rep movsb |
||
1392 | |||
1393 | inc [pos.y] |
||
1394 | inc [sel.y] |
||
1395 | inc [lines] |
||
1396 | |||
1397 | m2m [sel.x],[pos.x] |
||
1398 | |||
1399 | call check_inv_all |
||
1400 | mov [modified],1 |
||
1401 | |||
1402 | .exit: |
||
1403 | ret |
||
1404 | endf |