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