Rev 7400 | Rev 7500 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7400 | Rev 7404 | ||
---|---|---|---|
Line 362... | Line 362... | ||
362 | call edit_box_key.sh_home_end |
362 | call edit_box_key.sh_home_end |
363 | jmp edit_box.draw_cursor_text |
363 | jmp edit_box.draw_cursor_text |
364 | ;---------------------------------------- |
364 | ;---------------------------------------- |
365 | StrInsert: |
365 | StrInsert: |
366 | ; SizeOf(TmpBuf) >= StrLen(Src) + StrLen(Dst) + 1 |
366 | ; SizeOf(TmpBuf) >= StrLen(Src) + StrLen(Dst) + 1 |
367 | Dst equ [esp + 20] ; - destination buffer |
367 | Dst equ [esp + 16] ; - destination buffer |
368 | Src equ [esp + 16] ; - source to insert from |
368 | Src equ [esp + 12] ; - source to insert from |
369 | Pos equ [esp + 12] ; - position for insert |
369 | Pos equ [esp + 8] ; - position for insert |
370 | DstMax equ [esp + 8] ; - maximum Dst length(exclude terminating null) |
370 | DstMax equ [esp + 4] ; - maximum Dst length(exclude terminating null) |
371 | TmpBuf equ [esp + 4] ; - temporary buffer |
- | |
372 | xor edx, edx |
371 | SrcCount equ [esp - 4] |
373 | mov esi, Dst |
372 | DstCount equ [esp - 8] |
374 | mov edi, TmpBuf |
373 | TmpBuf equ [esp - 12] ; - temporary buffer |
375 | mov ecx, Pos |
- | |
376 | add edx, ecx |
- | |
377 | rep movsb |
- | |
378 | mov edi, Src |
374 | mov edi, Src |
379 | mov ecx, -1 |
375 | mov ecx, -1 |
380 | xor eax, eax |
376 | xor eax, eax |
381 | repne scasb |
377 | repne scasb |
382 | mov eax, -2 |
378 | mov eax, -2 |
383 | sub eax, ecx |
379 | sub eax, ecx |
384 | add edx, eax |
- | |
385 | mov esi, Src |
- | |
386 | mov edi, TmpBuf |
- | |
387 | add edi, Pos |
- | |
388 | mov ecx, eax |
380 | mov SrcCount, eax |
389 | rep movsb |
- | |
390 | mov ebx, edi |
- | |
391 | mov edi, Dst |
381 | mov edi, Dst |
392 | add edi, Pos |
382 | add edi, Pos |
393 | mov ecx, -1 |
383 | mov ecx, -1 |
394 | xor eax, eax |
384 | xor eax, eax |
395 | repne scasb |
385 | repne scasb |
396 | mov eax, -2 |
386 | mov eax, -2 |
397 | sub eax, ecx |
387 | sub eax, ecx |
398 | inc eax |
388 | inc eax |
- | 389 | mov DstCount, eax |
|
- | 390 | mov ecx, eax |
|
- | 391 | add ecx, SrcCount |
|
399 | add edx, eax |
392 | add ecx, Pos |
- | 393 | mcall SF_SYS_MISC,SSF_MEM_ALLOC |
|
- | 394 | mov TmpBuf, eax |
|
- | 395 | mov esi, Dst |
|
- | 396 | mov edi, TmpBuf |
|
- | 397 | mov ecx, Pos |
|
400 | mov edi, ebx |
398 | mov edx, ecx |
- | 399 | rep movsb |
|
- | 400 | mov esi, Src |
|
- | 401 | mov edi, TmpBuf |
|
- | 402 | add edi, Pos |
|
- | 403 | mov ecx, SrcCount |
|
- | 404 | add edx, ecx |
|
- | 405 | rep movsb |
|
401 | mov esi, Pos |
406 | mov esi, Pos |
402 | add esi, Dst |
407 | add esi, Dst |
- | 408 | mov ecx, DstCount |
|
403 | mov ecx, eax |
409 | add edx, ecx |
404 | rep movsb |
410 | rep movsb |
405 | mov esi, TmpBuf |
411 | mov esi, TmpBuf |
406 | mov edi, Dst |
412 | mov edi, Dst |
407 | ; ecx = MIN(edx, DstSize) |
413 | ; ecx = MIN(edx, DstSize) |
408 | cmp edx, DstMax |
414 | cmp edx, DstMax |
Line 411... | Line 417... | ||
411 | not ecx |
417 | not ecx |
412 | and ecx, DstMax |
418 | and ecx, DstMax |
413 | add ecx, edx |
419 | add ecx, edx |
414 | mov eax, ecx ; return total length |
420 | mov eax, ecx ; return total length |
415 | rep movsb |
421 | rep movsb |
- | 422 | mov ecx, TmpBuf |
|
- | 423 | mcall SF_SYS_MISC,SSF_MEM_FREE |
|
416 | ret 20 |
424 | ret 16 |
417 | restore Dst |
425 | restore Dst |
418 | restore Src |
426 | restore Src |
419 | restore Pos |
427 | restore Pos |
420 | restore DstSize |
428 | restore DstSize |
421 | restore TmpBuf |
429 | restore TmpBuf |
- | 430 | restore SrcCount |
|
- | 431 | restore DstCount |
|
422 | ;---------------------------------------- |
432 | ;---------------------------------------- |
423 | edit_box_key.ctrl_x: |
433 | edit_box_key.ctrl_x: |
424 | test word ed_flags,ed_shift_on |
434 | test word ed_flags,ed_shift_on |
425 | jz edit_box.editbox_exit |
435 | jz edit_box.editbox_exit |
426 | push dword 'X' ; this value need below to determine which action is used |
436 | push dword 'X' ; this value need below to determine which action is used |
Line 528... | Line 538... | ||
528 | mov esi,eax |
538 | mov esi,eax |
529 | add esi,3*4 |
539 | add esi,3*4 |
530 | push eax edi |
540 | push eax edi |
531 | ;---------------------------------------; |
541 | ;---------------------------------------; |
532 | mov ed_size,ecx |
542 | mov ed_size,ecx |
533 | inc ecx |
- | |
534 | mcall SF_SYS_MISC,SSF_MEM_ALLOC |
- | |
535 | push eax ; save mem pointer |
- | |
536 | - | ||
537 | mov edx, ed_max |
- | |
Line 538... | Line 543... | ||
538 | 543 | ||
539 | push dword ed_text ; Dst |
544 | push dword ed_text ; Dst |
540 | push esi ; Src |
545 | push esi ; Src |
541 | push dword ed_pos ; Pos in Dst |
546 | push dword ed_pos ; Pos in Dst |
542 | push edx ; DstMax |
- | |
543 | push eax ; TmpBuf |
547 | push dword ed_max ; DstMax |
544 | call StrInsert |
- | |
545 | - | ||
546 | pop eax ; restore mem pointer |
- | |
547 | mcall SF_SYS_MISC,SSF_MEM_FREE |
548 | call StrInsert |
548 | ;---------------------------------------; |
549 | ;---------------------------------------; |
549 | ; mov edi,ed_text |
550 | ; mov edi,ed_text |
550 | ; cld |
551 | ; cld |
551 | ;@@: |
552 | ;@@: |