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