Subversion Repositories Kolibri OS

Rev

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

Rev 178 Rev 259
Line 49... Line 49...
49
	mov	esi,accel_table
49
	mov	esi,accel_table
50
  .acc: cmp	eax,[esi]
50
  .acc: cmp	eax,[esi]
51
	jne	@f
51
	jne	@f
52
	test	[options],OPTS_SECURESEL
52
	test	[options],OPTS_SECURESEL
53
	jz	.lp1
53
	jz	.lp1
54
	m2m	[sel.x],[pos.x]
54
	m2m	[cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
55
	m2m	[sel.y],[pos.y]
55
	m2m	[cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
56
  .lp1: mov	[s_status],0
56
  .lp1: mov	[s_status],0
57
	call	dword[esi+4]
57
	call	dword[esi+4]
58
	jmp	still
58
	jmp	still
59
    @@: add	esi,8
59
    @@: add	esi,8
60
	cmp	byte[esi],0
60
	cmp	byte[esi],0
Line 72... Line 72...
72
	movzx	eax,[eax+key1]
72
	movzx	eax,[eax+key1]
73
	push	eax
73
	push	eax
Line 74... Line 74...
74
 
74
 
75
	test	[options],OPTS_SECURESEL
75
	test	[options],OPTS_SECURESEL
76
	jz	.lp2
76
	jz	.lp2
77
	m2m	[sel.x],[pos.x]
77
	m2m	[cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
78
	m2m	[sel.y],[pos.y]
78
	m2m	[cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
79
	jmp	.put
79
	jmp	.put
Line 80... Line 80...
80
  .lp2: call	delete_selection
80
  .lp2: call	delete_selection
81
 
81
 
82
	test	[options],OPTS_AUTOBRACES
82
	test	[options],OPTS_AUTOBRACES
83
	jz	.put
83
	jz	.put
84
	cmp	al,'['
84
	cmp	al,'['
85
	jne	@f
85
	jne	@f
86
	mov	al,']'
86
	mov	al,']'
87
	call	.lp3
87
	call	.lp3
88
	dec	[pos.x]
88
	dec	[cur_tab.Editor.Caret.X] ;! [pos.x]
89
	jmp	.put
89
	jmp	.put
90
    @@: cmp	al,'('
90
    @@: cmp	al,'('
91
	jne	@f
91
	jne	@f
92
	mov	al,')'
92
	mov	al,')'
93
	call	.lp3
93
	call	.lp3
94
	dec	[pos.x]
94
	dec	[cur_tab.Editor.Caret.X] ;! [pos.x]
95
	jmp	.put
95
	jmp	.put
96
    @@: cmp	al,'{'
96
    @@: cmp	al,'{'
97
	jne	.put
97
	jne	.put
98
	mov	al,'}'
98
	mov	al,'}'
Line 99... Line 99...
99
	call	.lp3
99
	call	.lp3
100
	dec	[pos.x]
100
	dec	[cur_tab.Editor.Caret.X] ;! [pos.x]
101
 
101
 
102
  .put: pop	eax
102
  .put: pop	eax
103
	push	still
103
	push	still
104
	inc	[sel.x]
104
	inc	[cur_tab.Editor.SelStart.X] ;! [sel.x]
105
  .lp3: push	[pos.x] eax
105
  .lp3: push	[cur_tab.Editor.Caret.X] eax ;! [pos.x] eax
Line 106... Line 106...
106
	inc	dword[esp+4]
106
	inc	dword[esp+4]
107
	mov	eax,1
107
	mov	eax,1
108
	jmp	key.tab.direct
108
	jmp	key.tab.direct
109
 
109
 
110
;-----------------------------------------------------------------------------
110
;-----------------------------------------------------------------------------
111
func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
111
func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
112
;-----------------------------------------------------------------------------
112
;-----------------------------------------------------------------------------
113
	xor	eax,eax
113
	xor	eax,eax
114
	mov	[sel.x],eax
114
	mov	[cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
115
	mov	[sel.y],eax
115
	mov	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
116
	mov	ecx,[lines]
116
	mov	ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
117
	dec	ecx
117
	dec	ecx
118
	mov	[pos.y],ecx
118
	mov	[cur_tab.Editor.Caret.Y],ecx ;! [pos.y],ecx
119
	call	get_line_offset
119
	call	get_line_offset
120
	call	get_real_length
120
	call	get_real_length
Line 121... Line 121...
121
	mov	[pos.x],eax
121
	mov	[cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
Line 153... Line 153...
153
endf
153
endf
Line 154... Line 154...
154
 
154
 
155
;-----------------------------------------------------------------------------
155
;-----------------------------------------------------------------------------
156
func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
156
func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
157
;-----------------------------------------------------------------------------
157
;-----------------------------------------------------------------------------
158
	cmp	[modified],0
158
	cmp	[cur_tab.Editor.Modified],0 ;! [modified],0
159
	je	.exit
159
	je	.exit
160
	cmp	[f_info.length],0
160
	cmp	[f_info.length],0
161
	je	key.shift_ctrl_s
161
	je	key.shift_ctrl_s
162
	call	save_file
162
	call	save_file
Line 170... Line 170...
170
endf
170
endf
Line 171... Line 171...
171
 
171
 
172
;-----------------------------------------------------------------------------
172
;-----------------------------------------------------------------------------
173
func key.ctrl_n ;///// ENTER SAVE FILENAME ///////////////////////////////////
173
func key.ctrl_n ;///// ENTER SAVE FILENAME ///////////////////////////////////
174
;-----------------------------------------------------------------------------
174
;-----------------------------------------------------------------------------
175
	call	new_file
175
	call	create_tab
176
	ret
176
	ret
Line 177... Line 177...
177
endf
177
endf
178
 
178
 
Line 246... Line 246...
246
	call	clear_selection
246
	call	clear_selection
Line 247... Line 247...
247
 
247
 
248
;-----------------------------------------------------------------------------
248
;-----------------------------------------------------------------------------
249
     key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
249
     key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
250
;-----------------------------------------------------------------------------
250
;-----------------------------------------------------------------------------
251
	mov	ebx,[pos.y]
251
	mov	ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y]
252
	mov	edx,[pos.x]
252
	mov	edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x]
253
	cld
253
	cld
254
	mov	ecx,ebx
254
	mov	ecx,ebx
255
	call	get_line_offset
255
	call	get_line_offset
256
  .lp1: cmp	dx,[esi]
256
  .lp1: cmp	dx,[esi]
Line 305... Line 305...
305
	movzx	edx,word[esi]
305
	movzx	edx,word[esi]
306
	dec	edx
306
	dec	edx
307
	jmp	.lp2
307
	jmp	.lp2
308
    @@:
308
    @@:
309
	inc	edx
309
	inc	edx
310
	mov	[pos.y],ebx
310
	mov	[cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx
311
	mov	[pos.x],edx
311
	mov	[cur_tab.Editor.Caret.X],edx ;! [pos.x],edx
312
	test	byte[shi+2],0x01
312
	test	byte[shi+2],0x01
313
	jnz	@f
313
	jnz	@f
314
	mov	[sel.y],ebx
314
	mov	[cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx
315
	mov	[sel.x],edx
315
	mov	[cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx
316
    @@: sub	ebx,[top_line]
316
    @@: sub	ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line]
317
	jge	@f
317
	jge	@f
318
	add	[top_line],ebx
318
	add	[cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx
319
    @@: mov	eax,edx
319
    @@: mov	eax,edx
320
	sub	eax,[left_col]
320
	sub	eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
321
	cmp	eax,[columns.scr]
321
	cmp	eax,[columns.scr]
322
	jl	@f
322
	jl	@f
323
	sub	eax,[columns.scr]
323
	sub	eax,[columns.scr]
324
	inc	eax
324
	inc	eax
325
	add	[left_col],eax
325
	add	[cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
326
	jmp	.exit
326
	jmp	.exit
327
    @@: cmp	edx,[left_col]
327
    @@: cmp	edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col]
328
	jge	.exit
328
	jge	.exit
329
	mov	[left_col],edx
329
	mov	[cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx
330
  .exit:
330
  .exit:
331
	call	draw_file
331
	call	draw_file
332
  .exit.2:
332
  .exit.2:
333
	ret
333
	ret
334
endf
334
endf
Line 339... Line 339...
339
	call	clear_selection
339
	call	clear_selection
Line 340... Line 340...
340
 
340
 
341
;-----------------------------------------------------------------------------
341
;-----------------------------------------------------------------------------
342
     key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
342
     key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
343
;-----------------------------------------------------------------------------
343
;-----------------------------------------------------------------------------
344
	mov	ebx,[pos.y]
344
	mov	ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y]
345
	mov	edx,[pos.x]
345
	mov	edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x]
346
	cld
346
	cld
347
  .lp1: mov	ecx,ebx
347
  .lp1: mov	ecx,ebx
348
	call	get_line_offset
348
	call	get_line_offset
349
	movzx	ecx,word[esi]
349
	movzx	ecx,word[esi]
Line 361... Line 361...
361
	je	@f
361
	je	@f
362
	inc	edx
362
	inc	edx
363
	dec	ecx
363
	dec	ecx
364
	jnz	@b
364
	jnz	@b
365
  .nx1: inc	ebx
365
  .nx1: inc	ebx
366
	cmp	ebx,[lines]
366
	cmp	ebx,[cur_tab.Editor.Lines] ;! ebx,[lines]
367
	jge	.exit.2
367
	jge	.exit.2
368
	xor	edx,edx
368
	xor	edx,edx
369
	jmp	.lp1
369
	jmp	.lp1
370
    @@:
370
    @@:
Line 386... Line 386...
386
	jne	@f
386
	jne	@f
387
	inc	edx
387
	inc	edx
388
	dec	ecx
388
	dec	ecx
389
	jnz	@b
389
	jnz	@b
390
  .nx2: inc	ebx
390
  .nx2: inc	ebx
391
	cmp	ebx,[lines]
391
	cmp	ebx,[cur_tab.Editor.Lines] ;! ebx,[lines]
392
	jge	.exit.2
392
	jge	.exit.2
393
	xor	edx,edx
393
	xor	edx,edx
394
	jmp	.lp2
394
	jmp	.lp2
395
    @@:
395
    @@:
396
	mov	[pos.y],ebx
396
	mov	[cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx
397
	mov	[pos.x],edx
397
	mov	[cur_tab.Editor.Caret.X],edx ;! [pos.x],edx
398
	test	byte[shi+2],0x01
398
	test	byte[shi+2],0x01
399
	jnz	@f
399
	jnz	@f
400
	mov	[sel.y],ebx
400
	mov	[cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx
401
	mov	[sel.x],edx
401
	mov	[cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx
402
    @@: sub	ebx,[top_line]
402
    @@: sub	ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line]
403
	cmp	ebx,[lines.scr]
403
	cmp	ebx,[lines.scr]
404
	jl	@f
404
	jl	@f
405
	sub	ebx,[lines.scr]
405
	sub	ebx,[lines.scr]
406
	inc	ebx
406
	inc	ebx
407
	add	[top_line],ebx
407
	add	[cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx
408
    @@: mov	eax,edx
408
    @@: mov	eax,edx
409
	sub	eax,[left_col]
409
	sub	eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
410
	cmp	eax,[columns.scr]
410
	cmp	eax,[columns.scr]
411
	jl	@f
411
	jl	@f
412
	sub	eax,[columns.scr]
412
	sub	eax,[columns.scr]
413
	inc	eax
413
	inc	eax
414
	add	[left_col],eax
414
	add	[cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
415
	jmp	.exit
415
	jmp	.exit
416
    @@: cmp	edx,[left_col]
416
    @@: cmp	edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col]
417
	jge	.exit
417
	jge	.exit
418
	mov	[left_col],edx
418
	mov	[cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx
419
  .exit:
419
  .exit:
420
	call	draw_file
420
	call	draw_file
421
  .exit.2:
421
  .exit.2:
422
	ret
422
	ret
423
endf
423
endf
Line 426... Line 426...
426
func key.ctrl_x
426
func key.ctrl_x
427
	cmp	[sel.selected],0
427
	cmp	[sel.selected],0
428
	je	@f
428
	je	@f
429
	call	key.ctrl_c
429
	call	key.ctrl_c
430
	call	key.del
430
	call	key.del
431
	mov	[modified],1
431
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
432
    @@: ret
432
    @@: ret
433
endf
433
endf
Line 434... Line 434...
434
 
434
 
435
;-----------------------------------------------------------------------------
435
;-----------------------------------------------------------------------------
436
func key.ctrl_c
436
func key.ctrl_c
437
	mov	[copy_size],0
437
	mov	[copy_size],0
438
	cmp	[sel.selected],0
438
	cmp	[sel.selected],0
-
 
439
	je	.exit
-
 
440
 
-
 
441
	call	get_selection_size
-
 
442
	mov	ebx,eax
-
 
443
	mov	eax,[copy_buf]
-
 
444
	call	mem.ReAlloc
-
 
445
	mov	[copy_buf],eax
439
	je	.exit
446
 
440
	cld
447
	cld
441
	mov	eax,[sel.begin.y]
448
	mov	eax,[sel.begin.y]
442
	cmp	eax,[sel.end.y]
449
	cmp	eax,[sel.end.y]
443
	je	.single_line
450
	je	.single_line
444
	mov	ecx,[sel.begin.y]
451
	mov	ecx,[sel.begin.y]
445
	call	get_line_offset
452
	call	get_line_offset
446
	inc	ecx
453
	inc	ecx
447
	push	ecx
454
	push	ecx
448
	mov	edi,AREA_CBUF
455
	mov	edi,[copy_buf] ;! AREA_CBUF
449
	call	get_real_length
456
	call	get_real_length
450
	sub	eax,[sel.begin.x]
457
	sub	eax,[sel.begin.x]
451
	jge	@f
458
	jge	@f
452
	xor	eax,eax
459
	xor	eax,eax
Line 485... Line 492...
485
	neg	eax
492
	neg	eax
486
	mov	ecx,eax
493
	mov	ecx,eax
487
	add	[ebx],eax
494
	add	[ebx],eax
488
	mov	al,' '
495
	mov	al,' '
489
	rep	stosb
496
	rep	stosb
490
    @@: sub	edi,AREA_CBUF
497
    @@: sub	edi,[copy_buf] ;! AREA_CBUF
491
	mov	[copy_size],edi
498
	mov	[copy_size],edi
492
	mov	eax,[sel.end.y]
499
	mov	eax,[sel.end.y]
493
	sub	eax,[sel.begin.y]
500
	sub	eax,[sel.begin.y]
494
	inc	eax
501
	inc	eax
495
	mov	[copy_count],eax
502
	mov	[copy_count],eax
Line 497... Line 504...
497
	ret
504
	ret
Line 498... Line 505...
498
 
505
 
499
  .single_line:
506
  .single_line:
500
	mov	eax,[sel.end.x]
507
	mov	eax,[sel.end.x]
501
	sub	eax,[sel.begin.x]
508
	sub	eax,[sel.begin.x]
502
	mov	edi,AREA_CBUF
509
	mov	edi,[copy_buf] ;! AREA_CBUF
503
	stosd
510
	stosd
504
	mov	ecx,[sel.begin.y]
511
	mov	ecx,[sel.begin.y]
505
	call	get_line_offset
512
	call	get_line_offset
506
	mov	ebx,[sel.begin.x]
513
	mov	ebx,[sel.begin.x]
Line 528... Line 535...
528
	cmp	[copy_size],0
535
	cmp	[copy_size],0
529
	je	.exit
536
	je	.exit
Line 530... Line 537...
530
 
537
 
Line 531... Line 538...
531
	call	delete_selection
538
	call	delete_selection
532
 
539
 
533
	mov	ecx,[pos.y]
540
	mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
534
	call	get_line_offset
541
	call	get_line_offset
535
	pushd	[esi] esi
542
	pushd	[esi] esi
536
	mov	ecx,[pos.x]
543
	mov	ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
537
	call	line_add_spaces
544
	call	line_add_spaces
-
 
545
	mov	ecx,[copy_size]
538
	mov	ecx,[copy_size]
546
	sub	ecx,4
-
 
547
	mov	edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
539
	sub	ecx,4
548
	add	edi,[edi-4]
540
	mov	edi,AREA_TEMP2
549
	dec	edi
541
	mov	eax,esi
550
	mov	eax,esi
542
	mov	esi,edi
551
	mov	esi,edi
543
	sub	esi,ecx
552
	sub	esi,ecx
544
	lea	ecx,[eax+4]
553
	lea	ecx,[eax+4]
545
	add	ecx,[pos.x]
554
	add	ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
546
	neg	ecx
555
	neg	ecx
547
	lea	ecx,[esi+ecx+1]
556
	lea	ecx,[esi+ecx+1]
Line 553... Line 562...
553
	jz	.single_line
562
	jz	.single_line
Line 554... Line 563...
554
 
563
 
555
	cld
564
	cld
556
	pop	edi
565
	pop	edi
557
	add	edi,4
566
	add	edi,4
558
	mov	esi,AREA_CBUF
567
	mov	esi,[copy_buf] ;! AREA_CBUF
Line 559... Line 568...
559
	lodsd
568
	lodsd
560
 
569
 
561
	mov	ebx,[pos.x]
570
	mov	ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
562
	add	eax,ebx
571
	add	eax,ebx
563
	mov	[edi-4],ax
572
	mov	[edi-4],ax
564
	sub	eax,ebx
573
	sub	eax,ebx
Line 579... Line 588...
579
	add	[edi-4],cx
588
	add	[edi-4],cx
580
	call	.check_columns
589
	call	.check_columns
581
	mov	ecx,eax
590
	mov	ecx,eax
582
	rep	movsb
591
	rep	movsb
Line 583... Line 592...
583
 
592
 
584
	mov	[pos.x],eax
593
	mov	[cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
585
	mov	[sel.x],eax
594
	mov	[cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
586
	mov	eax,[copy_count]
595
	mov	eax,[copy_count]
587
	dec	eax
596
	dec	eax
588
	add	[pos.y],eax
597
	add	[cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
589
	add	[sel.y],eax
598
	add	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
Line 590... Line 599...
590
	add	[lines],eax
599
	add	[cur_tab.Editor.Lines],eax ;! [lines],eax
591
 
600
 
592
	call	check_inv_all
601
	call	check_inv_all
Line 593... Line 602...
593
	mov	[modified],1
602
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
594
	jmp	.exit
603
	jmp	.exit
595
 
604
 
596
  .single_line:
605
  .single_line:
597
	cld
606
	cld
598
	pop	edi
607
	pop	edi
599
	add	edi,4
608
	add	edi,4
600
	mov	esi,AREA_CBUF
609
	mov	esi,[copy_buf] ;! AREA_CBUF
601
	lodsd
610
	lodsd
602
	add	[edi-4],ax
611
	add	[edi-4],ax
603
	and	dword[edi-4],not 0x00020000
612
	and	dword[edi-4],not 0x00020000
604
	or	dword[edi-4],0x00010000
613
	or	dword[edi-4],0x00010000
605
	call	.check_columns
614
	call	.check_columns
606
	add	edi,[pos.x]
615
	add	edi,[cur_tab.Editor.Caret.X] ;! edi,[pos.x]
Line 607... Line 616...
607
	add	esp,4
616
	add	esp,4
608
	mov	ecx,eax
617
	mov	ecx,eax
Line 609... Line 618...
609
	rep	movsb
618
	rep	movsb
610
 
619
 
Line 611... Line 620...
611
	add	[pos.x],eax
620
	add	[cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
612
	add	[sel.x],eax
621
	add	[cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
Line 613... Line 622...
613
 
622
 
614
	call	check_inv_all
623
	call	check_inv_all
615
	mov	[modified],1
624
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
616
 
625
 
617
  .exit:
626
  .exit:
618
	ret
627
	ret
619
 
628
 
620
  .check_columns:
629
  .check_columns:
621
	push	eax
630
	push	eax
622
	movzx	eax,word[edi-4]
631
	movzx	eax,word[edi-4]
623
	cmp	eax,[columns]
632
	cmp	eax,[cur_tab.Editor.Columns] ;! eax,[columns]
Line 645... Line 654...
645
endf
654
endf
Line 646... Line 655...
646
 
655
 
647
;-----------------------------------------------------------------------------
656
;-----------------------------------------------------------------------------
648
func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
657
func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
649
;-----------------------------------------------------------------------------
658
;-----------------------------------------------------------------------------
650
	mov	ecx,[pos.y]
659
	mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
651
	call	get_line_offset
660
	call	get_line_offset
Line 652... Line 661...
652
	mov	ebx,esi
661
	mov	ebx,esi
653
 
662
 
654
	mov	ecx,[lines]
663
	mov	ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
655
	call	get_line_offset
664
	call	get_line_offset
656
	lea	edi,[esi+90+4]
665
	lea	edi,[esi+90+4]
657
	lea	ecx,[esi+4]
666
	lea	ecx,[esi+4]
Line 668... Line 677...
668
	mov	al,' '
677
	mov	al,' '
669
	mov	ecx,10
678
	mov	ecx,10
670
	rep	stosb
679
	rep	stosb
671
	mov	byte[ebx+4],';'
680
	mov	byte[ebx+4],';'
Line 672... Line 681...
672
 
681
 
673
	inc	[lines]
682
	inc	[cur_tab.Editor.Lines] ;! [lines]
674
	inc	[pos.y]
683
	inc	[cur_tab.Editor.Caret.Y] ;! [pos.y]
Line 675... Line 684...
675
	m2m	[sel.y],[pos.y]
684
	m2m	[cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
676
 
685
 
Line 677... Line 686...
677
	call	check_inv_all
686
	call	check_inv_all
678
	mov	[modified],1
687
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
679
 
688
 
Line 680... Line 689...
680
  .exit:
689
  .exit:
681
	ret
690
	ret
682
endf
691
endf
683
 
692
 
684
;-----------------------------------------------------------------------------
693
;-----------------------------------------------------------------------------
685
func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
694
func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
686
;-----------------------------------------------------------------------------
695
;-----------------------------------------------------------------------------
Line 687... Line 696...
687
	mov	eax,[pos.y]
696
	mov	eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
688
	inc	eax
697
	inc	eax
689
	cmp	eax,[lines]
698
	cmp	eax,[cur_tab.Editor.Lines] ;! eax,[lines]
690
	jge	.exit
699
	jge	.exit
691
 
700
 
Line 692... Line 701...
692
	mov	ecx,[pos.y]
701
	mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
693
	call	get_line_offset
702
	call	get_line_offset
694
	mov	edi,esi
703
	mov	edi,esi
695
	lodsd
704
	lodsd
696
	add	esi,eax
705
	add	esi,eax
697
 
706
 
698
	dec	[lines]
707
	dec	[cur_tab.Editor.Lines] ;! [lines]
699
	mov	ecx,AREA_TEMP2
708
	mov	ecx,[temp_buf] ;! AREA_TEMP2
Line 700... Line 709...
700
	sub	ecx,esi
709
	sub	ecx,esi
701
	shr	ecx,2		       ;// fixed (was 4)
710
	shr	ecx,2		       ;// fixed (was 4)
702
	cld
711
	cld
Line 714... Line 723...
714
	call	clear_selection
723
	call	clear_selection
Line 715... Line 724...
715
 
724
 
716
;-----------------------------------------------------------------------------
725
;-----------------------------------------------------------------------------
717
     key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
726
     key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
718
;-----------------------------------------------------------------------------
727
;-----------------------------------------------------------------------------
719
	mov	eax,[pos.y]
728
	mov	eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
720
	dec	eax
729
	dec	eax
721
	jns	@f
730
	jns	@f
722
	xor	eax,eax
731
	xor	eax,eax
723
    @@: mov	ecx,[top_line]
732
    @@: mov	ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
724
	cmp	eax,ecx
733
	cmp	eax,ecx
725
	jae	@f
734
	jae	@f
726
	dec	ecx
735
	dec	ecx
727
	jns	@f
736
	jns	@f
728
	xor	ecx,ecx
737
	xor	ecx,ecx
729
    @@: test	byte[shi+2],0x01
738
    @@: test	byte[shi+2],0x01
730
	jnz	@f
739
	jnz	@f
731
	mov	[sel.y],eax
740
	mov	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
Line 732... Line 741...
732
    @@: call	check_inv_all.skip_init
741
    @@: call	check_inv_all.skip_init
733
 
742
 
734
  .exit:
743
  .exit:
Line 742... Line 751...
742
 
751
 
743
;-----------------------------------------------------------------------------
752
;-----------------------------------------------------------------------------
744
     key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
753
     key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
Line 745... Line 754...
745
;-----------------------------------------------------------------------------
754
;-----------------------------------------------------------------------------
746
 
755
 
747
	mov	eax,[pos.y]
756
	mov	eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
748
	inc	eax
757
	inc	eax
749
	cmp	eax,[lines]
758
	cmp	eax,[cur_tab.Editor.Lines] ;! eax,[lines]
750
	jb	@f
759
	jb	@f
751
	dec	eax
760
	dec	eax
752
    @@: mov	ecx,[top_line]
761
    @@: mov	ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
753
	mov	edx,eax
762
	mov	edx,eax
754
	sub	edx,ecx
763
	sub	edx,ecx
755
	cmp	edx,[lines.scr]
764
	cmp	edx,[lines.scr]
756
	jb	@f
765
	jb	@f
757
	inc	ecx
766
	inc	ecx
758
    @@: test	byte[shi+2],0x01
767
    @@: test	byte[shi+2],0x01
759
	jnz	@f
768
	jnz	@f
Line 760... Line 769...
760
	mov	[sel.y],eax
769
	mov	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
761
    @@: call	check_inv_all.skip_init
770
    @@: call	check_inv_all.skip_init
762
 
771
 
Line 770... Line 779...
770
	call	clear_selection
779
	call	clear_selection
Line 771... Line 780...
771
 
780
 
772
;-----------------------------------------------------------------------------
781
;-----------------------------------------------------------------------------
773
     key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
782
     key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
774
;-----------------------------------------------------------------------------
783
;-----------------------------------------------------------------------------
775
	mov	eax,[pos.x]
784
	mov	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
776
	dec	eax
785
	dec	eax
777
	jns	@f
786
	jns	@f
778
	inc	eax
787
	inc	eax
779
    @@: test	byte[shi+2],0x01
788
    @@: test	byte[shi+2],0x01
780
	jnz	@f
789
	jnz	@f
781
	mov	[sel.x],eax
790
	mov	[cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
782
    @@: mov	[pos.x],eax
791
    @@: mov	[cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
Line 783... Line 792...
783
	call	 check_inv_all
792
	call	 check_inv_all
784
 
793
 
785
  .exit:
794
  .exit:
Line 792... Line 801...
792
	call	clear_selection
801
	call	clear_selection
Line 793... Line 802...
793
 
802
 
794
;-----------------------------------------------------------------------------
803
;-----------------------------------------------------------------------------
795
     key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
804
     key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
796
;-----------------------------------------------------------------------------
805
;-----------------------------------------------------------------------------
797
	mov	eax,[pos.x]
806
	mov	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
798
	inc	eax
807
	inc	eax
799
	cmp	eax,[columns]
808
	cmp	eax,[cur_tab.Editor.Columns] ;! eax,[columns]
800
	jbe	@f
809
	jbe	@f
801
	dec	eax
810
	dec	eax
802
    @@: test	byte[shi+2],0x01
811
    @@: test	byte[shi+2],0x01
803
	jnz	@f
812
	jnz	@f
804
	mov	[sel.x],eax
813
	mov	[cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
805
    @@: mov	[pos.x],eax
814
    @@: mov	[cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
Line 806... Line 815...
806
	call	check_inv_all
815
	call	check_inv_all
807
 
816
 
808
  .exit:
817
  .exit:
Line 817... Line 826...
817
;-----------------------------------------------------------------------------
826
;-----------------------------------------------------------------------------
818
     key.shift_pgup: ;///// GO TO PREVIOUS PAGE, WITH SELECTION //////////////
827
     key.shift_pgup: ;///// GO TO PREVIOUS PAGE, WITH SELECTION //////////////
819
;-----------------------------------------------------------------------------
828
;-----------------------------------------------------------------------------
820
	mov	edx,[lines.scr]
829
	mov	edx,[lines.scr]
821
	dec	edx
830
	dec	edx
822
	mov	eax,[pos.y]
831
	mov	eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
823
	mov	ecx,[top_line]
832
	mov	ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
824
	sub	eax,edx
833
	sub	eax,edx
825
	jns	@f
834
	jns	@f
826
	xor	eax,eax
835
	xor	eax,eax
827
    @@: sub	ecx,edx
836
    @@: sub	ecx,edx
828
	jns	@f
837
	jns	@f
829
	xor	ecx,ecx
838
	xor	ecx,ecx
830
    @@: test	byte[shi+2],0x01
839
    @@: test	byte[shi+2],0x01
831
	jnz	@f
840
	jnz	@f
832
	mov	[sel.y],eax
841
	mov	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
833
    @@: call	check_inv_all.skip_init
842
    @@: call	check_inv_all.skip_init
Line 834... Line 843...
834
 
843
 
835
  .exit:
844
  .exit:
836
	ret
845
	ret
Line 844... Line 853...
844
;-----------------------------------------------------------------------------
853
;-----------------------------------------------------------------------------
845
     key.shift_pgdn: ;///// GO TO NEXT PAGE, WITH SELECTION //////////////////
854
     key.shift_pgdn: ;///// GO TO NEXT PAGE, WITH SELECTION //////////////////
846
;-----------------------------------------------------------------------------
855
;-----------------------------------------------------------------------------
847
	mov	edx,[lines.scr]
856
	mov	edx,[lines.scr]
848
	dec	edx
857
	dec	edx
849
	mov	eax,[pos.y]
858
	mov	eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
850
	mov	ecx,[top_line]
859
	mov	ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
851
	add	eax,edx
860
	add	eax,edx
852
	add	ecx,edx
861
	add	ecx,edx
853
	cmp	eax,[lines]
862
	cmp	eax,[cur_tab.Editor.Lines] ;! eax,[lines]
854
	jb	@f
863
	jb	@f
855
	mov	eax,[lines]
864
	mov	eax,[cur_tab.Editor.Lines] ;! eax,[lines]
856
	dec	eax
865
	dec	eax
857
    @@: test	byte[shi+2],0x01
866
    @@: test	byte[shi+2],0x01
858
	jnz	@f
867
	jnz	@f
859
	mov	[sel.y],eax
868
	mov	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
860
    @@: call	check_inv_all.skip_init
869
    @@: call	check_inv_all.skip_init
Line 861... Line 870...
861
 
870
 
862
  .exit:
871
  .exit:
863
	ret
872
	ret
Line 869... Line 878...
869
	call	clear_selection
878
	call	clear_selection
Line 870... Line 879...
870
 
879
 
871
;-----------------------------------------------------------------------------
880
;-----------------------------------------------------------------------------
872
     key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
881
     key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
873
;-----------------------------------------------------------------------------
882
;-----------------------------------------------------------------------------
874
	mov	[pos.x],0
883
	mov	[cur_tab.Editor.Caret.X],0 ;! [pos.x],0
875
	test	byte[shi+2],0x01
884
	test	byte[shi+2],0x01
876
	jnz	@f
885
	jnz	@f
877
	mov	[sel.x],0
886
	mov	[cur_tab.Editor.SelStart.X],0 ;! [sel.x],0
Line 878... Line 887...
878
    @@: call	check_inv_all
887
    @@: call	check_inv_all
879
 
888
 
880
  .exit:
889
  .exit:
Line 887... Line 896...
887
	call	clear_selection
896
	call	clear_selection
Line 888... Line 897...
888
 
897
 
889
;-----------------------------------------------------------------------------
898
;-----------------------------------------------------------------------------
890
     key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
899
     key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
891
;-----------------------------------------------------------------------------
900
;-----------------------------------------------------------------------------
892
	mov	ecx,[pos.y]
901
	mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
893
	call	get_line_offset
902
	call	get_line_offset
894
	call	get_real_length
903
	call	get_real_length
895
	mov	[pos.x],eax
904
	mov	[cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
896
	test	byte[shi+2],0x01
905
	test	byte[shi+2],0x01
897
	jnz	@f
906
	jnz	@f
898
	mov	[sel.x],eax
907
	mov	[cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
Line 899... Line 908...
899
    @@: call	check_inv_all
908
    @@: call	check_inv_all
900
 
909
 
901
  .exit:
910
  .exit:
Line 908... Line 917...
908
	call	clear_selection
917
	call	clear_selection
Line 909... Line 918...
909
 
918
 
910
;-----------------------------------------------------------------------------
919
;-----------------------------------------------------------------------------
911
     key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
920
     key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
912
;-----------------------------------------------------------------------------
921
;-----------------------------------------------------------------------------
913
	mov	eax,[top_line]
922
	mov	eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
914
	mov	ecx,eax
923
	mov	ecx,eax
915
	test	byte[shi+2],0x01
924
	test	byte[shi+2],0x01
916
	jnz	@f
925
	jnz	@f
917
	mov	[sel.y],eax
926
	mov	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
Line 918... Line 927...
918
    @@: call	check_inv_all.skip_init
927
    @@: call	check_inv_all.skip_init
919
 
928
 
920
  .exit:
929
  .exit:
Line 927... Line 936...
927
	call	clear_selection
936
	call	clear_selection
Line 928... Line 937...
928
 
937
 
929
;-----------------------------------------------------------------------------
938
;-----------------------------------------------------------------------------
930
     key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
939
     key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
931
;-----------------------------------------------------------------------------
940
;-----------------------------------------------------------------------------
932
	mov	ecx,[top_line]
941
	mov	ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
933
	mov	eax,[lines.scr]
942
	mov	eax,[lines.scr]
934
	cmp	eax,[lines]
943
	cmp	eax,[cur_tab.Editor.Lines] ;! eax,[lines]
935
	jle	@f
944
	jle	@f
936
	mov	eax,[lines]
945
	mov	eax,[cur_tab.Editor.Lines] ;! eax,[lines]
937
    @@: add	eax,ecx
946
    @@: add	eax,ecx
938
	dec	eax
947
	dec	eax
939
	test	byte[shi+2],0x01
948
	test	byte[shi+2],0x01
940
	jnz	@f
949
	jnz	@f
941
	mov	[sel.y],eax
950
	mov	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
Line 942... Line 951...
942
    @@: call	check_inv_all.skip_init
951
    @@: call	check_inv_all.skip_init
943
 
952
 
944
  .exit:
953
  .exit:
Line 952... Line 961...
952
 
961
 
953
;-----------------------------------------------------------------------------
962
;-----------------------------------------------------------------------------
954
     key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
963
     key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
955
;-----------------------------------------------------------------------------
964
;-----------------------------------------------------------------------------
956
	xor	eax,eax
965
	xor	eax,eax
957
	mov	[top_line],eax
966
	mov	[cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
958
	mov	[pos.y],eax
967
	mov	[cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
959
	test	byte[shi+2],0x01
968
	test	byte[shi+2],0x01
960
	jnz	@f
969
	jnz	@f
961
	mov	[sel.y],eax
970
	mov	[cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
Line 962... Line 971...
962
    @@: call	check_inv_all.skip_check
971
    @@: call	check_inv_all.skip_check
963
 
972
 
964
  .exit:
973
  .exit:
Line 971... Line 980...
971
	call	clear_selection
980
	call	clear_selection
Line 972... Line 981...
972
 
981
 
973
;-----------------------------------------------------------------------------
982
;-----------------------------------------------------------------------------
974
     key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
983
     key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
975
;-----------------------------------------------------------------------------
984
;-----------------------------------------------------------------------------
976
	mov	eax,[lines]    ; eax = lines in the file
985
	mov	eax,[cur_tab.Editor.Lines] ;! eax,[lines]    ; eax = lines in the file
977
	mov	[pos.y],eax
986
	mov	[cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
978
	sub	eax,[lines.scr]   ; eax -= lines on the screen
987
	sub	eax,[lines.scr]   ; eax -= lines on the screen
979
	jns	@f
988
	jns	@f
980
	xor	eax,eax
989
	xor	eax,eax
981
    @@: mov	[top_line],eax
990
    @@: mov	[cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
982
	dec	[pos.y]
991
	dec	[cur_tab.Editor.Caret.Y] ;! [pos.y]
983
	test	byte[shi+2],0x01
992
	test	byte[shi+2],0x01
-
 
993
	jnz	@f
984
	jnz	@f
994
	m2m	[cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y]
985
	push	[pos.y]
995
;!      push    [pos.y]
986
	pop	[sel.y]
996
;!      pop     [sel.y]
Line 987... Line 997...
987
    @@: call	check_inv_all.skip_check
997
    @@: call	check_inv_all.skip_check
988
 
998
 
989
  .exit:
999
  .exit:
Line 994... Line 1004...
994
func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
1004
func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
995
;-----------------------------------------------------------------------------
1005
;-----------------------------------------------------------------------------
996
	call	delete_selection
1006
	call	delete_selection
997
	jnc	.exit.2
1007
	jnc	.exit.2
Line 998... Line 1008...
998
 
1008
 
999
	mov	ecx,[pos.y]
1009
	mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
1000
	call	get_line_offset
1010
	call	get_line_offset
1001
	and	dword[esi],not 0x00020000
1011
	and	dword[esi],not 0x00020000
1002
	or	dword[esi],0x00010000
1012
	or	dword[esi],0x00010000
1003
	lea	ebx,[esi+4]
1013
	lea	ebx,[esi+4]
Line 1004... Line 1014...
1004
	mov	ebp,esi
1014
	mov	ebp,esi
1005
 
1015
 
1006
	call	get_real_length
1016
	call	get_real_length
Line 1007... Line 1017...
1007
	or	eax,eax
1017
	or	eax,eax
1008
	je	.line_up
1018
	je	.line_up
1009
 
1019
 
1010
	mov	ecx,[pos.x]
1020
	mov	ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
1011
	cmp	ecx,eax
1021
	cmp	ecx,eax
1012
	jae	.line_up
1022
	jae	.line_up
1013
	lea	edi,[ebx+ecx]
1023
	lea	edi,[ebx+ecx]
1014
	neg	ecx
1024
	neg	ecx
1015
	movzx	eax,word[ebp]
1025
	movzx	eax,word[ebp]
Line 1016... Line 1026...
1016
	add	ecx,eax;[ebp]
1026
	add	ecx,eax;[ebp]
1017
	repe	scasb
1027
	repe	scasb
1018
	je	.line_up
1028
	je	.line_up
1019
 
1029
 
1020
	mov	edi,ebx
1030
	mov	edi,ebx
1021
	mov	ecx,[pos.x]
1031
	mov	ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
1022
	add	edi,ecx
1032
	add	edi,ecx
1023
	lea	esi,[edi+1]
1033
	lea	esi,[edi+1]
1024
	neg	ecx
1034
	neg	ecx
1025
	movzx	eax,word[ebp]
1035
	movzx	eax,word[ebp]
Line 1026... Line 1036...
1026
	add	ecx,eax;[ebp]
1036
	add	ecx,eax;[ebp]
1027
	dec	ecx
1037
	dec	ecx
1028
	rep	movsb
1038
	rep	movsb
1029
	mov	byte[edi],' '
1039
	mov	byte[edi],' '
1030
 
1040
 
Line 1031... Line 1041...
1031
	m2m	[sel.x],[pos.x]
1041
	m2m	[cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
1032
	m2m	[sel.y],[pos.y]
1042
	m2m	[cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
1033
	call	check_inv_all
1043
	call	check_inv_all
1034
	mov	[modified],1
1044
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
1035
	ret
1045
	ret
1036
 
1046
 
-
 
1047
  .line_up:
1037
  .line_up:
1048
	mov	eax,[cur_tab.Editor.Lines] ;! eax,[lines]
1038
	mov	eax,[lines]
1049
	dec	eax
1039
	dec	eax
1050
	cmp	eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
-
 
1051
	je	.exit
1040
	cmp	eax,[pos.y]
1052
	mov	edi,[temp_buf] ;! AREA_TEMP+4
1041
	je	.exit
1053
	add	edi,4
1042
	mov	edi,AREA_TEMP+4
1054
	mov	esi,ebx
1043
	mov	esi,ebx
1055
	mov	ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
1044
	mov	ecx,[pos.x]
1056
	rep	movsb
1045
	rep	movsb
1057
	mov	ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
1046
	mov	ecx,[pos.x]
1058
	mov	eax,[temp_buf]
Line 1054... Line 1066...
1054
	rep	stosb
1066
	rep	stosb
1055
    @@: lea	esi,[ebx+4]
1067
    @@: lea	esi,[ebx+4]
1056
	movzx	eax,word[ebp]
1068
	movzx	eax,word[ebp]
1057
	add	esi,eax;[ebp]
1069
	add	esi,eax;[ebp]
1058
	movzx	ecx,word[esi-4]
1070
	movzx	ecx,word[esi-4]
-
 
1071
	mov	eax,[temp_buf]
1059
	add	[AREA_TEMP],ecx
1072
	add	[eax],ecx ;! [AREA_TEMP],ecx
1060
	or	dword[AREA_TEMP],0x00010000
1073
	or	dword[eax],0x00010000 ;! dword[AREA_TEMP],0x00010000
1061
	rep	movsb
1074
	rep	movsb
Line 1062... Line 1075...
1062
 
1075
 
-
 
1076
	mov	ecx,edi ;! [edi-AREA_TEMP]
Line 1063... Line 1077...
1063
	lea	ecx,[edi-AREA_TEMP]
1077
	sub	ecx,[temp_buf]
1064
 
1078
 
1065
	mov	esi,AREA_TEMP
1079
	mov	esi,[temp_buf] ;! AREA_TEMP
1066
	call	get_real_length
1080
	call	get_real_length
1067
	cmp	eax,[columns]
1081
	cmp	eax,[cur_tab.Editor.Columns] ;! eax,[columns]
1068
	jbe	@f
1082
	jbe	@f
1069
	mov	[columns],eax
1083
	mov	[cur_tab.Editor.Columns],eax ;! [columns],eax
-
 
1084
    @@:
1070
    @@:
1085
	push	ecx
-
 
1086
	mov	edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
1071
	push	ecx
1087
	add	edi,[edi-4]
1072
	mov	edi,AREA_TEMP2
1088
	dec	edi
1073
	lea	esi,[edi+8]
1089
	lea	esi,[edi+8]
1074
	sub	esi,ecx
1090
	sub	esi,ecx
1075
	movzx	eax,word[ebp]
1091
	movzx	eax,word[ebp]
Line 1090... Line 1106...
1090
	lea	esi,[ebp+8]
1106
	lea	esi,[ebp+8]
1091
	movzx	eax,word[esi-8]
1107
	movzx	eax,word[esi-8]
1092
	add	esi,eax;[esi-8]
1108
	add	esi,eax;[esi-8]
1093
	movzx	eax,word[esi-4]
1109
	movzx	eax,word[esi-4]
1094
	add	esi,eax;[esi-4]
1110
	add	esi,eax;[esi-4]
-
 
1111
	mov	ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
1095
	mov	ecx,AREA_TEMP2
1112
	add	ecx,[ecx-4]
1096
	sub	ecx,esi
1113
	sub	ecx,esi
1097
	cld
1114
	cld
1098
    @@: rep	movsb
1115
    @@: rep	movsb
1099
  .lp1: pop	ecx
1116
  .lp1: pop	ecx
1100
	mov	esi,AREA_TEMP
1117
	mov	esi,[temp_buf] ;! AREA_TEMP
1101
	mov	edi,ebp
1118
	mov	edi,ebp
1102
	cld
1119
	cld
1103
	rep	movsb
1120
	rep	movsb
Line 1104... Line 1121...
1104
 
1121
 
1105
  .ok.dec.lines:
1122
  .ok.dec.lines:
1106
	dec	[lines]
1123
	dec	[cur_tab.Editor.Lines] ;! [lines]
1107
	mov	eax,[lines]
1124
	mov	eax,[cur_tab.Editor.Lines] ;! eax,[lines]
1108
	cmp	[pos.y],eax
1125
	cmp	[cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
1109
	jb	@f
1126
	jb	@f
1110
	dec	eax
1127
	dec	eax
1111
	mov	[pos.y],eax
1128
	mov	[cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
1112
    @@: m2m	[sel.x],[pos.x]
1129
    @@: m2m	[cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
Line 1113... Line 1130...
1113
	m2m	[sel.y],[pos.y]
1130
	m2m	[cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
1114
 
1131
 
1115
	mov	[modified],1
1132
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
Line 1116... Line 1133...
1116
  .exit.2:
1133
  .exit.2:
1117
	call	check_inv_all
1134
	call	check_inv_all
Line 1133... Line 1150...
1133
func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
1150
func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
1134
;-----------------------------------------------------------------------------
1151
;-----------------------------------------------------------------------------
1135
	call	delete_selection
1152
	call	delete_selection
1136
	jnc	key.del.exit.2
1153
	jnc	key.del.exit.2
Line 1137... Line 1154...
1137
 
1154
 
1138
	mov	eax,[pos.x]
1155
	mov	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
1139
	dec	eax
1156
	dec	eax
Line 1140... Line 1157...
1140
	js	.line_up
1157
	js	.line_up
1141
 
1158
 
1142
	dec	[pos.x]
1159
	dec	[cur_tab.Editor.Caret.X] ;! [pos.x]
1143
	mov	ecx,[pos.y]
1160
	mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
1144
	call	get_line_offset
1161
	call	get_line_offset
Line 1145... Line 1162...
1145
	and	dword[esi],not 0x00020000
1162
	and	dword[esi],not 0x00020000
1146
	or	dword[esi],0x00010000
1163
	or	dword[esi],0x00010000
1147
 
1164
 
1148
	mov	ebx,eax
1165
	mov	ebx,eax
1149
	call	get_real_length
1166
	call	get_real_length
1150
	cmp	eax,[pos.x]
1167
	cmp	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
1151
	jae	@f
1168
	jae	@f
1152
	m2m	[sel.x],[pos.x]
1169
	m2m	[cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
Line 1153... Line 1170...
1153
	call	check_inv_all
1170
	call	check_inv_all
1154
	mov	[modified],1
1171
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
1155
	ret
1172
	ret
Line 1163... Line 1180...
1163
	lea	esi,[edi+1]
1180
	lea	esi,[edi+1]
1164
	cld
1181
	cld
1165
	rep	movsb
1182
	rep	movsb
1166
	mov	byte[edi],' '
1183
	mov	byte[edi],' '
Line 1167... Line 1184...
1167
 
1184
 
1168
	m2m	[sel.x],[pos.x]
1185
	m2m	[cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
1169
	m2m	[sel.y],[pos.y]
1186
	m2m	[cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
1170
	call	check_inv_str
1187
	call	check_inv_str
1171
	mov	[modified],1
1188
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
Line 1172... Line 1189...
1172
	ret
1189
	ret
1173
 
1190
 
1174
  .line_up:
1191
  .line_up:
1175
	cmp	[pos.y],0
1192
	cmp	[cur_tab.Editor.Caret.Y],0 ;! [pos.y],0
1176
	jne	@f
1193
	jne	@f
1177
	ret
1194
	ret
1178
    @@: mov	ecx,[pos.y]
1195
    @@: mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
1179
	dec	ecx
1196
	dec	ecx
1180
	call	get_line_offset
1197
	call	get_line_offset
Line 1186... Line 1203...
1186
	movzx	ecx,word[ebp]
1203
	movzx	ecx,word[ebp]
1187
    @@: cmp	byte[ebx+ecx-1],' '
1204
    @@: cmp	byte[ebx+ecx-1],' '
1188
	jne	@f
1205
	jne	@f
1189
	dec	ecx
1206
	dec	ecx
1190
	jg	@b
1207
	jg	@b
1191
    @@: mov	[pos.x],ecx
1208
    @@: mov	[cur_tab.Editor.Caret.X],ecx ;! [pos.x],ecx
1192
	dec	[pos.y]
1209
	dec	[cur_tab.Editor.Caret.Y] ;! [pos.y]
1193
	cld
1210
	cld
1194
	jmp	key.del.line_up
1211
	jmp	key.del.line_up
1195
endf
1212
endf
Line 1196... Line 1213...
1196
 
1213
 
1197
;-----------------------------------------------------------------------------
1214
;-----------------------------------------------------------------------------
1198
func key.tab ;///// TABULATE /////////////////////////////////////////////////
1215
func key.tab ;///// TABULATE /////////////////////////////////////////////////
1199
;-----------------------------------------------------------------------------
1216
;-----------------------------------------------------------------------------
1200
	call	delete_selection
1217
	call	delete_selection
Line 1201... Line 1218...
1201
	mov	eax,[pos.x]
1218
	mov	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
1202
 
1219
 
1203
	mov	ecx,eax
1220
	mov	ecx,eax
1204
	add	eax,ATABW
1221
	add	eax,ATABW
1205
	and	eax,not(ATABW-1)
1222
	and	eax,not(ATABW-1)
1206
	push	eax ' '
1223
	push	eax ' '
1207
	sub	eax,ecx
1224
	sub	eax,ecx
1208
  .direct:
1225
  .direct:
1209
	mov	ecx,[pos.y]
1226
	mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
1210
	call	get_line_offset
1227
	call	get_line_offset
Line 1211... Line 1228...
1211
	and	dword[esi],not 0x00020000
1228
	and	dword[esi],not 0x00020000
Line 1212... Line 1229...
1212
	or	dword[esi],0x00010000
1229
	or	dword[esi],0x00010000
1213
 
1230
 
1214
	xchg	eax,ecx
1231
	xchg	eax,ecx
1215
 
1232
 
1216
	call	get_real_length
1233
	call	get_real_length
1217
	cmp	eax,[pos.x]
1234
	cmp	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
1218
	jae	@f
1235
	jae	@f
1219
	mov	eax,[pos.x]
1236
	mov	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
1220
    @@: movzx	edx,word[esi]
1237
    @@: movzx	edx,word[esi]
-
 
1238
	sub	edx,eax
-
 
1239
	cmp	ecx,edx
-
 
1240
	jl	@f
1221
	sub	edx,eax
1241
	pushad; esi ecx eax
-
 
1242
	mov	ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2-10+1
1222
	cmp	ecx,edx
1243
	add	ecx,[ecx-4]
1223
	jl	@f
1244
	dec	ecx
1224
	pushad; esi ecx eax
1245
	mov	edi,ecx ;! AREA_TEMP2
1225
	mov	ecx,AREA_TEMP2-10+1
1246
	add	ecx,-10+1
1226
;       lea     eax,[esi+4]
1247
;       lea     eax,[esi+4]
1227
;       add     eax,[esi]
-
 
1228
	movzx	eax,word[esi]
1248
;       add     eax,[esi]
1229
	lea	eax,word[esi+eax+4]
1249
	movzx	eax,word[esi]
1230
	sub	ecx,eax
1250
	lea	eax,word[esi+eax+4]
1231
	mov	edi,AREA_TEMP2
1251
	sub	ecx,eax
1232
	mov	esi,AREA_TEMP2-10
1252
	lea	esi,[edi-10] ;! AREA_TEMP2-10
1233
	std
1253
	std
Line 1246... Line 1266...
1246
	lea	edi,[ebx+edi-1]
1266
	lea	edi,[ebx+edi-1]
1247
	mov	esi,edi
1267
	mov	esi,edi
1248
	sub	esi,ecx
1268
	sub	esi,ecx
1249
	lea	ecx,[esi+1]
1269
	lea	ecx,[esi+1]
1250
	sub	ecx,ebx
1270
	sub	ecx,ebx
1251
	sub	ecx,[pos.x]
1271
	sub	ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
1252
	std
1272
	std
1253
	rep	movsb
1273
	rep	movsb
1254
  .ok:	pop	ecx		;*******
1274
  .ok:	pop	ecx		;*******
1255
	pop	eax
1275
	pop	eax
1256
	rep	stosb
1276
	rep	stosb
1257
	cld
1277
	cld
1258
	pop	[pos.x]
1278
	pop	[cur_tab.Editor.Caret.X] ;! [pos.x]
1259
	lea	esi,[ebx-4]
1279
	lea	esi,[ebx-4]
1260
	call	get_real_length
1280
	call	get_real_length
1261
	cmp	eax,[pos.x]
1281
	cmp	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
1262
	jae	@f
1282
	jae	@f
1263
	mov	eax,[pos.x]
1283
	mov	eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
1264
    @@: cmp	eax,[columns]
1284
    @@: cmp	eax,[cur_tab.Editor.Columns] ;! eax,[columns]
1265
	jbe	@f
1285
	jbe	@f
1266
	mov	[columns],eax
1286
	mov	[cur_tab.Editor.Columns],eax ;! [columns],eax
1267
    @@: m2m	[sel.x],[pos.x]
1287
    @@: m2m	[cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
1268
	m2m	[sel.y],[pos.y]
1288
	m2m	[cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
1269
	call	check_inv_all
1289
	call	check_inv_all
1270
	mov	[modified],1
1290
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
Line 1271... Line 1291...
1271
 
1291
 
1272
  .exit:
1292
  .exit:
1273
	ret
1293
	ret
Line 1274... Line 1294...
1274
endf
1294
endf
1275
 
1295
 
1276
;-----------------------------------------------------------------------------
1296
;-----------------------------------------------------------------------------
1277
func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
1297
func key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
Line 1278... Line 1298...
1278
;-----------------------------------------------------------------------------
1298
;-----------------------------------------------------------------------------
1279
	call	delete_selection
1299
	call	delete_selection
Line 1280... Line 1300...
1280
 
1300
 
1281
	mov	ecx,[pos.y]
1301
	mov	ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
1282
	call	get_line_offset
1302
	call	get_line_offset
1283
 
1303
 
1284
	mov	ebx,[pos.x]
1304
	mov	ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
1285
	cmp	bx,[esi]
1305
	cmp	bx,[esi]
1286
	jb	@f
1306
	jb	@f
1287
	movzx	ebx,word[esi]
1307
	movzx	ebx,word[esi]
1288
	dec	ebx
1308
	dec	ebx
Line 1289... Line 1309...
1289
	jns	@f
1309
	jns	@f
1290
	xor	ebx,ebx
1310
	xor	ebx,ebx
1291
    @@:
1311
    @@:
1292
	cld
-
 
1293
 
1312
	cld
1294
	mov	edi,AREA_TEMP
1313
 
1295
	mov	ebp,esi
1314
	mov	edi,[temp_buf] ;! AREA_TEMP
1296
	mov	ecx,ebx
1315
	mov	ebp,esi
1297
	inc	ecx
1316
	lea	ecx,[ebx+1]
Line 1341... Line 1360...
1341
	dec	eax
1360
	dec	eax
1342
	jmp	@f
1361
	jmp	@f
1343
  .lp2: xor	eax,eax
1362
  .lp2: xor	eax,eax
1344
    @@: mov	edx,edi
1363
    @@: mov	edx,edi
1345
	add	edi,4
1364
	add	edi,4
1346
	mov	[pos.x],eax
1365
	mov	[cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
1347
	jecxz	@f
1366
	jecxz	@f
1348
	push	ecx
1367
	push	ecx
1349
	mov	ecx,eax
1368
	mov	ecx,eax
1350
	mov	al,' '
1369
	mov	al,' '
1351
	rep	stosb
1370
	rep	stosb
Line 1359... Line 1378...
1359
	lea	eax,[edi-4]
1378
	lea	eax,[edi-4]
1360
	sub	eax,edx
1379
	sub	eax,edx
1361
	or	eax,0x00010000
1380
	or	eax,0x00010000
1362
	mov	[edx],eax
1381
	mov	[edx],eax
Line 1363... Line 1382...
1363
 
1382
 
-
 
1383
	mov	ecx,edi ;! [edi-AREA_TEMP]
Line 1364... Line 1384...
1364
	lea	ecx,[edi-AREA_TEMP]
1384
	sub	ecx,[temp_buf]
-
 
1385
 
1365
 
1386
	push	ecx
-
 
1387
	mov	edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
1366
	push	ecx
1388
	add	edi,[edi-4]
1367
	mov	edi,AREA_TEMP2
1389
	dec	edi
1368
	lea	esi,[edi+4]
1390
	lea	esi,[edi+4]
1369
	sub	esi,ecx
1391
	sub	esi,ecx
1370
	movzx	ecx,word[ebp]
1392
	movzx	ecx,word[ebp]
Line 1378... Line 1400...
1378
	lea	esi,[ebp+4]
1400
	lea	esi,[ebp+4]
1379
	mov	eax,[esp]
1401
	mov	eax,[esp]
1380
	lea	edi,[esi+eax-4]
1402
	lea	edi,[esi+eax-4]
1381
	movzx	ecx,word[ebp]
1403
	movzx	ecx,word[ebp]
1382
	add	esi,ecx;[ebp]
1404
	add	esi,ecx;[ebp]
-
 
1405
	mov	ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
1383
	mov	ecx,AREA_TEMP2
1406
	add	ecx,[ecx-4]
1384
	sub	ecx,esi
1407
	sub	ecx,esi
1385
	cld
1408
	cld
1386
    @@: rep	movsb
1409
    @@: rep	movsb
1387
  .lp3: pop	ecx
1410
  .lp3: pop	ecx
1388
	mov	esi,AREA_TEMP
1411
	mov	esi,[temp_buf] ;! AREA_TEMP
1389
	mov	edi,ebp
1412
	mov	edi,ebp
1390
	cld
1413
	cld
1391
	rep	movsb
1414
	rep	movsb
Line 1392... Line 1415...
1392
 
1415
 
1393
	inc	[pos.y]
1416
	inc	[cur_tab.Editor.Caret.Y] ;! [pos.y]
1394
	inc	[sel.y]
1417
	inc	[cur_tab.Editor.SelStart.Y] ;! [sel.y]
Line 1395... Line 1418...
1395
	inc	[lines]
1418
	inc	[cur_tab.Editor.Lines] ;! [lines]
Line 1396... Line 1419...
1396
 
1419
 
1397
	m2m	[sel.x],[pos.x]
1420
	m2m	[cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
Line 1398... Line 1421...
1398
 
1421
 
1399
	call	check_inv_all
1422
	call	check_inv_all
1400
	mov	[modified],1
1423
	mov	[cur_tab.Editor.Modified],1 ;! [modified],1
1401
 
1424
 
-
 
1425
  .exit:
-
 
1426
	ret
-
 
1427
endf
-
 
1428
 
-
 
1429
;-----------------------------------------------------------------------------
-
 
1430
func key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
-
 
1431
;-----------------------------------------------------------------------------
-
 
1432
	cmp	[tab_bar.Items.Count],1
-
 
1433
	je	.exit
-
 
1434
	xor	eax,eax
-
 
1435
	mov	ebp,[tab_bar.Items]
-
 
1436
    @@: cmp	ebp,[tab_bar.Current.Ptr]
-
 
1437
	je	@f
-
 
1438
	inc	eax
-
 
1439
	add	ebp,sizeof.TABITEM
-
 
1440
	jmp	@b
-
 
1441
    @@: add	ebp,sizeof.TABITEM
-
 
1442
	inc	eax
-
 
1443
	cmp	eax,[tab_bar.Items.Count]
-
 
1444
	jb	@f
-
 
1445
	mov	ebp,[tab_bar.Items]
-
 
1446
    @@: call	set_cur_tab
-
 
1447
	call	align_editor_in_tab
-
 
1448
	call	draw_editor
-
 
1449
	call	draw_tabctl
-
 
1450
  .exit:
-
 
1451
	ret
-
 
1452
endf
-
 
1453
 
-
 
1454
;-----------------------------------------------------------------------------
-
 
1455
func key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
-
 
1456
;-----------------------------------------------------------------------------
-
 
1457
	cmp	[tab_bar.Items.Count],1
-
 
1458
	je	.exit
-
 
1459
	xor	eax,eax
-
 
1460
	mov	ebp,[tab_bar.Items]
-
 
1461
    @@: cmp	ebp,[tab_bar.Current.Ptr]
-
 
1462
	je	@f
-
 
1463
	inc	eax
-
 
1464
	add	ebp,sizeof.TABITEM
-
 
1465
	jmp	@b
-
 
1466
    @@: add	ebp,-sizeof.TABITEM
-
 
1467
	dec	eax
-
 
1468
	jge	@f
-
 
1469
	imul	eax,[tab_bar.Items.Count],sizeof.TABITEM
-
 
1470
	add	eax,[tab_bar.Items]
-
 
1471
	lea	ebp,[eax-sizeof.TABITEM]
-
 
1472
    @@: call	set_cur_tab
-
 
1473
	call	align_editor_in_tab
-
 
1474
	call	draw_editor
-
 
1475
	call	draw_tabctl