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