Subversion Repositories Kolibri OS

Rev

Rev 267 | Rev 297 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 267 Rev 280
Line 497... Line 497...
497
endf
497
endf
Line 498... Line 498...
498
 
498
 
499
;-----------------------------------------------------------------------------
499
;-----------------------------------------------------------------------------
500
func line_add_spaces ;////////////////////////////////////////////////////////
500
func line_add_spaces ;////////////////////////////////////////////////////////
-
 
501
;-----------------------------------------------------------------------------
501
;-----------------------------------------------------------------------------
502
; Input:
502
; esi = line offset
503
;  ESI = line offset
-
 
504
;  ECX = needed line length
-
 
505
; Output:
503
; ecx = needed line length
506
;  EAX = delta
-
 
507
;-----------------------------------------------------------------------------
504
;-----------------------------------------------------------------------------
508
	xor	eax,eax
505
	pushad
509
	pushad
506
	movzx	edx,word[esi]
510
	movzx	edx,word[esi]
507
	cmp	ecx,edx
511
	cmp	ecx,edx
508
	jbe	.exit
512
	jbe	.exit
-
 
513
	sub	ecx,edx
-
 
514
	lea	eax,[ecx+4]
-
 
515
	call	editor_realloc_lines
-
 
516
	mov	[esp+4*7],eax
509
	sub	ecx,edx
517
	add	esi,eax
510
	push	ecx
518
	push	ecx
511
	mov	edi,[cur_editor.Lines] ;! AREA_TEMP2
519
	mov	edi,[cur_editor.Lines] ;! AREA_TEMP2
512
	add	edi,[edi-4]
520
	add	edi,[edi-4]
513
	dec	edi
521
	dec	edi
Line 518... Line 526...
518
	add	ecx,edx;[eax]
526
	add	ecx,edx;[eax]
519
	push	ecx
527
	push	ecx
520
	neg	ecx
528
	neg	ecx
521
	lea	ecx,[esi+ecx+1]
529
	lea	ecx,[esi+ecx+1]
522
	std
530
	std
523
diff16 '32DC',0,$
-
 
524
	rep	movsb
531
	rep	movsb
525
	pop	edi ecx
532
	pop	edi ecx
526
	add	[eax],cx
533
	add	[eax],cx
527
	mov	al,' '
534
	mov	al,' '
528
	cld
535
	cld
Line 547... Line 554...
547
	call	get_line_offset
554
	call	get_line_offset
548
	and	dword[esi],not 0x00020000
555
	and	dword[esi],not 0x00020000
549
	or	dword[esi],0x00010000
556
	or	dword[esi],0x00010000
550
	mov	ecx,[sel.begin.x]
557
	mov	ecx,[sel.begin.x]
551
	call	line_add_spaces
558
	call	line_add_spaces
-
 
559
	add	esi,eax
552
	lea	edi,[esi+4]
560
	lea	edi,[esi+4]
553
	mov	ecx,[sel.end.y]
561
	mov	ecx,[sel.end.y]
554
	call	get_line_offset
562
	call	get_line_offset
555
	call	get_real_length
563
	call	get_real_length
556
	cmp	eax,[sel.end.x]
564
	cmp	eax,[sel.end.x]
Line 600... Line 608...
600
	mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
608
	mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
601
	mov	[cur_editor.SelStart.X],eax ;! [sel.x],eax
609
	mov	[cur_editor.SelStart.X],eax ;! [sel.x],eax
602
	mov	eax,[sel.begin.y]
610
	mov	eax,[sel.begin.y]
603
	mov	[cur_editor.Caret.Y],eax ;! [pos.y],eax
611
	mov	[cur_editor.Caret.Y],eax ;! [pos.y],eax
604
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
612
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
-
 
613
 
-
 
614
	mov	ecx,[cur_editor.Lines.Count]
-
 
615
	call	get_line_offset
-
 
616
	movzx	eax,word[esi]
-
 
617
	lea	esi,[esi+eax+4]
-
 
618
	mov	eax,[cur_editor.Lines]
-
 
619
	add	eax,[eax-4]
-
 
620
	sub	esi,eax
-
 
621
	lea	eax,[esi+4096]
-
 
622
	call	editor_realloc_lines
-
 
623
 
605
	popad
624
	popad
606
	mov	[cur_editor.Modified],1 ;! [modified],1
625
	mov	[cur_editor.Modified],1 ;! [modified],1
607
	clc
626
	clc
608
	ret
627
	ret
Line 628... Line 647...
628
endf
647
endf
Line 629... Line 648...
629
 
648
 
630
;-----------------------------------------------------------------------------
649
;-----------------------------------------------------------------------------
631
func get_lines_in_file ;//////////////////////////////////////////////////////
650
func get_lines_in_file ;//////////////////////////////////////////////////////
-
 
651
;-----------------------------------------------------------------------------
632
;-----------------------------------------------------------------------------
652
; Input:
633
; ESI = data pointer
653
;  ESI = data pointer
-
 
654
;  ECX = data length
-
 
655
; Output:
-
 
656
;  EAX = lines number
634
; ECX = data length
657
;  EBX = extra length after tabs expansion
635
;-----------------------------------------------------------------------------
658
;-----------------------------------------------------------------------------
636
	push	ebx ecx esi
659
	push	ecx edx esi 0
-
 
660
	or	ebx,-1
637
	or	ebx,-1
661
	xor	edx,edx
638
  .lp0: inc	ebx
662
  .lp0: inc	ebx
639
  .lp1: dec	ecx
663
  .lp1: dec	ecx
640
	jle	.lp2
664
	jle	.lp2
-
 
665
	lodsb
-
 
666
	cmp	al,0
-
 
667
	je	.lp2
-
 
668
	cmp	al,9
641
	lodsb
669
	je	.TB
642
	cmp	al,10
670
	cmp	al,10
643
	je	.LF
671
	je	.LF
644
	cmp	al,13
672
	cmp	al,13
-
 
673
	je	.CR
645
	je	.CR
674
	inc	edx
646
	jmp	.lp1
675
	jmp	.lp1
647
  .lp2: mov	eax,ebx
676
  .lp2: lea	eax,[ebx+1]
648
	pop	esi ecx ebx
677
	pop	ebx esi edx ecx
Line 649... Line 678...
649
	ret
678
	ret
650
 
679
 
651
   .CR: cmp	byte[esi],10
680
   .CR: cmp	byte[esi],10
652
	jne	.lp0
681
	jne	.LF
-
 
682
	lodsb
-
 
683
   .LF: xor	edx,edx
-
 
684
	jmp	.lp0
-
 
685
   .TB: and	edx,00000111b
-
 
686
	add	dword[esp],ATABW
-
 
687
	sub	[esp],edx
653
	lodsb
688
	xor	edx,edx
Line 654... Line 689...
654
   .LF: jmp	.lp0
689
	jmp	.lp1
655
endf
690
endf
656
 
691