Subversion Repositories Kolibri OS

Rev

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

Rev 280 Rev 297
Line 49... Line 49...
49
	mov	esi,accel_table_main
49
	mov	esi,accel_table_main
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	[cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
54
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
55
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
55
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
56
  .lp1: mov	[s_status],0
56
  .lp1: mov	[s_status],0
57
	call	dword[esi+4]
57
	call	dword[esi+4]
-
 
58
	call	editor_check_for_changes
58
	jmp	still
59
	jmp	still
59
    @@: add	esi,8
60
    @@: add	esi,8
60
	cmp	byte[esi],0
61
	cmp	byte[esi],0
61
	jne	.acc
62
	jne	.acc
Line 72... Line 73...
72
	movzx	eax,[eax+key1]
73
	movzx	eax,[eax+key1]
73
	push	eax
74
	push	eax
Line 74... Line 75...
74
 
75
 
75
	test	[options],OPTS_SECURESEL
76
	test	[options],OPTS_SECURESEL
76
	jz	.lp2
77
	jz	.lp2
77
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
78
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
78
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
79
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
79
	jmp	.put
80
	jmp	.put
Line 80... Line 81...
80
  .lp2: call	delete_selection
81
  .lp2: call	delete_selection
81
 
82
 
82
	test	[options],OPTS_AUTOBRACES
83
	test	[options],OPTS_AUTOBRACES
83
	jz	.put
84
	jz	.put
84
	cmp	al,'['
85
	cmp	al,'['
85
	jne	@f
86
	jne	@f
86
	mov	al,']'
87
	mov	al,']'
87
	call	.lp3
88
	call	.lp3
88
	dec	[cur_editor.Caret.X] ;! [pos.x]
89
	dec	[cur_editor.Caret.X]
89
	jmp	.put
90
	jmp	.put
90
    @@: cmp	al,'('
91
    @@: cmp	al,'('
91
	jne	@f
92
	jne	@f
92
	mov	al,')'
93
	mov	al,')'
93
	call	.lp3
94
	call	.lp3
94
	dec	[cur_editor.Caret.X] ;! [pos.x]
95
	dec	[cur_editor.Caret.X]
95
	jmp	.put
96
	jmp	.put
96
    @@: cmp	al,'{'
97
    @@: cmp	al,'{'
97
	jne	.put
98
	jne	.put
98
	mov	al,'}'
99
	mov	al,'}'
Line 99... Line 100...
99
	call	.lp3
100
	call	.lp3
100
	dec	[cur_editor.Caret.X] ;! [pos.x]
101
	dec	[cur_editor.Caret.X]
101
 
102
 
102
  .put: pop	eax
103
  .put: pop	eax
103
	push	still
104
	push	still editor_check_for_changes
104
	inc	[cur_editor.SelStart.X] ;! [sel.x]
105
	inc	[cur_editor.SelStart.X]
105
  .lp3: push	[cur_editor.Caret.X] eax ;! [pos.x] eax
106
  .lp3: push	[cur_editor.Caret.X] eax
Line 106... Line 107...
106
	inc	dword[esp+4]
107
	inc	dword[esp+4]
107
	mov	eax,1
108
	mov	eax,1
108
	jmp	key.tab.direct
109
	jmp	key.tab.direct
109
 
110
 
110
;-----------------------------------------------------------------------------
111
;-----------------------------------------------------------------------------
111
func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
112
func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
112
;-----------------------------------------------------------------------------
113
;-----------------------------------------------------------------------------
113
	xor	eax,eax
114
	xor	eax,eax
114
	mov	[cur_editor.SelStart.X],eax ;! [sel.x],eax
115
	mov	[cur_editor.SelStart.X],eax
115
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
116
	mov	[cur_editor.SelStart.Y],eax
116
	mov	ecx,[cur_editor.Lines.Count] ;! ecx,[lines]
117
	mov	ecx,[cur_editor.Lines.Count]
117
	dec	ecx
118
	dec	ecx
118
	mov	[cur_editor.Caret.Y],ecx ;! [pos.y],ecx
119
	mov	[cur_editor.Caret.Y],ecx
119
	call	get_line_offset
120
	call	get_line_offset
120
	call	get_real_length
121
	call	get_real_length
Line 121... Line 122...
121
	mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
122
	mov	[cur_editor.Caret.X],eax
122
	call	draw_file
123
	call	draw_editor
Line 155... Line 156...
155
;-----------------------------------------------------------------------------
156
;-----------------------------------------------------------------------------
156
func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
157
func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
157
;-----------------------------------------------------------------------------
158
;-----------------------------------------------------------------------------
158
	cmp	[cur_editor.FilePath],'/'
159
	cmp	[cur_editor.FilePath],'/'
159
	jne	key.shift_ctrl_s
160
	jne	key.shift_ctrl_s
160
	cmp	[cur_editor.Modified],0 ;! [modified],0
161
	cmp	[cur_editor.Modified],0
161
	je	.exit
162
	je	.exit
162
	;cmp     [f_info.length],0
-
 
163
	;je      key.shift_ctrl_s
-
 
164
	call	save_file
163
	call	save_file
165
	call	drawwindow
164
	call	drawwindow
166
  .exit:
165
  .exit:
167
	ret
166
	ret
Line 216... Line 215...
216
	jmp	key.ctrl_f.direct
215
	jmp	key.ctrl_f.direct
217
endf
216
endf
Line 218... Line 217...
218
 
217
 
219
func key.ctrl_g
218
func key.ctrl_g
220
	ret
219
	ret
221
macro comment {
220
@^
222
	mov	[bot_dlg_mode2],0
221
	mov	[bot_dlg_mode2],0
Line 223... Line 222...
223
	mov	[bot_dlg_height],16*2+4*2-1
222
	mov	[bot_dlg_height],16*2+4*2-1
224
 
223
 
Line 230... Line 229...
230
	mov	[tb_gotorow.pos.x],al
229
	mov	[tb_gotorow.pos.x],al
231
	mov	[tb_gotorow.sel.x],0
230
	mov	[tb_gotorow.sel.x],0
232
	mov	[tb_casesen],0
231
	mov	[tb_casesen],0
233
	call	drawwindow
232
	call	drawwindow
234
	ret
233
	ret
235
}
234
^@
236
endf
235
endf
Line 237... Line -...
237
 
-
 
238
; CHANGE_LANG_LAYOUT { ; Ctrl + F8
-
 
239
; 3 times english -> russian
-
 
240
; 2 times russian -> english
-
 
241
;        call    layout
-
 
242
;        jmp     still
-
 
243
; CHANGE_LANG_LAYOUT }
-
 
244
 
236
 
245
;-----------------------------------------------------------------------------
237
;-----------------------------------------------------------------------------
246
func key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
238
func key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
247
;-----------------------------------------------------------------------------
239
;-----------------------------------------------------------------------------
Line 248... Line 240...
248
	call	clear_selection
240
	call	clear_selection
249
 
241
 
250
;-----------------------------------------------------------------------------
242
;-----------------------------------------------------------------------------
251
     key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
243
     key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
252
;-----------------------------------------------------------------------------
244
;-----------------------------------------------------------------------------
253
	mov	ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y]
245
	mov	ebx,[cur_editor.Caret.Y]
254
	mov	edx,[cur_editor.Caret.X] ;! edx,[pos.x]
246
	mov	edx,[cur_editor.Caret.X]
255
	cld
247
	cld
256
	mov	ecx,ebx
248
	mov	ecx,ebx
257
	call	get_line_offset
249
	call	get_line_offset
Line 307... Line 299...
307
	movzx	edx,word[esi]
299
	movzx	edx,word[esi]
308
	dec	edx
300
	dec	edx
309
	jmp	.lp2
301
	jmp	.lp2
310
    @@:
302
    @@:
311
	inc	edx
303
	inc	edx
312
	mov	[cur_editor.Caret.Y],ebx ;! [pos.y],ebx
304
	mov	[cur_editor.Caret.Y],ebx
313
	mov	[cur_editor.Caret.X],edx ;! [pos.x],edx
305
	mov	[cur_editor.Caret.X],edx
314
	test	byte[shi+2],0x01
306
	test	byte[shi+2],0x01
315
	jnz	@f
307
	jnz	@f
316
	mov	[cur_editor.SelStart.Y],ebx ;! [sel.y],ebx
308
	mov	[cur_editor.SelStart.Y],ebx
317
	mov	[cur_editor.SelStart.X],edx ;! [sel.x],edx
309
	mov	[cur_editor.SelStart.X],edx
318
    @@: sub	ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line]
310
    @@: sub	ebx,[cur_editor.TopLeft.Y]
319
	jge	@f
311
	jge	@f
320
	add	[cur_editor.TopLeft.Y],ebx ;! [top_line],ebx
312
	add	[cur_editor.TopLeft.Y],ebx
321
    @@: mov	eax,edx
313
    @@: mov	eax,edx
322
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
314
	sub	eax,[cur_editor.TopLeft.X]
323
	cmp	eax,[columns.scr]
315
	cmp	eax,[columns.scr]
324
	jl	@f
316
	jl	@f
325
	sub	eax,[columns.scr]
317
	sub	eax,[columns.scr]
326
	inc	eax
318
	inc	eax
327
	add	[cur_editor.TopLeft.X],eax ;! [left_col],eax
319
	add	[cur_editor.TopLeft.X],eax
328
	jmp	.exit
320
	jmp	.exit
329
    @@: cmp	edx,[cur_editor.TopLeft.X] ;! edx,[left_col]
321
    @@: cmp	edx,[cur_editor.TopLeft.X]
330
	jge	.exit
322
	jge	.exit
331
	mov	[cur_editor.TopLeft.X],edx ;! [left_col],edx
323
	mov	[cur_editor.TopLeft.X],edx
332
  .exit:
324
  .exit:
333
	call	draw_file
325
	call	editor_check_for_changes
334
  .exit.2:
326
  .exit.2:
335
	ret
327
	ret
336
endf
328
endf
Line 337... Line 329...
337
 
329
 
Line 341... Line 333...
341
	call	clear_selection
333
	call	clear_selection
Line 342... Line 334...
342
 
334
 
343
;-----------------------------------------------------------------------------
335
;-----------------------------------------------------------------------------
344
     key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
336
     key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
345
;-----------------------------------------------------------------------------
337
;-----------------------------------------------------------------------------
346
	mov	ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y]
338
	mov	ebx,[cur_editor.Caret.Y]
347
	mov	edx,[cur_editor.Caret.X] ;! edx,[pos.x]
339
	mov	edx,[cur_editor.Caret.X]
348
	cld
340
	cld
349
  .lp1: mov	ecx,ebx
341
  .lp1: mov	ecx,ebx
350
	call	get_line_offset
342
	call	get_line_offset
351
	movzx	ecx,word[esi]
343
	movzx	ecx,word[esi]
Line 363... Line 355...
363
	je	@f
355
	je	@f
364
	inc	edx
356
	inc	edx
365
	dec	ecx
357
	dec	ecx
366
	jnz	@b
358
	jnz	@b
367
  .nx1: inc	ebx
359
  .nx1: inc	ebx
368
	cmp	ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
360
	cmp	ebx,[cur_editor.Lines.Count]
369
	jge	.exit.2
361
	jge	.exit.2
370
	xor	edx,edx
362
	xor	edx,edx
371
	jmp	.lp1
363
	jmp	.lp1
372
    @@:
364
    @@:
Line 388... Line 380...
388
	jne	@f
380
	jne	@f
389
	inc	edx
381
	inc	edx
390
	dec	ecx
382
	dec	ecx
391
	jnz	@b
383
	jnz	@b
392
  .nx2: inc	ebx
384
  .nx2: inc	ebx
393
	cmp	ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
385
	cmp	ebx,[cur_editor.Lines.Count]
394
	jge	.exit.2
386
	jge	.exit.2
395
	xor	edx,edx
387
	xor	edx,edx
396
	jmp	.lp2
388
	jmp	.lp2
397
    @@:
389
    @@:
398
	mov	[cur_editor.Caret.Y],ebx ;! [pos.y],ebx
390
	mov	[cur_editor.Caret.Y],ebx
399
	mov	[cur_editor.Caret.X],edx ;! [pos.x],edx
391
	mov	[cur_editor.Caret.X],edx
400
	test	byte[shi+2],0x01
392
	test	byte[shi+2],0x01
401
	jnz	@f
393
	jnz	@f
402
	mov	[cur_editor.SelStart.Y],ebx ;! [sel.y],ebx
394
	mov	[cur_editor.SelStart.Y],ebx
403
	mov	[cur_editor.SelStart.X],edx ;! [sel.x],edx
395
	mov	[cur_editor.SelStart.X],edx
404
    @@: sub	ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line]
396
    @@: sub	ebx,[cur_editor.TopLeft.Y]
405
	cmp	ebx,[lines.scr]
397
	cmp	ebx,[lines.scr]
406
	jl	@f
398
	jl	@f
407
	sub	ebx,[lines.scr]
399
	sub	ebx,[lines.scr]
408
	inc	ebx
400
	inc	ebx
409
	add	[cur_editor.TopLeft.Y],ebx ;! [top_line],ebx
401
	add	[cur_editor.TopLeft.Y],ebx
410
    @@: mov	eax,edx
402
    @@: mov	eax,edx
411
	sub	eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
403
	sub	eax,[cur_editor.TopLeft.X]
412
	cmp	eax,[columns.scr]
404
	cmp	eax,[columns.scr]
413
	jl	@f
405
	jl	@f
414
	sub	eax,[columns.scr]
406
	sub	eax,[columns.scr]
415
	inc	eax
407
	inc	eax
416
	add	[cur_editor.TopLeft.X],eax ;! [left_col],eax
408
	add	[cur_editor.TopLeft.X],eax
417
	jmp	.exit
409
	jmp	.exit
418
    @@: cmp	edx,[cur_editor.TopLeft.X] ;! edx,[left_col]
410
    @@: cmp	edx,[cur_editor.TopLeft.X]
419
	jge	.exit
411
	jge	.exit
420
	mov	[cur_editor.TopLeft.X],edx ;! [left_col],edx
412
	mov	[cur_editor.TopLeft.X],edx
421
  .exit:
413
  .exit:
422
	call	draw_file
414
	call	editor_check_for_changes
423
  .exit.2:
415
  .exit.2:
424
	ret
416
	ret
425
endf
417
endf
Line 426... Line 418...
426
 
418
 
427
;-----------------------------------------------------------------------------
419
;-----------------------------------------------------------------------------
428
func key.ctrl_x
420
func key.ctrl_x
429
	cmp	[sel.selected],0
421
	cmp	[sel.selected],0
430
	je	@f
422
	je	@f
431
	call	key.ctrl_c
423
	call	key.ctrl_c
432
	call	key.del
424
	call	key.del
433
	mov	[cur_editor.Modified],1 ;! [modified],1
425
	mov	[cur_editor.Modified],1
434
    @@: ret
426
    @@: ret
Line 435... Line 427...
435
endf
427
endf
436
 
428
 
Line 452... Line 444...
452
	je	.single_line
444
	je	.single_line
453
	mov	ecx,[sel.begin.y]
445
	mov	ecx,[sel.begin.y]
454
	call	get_line_offset
446
	call	get_line_offset
455
	inc	ecx
447
	inc	ecx
456
	push	ecx
448
	push	ecx
457
	mov	edi,[copy_buf] ;! AREA_CBUF
449
	mov	edi,[copy_buf]
458
	call	get_real_length
450
	call	get_real_length
459
	sub	eax,[sel.begin.x]
451
	sub	eax,[sel.begin.x]
460
	jge	@f
452
	jge	@f
461
	xor	eax,eax
453
	xor	eax,eax
462
    @@: add	esi,[sel.begin.x]
454
    @@: add	esi,[sel.begin.x]
Line 477... Line 469...
477
	rep	movsb
469
	rep	movsb
478
	mov	ecx,[sel.end.y]
470
	mov	ecx,[sel.end.y]
479
    @@: call	get_line_offset
471
    @@: call	get_line_offset
480
	movzx	eax,word[esi]
472
	movzx	eax,word[esi]
481
	add	esi,4
473
	add	esi,4
482
;       lodsd
-
 
483
	cmp	eax,[sel.end.x]
474
	cmp	eax,[sel.end.x]
484
	jle	@f
475
	jle	@f
485
	mov	eax,[sel.end.x]
476
	mov	eax,[sel.end.x]
486
    @@: mov	ebx,edi
477
    @@: mov	ebx,edi
487
	stosd
478
	stosd
488
;       add     esi,eax
-
 
489
	mov	ecx,eax
479
	mov	ecx,eax
490
	jecxz	@f
480
	jecxz	@f
491
	rep	movsb
481
	rep	movsb
492
	sub	eax,[sel.end.x]
482
	sub	eax,[sel.end.x]
493
	jz	@f
483
	jz	@f
494
	neg	eax
484
	neg	eax
495
	mov	ecx,eax
485
	mov	ecx,eax
496
	add	[ebx],eax
486
	add	[ebx],eax
497
	mov	al,' '
487
	mov	al,' '
498
	rep	stosb
488
	rep	stosb
499
    @@: sub	edi,[copy_buf] ;! AREA_CBUF
489
    @@: sub	edi,[copy_buf]
500
	mov	[copy_size],edi
490
	mov	[copy_size],edi
501
	mov	eax,[sel.end.y]
491
	mov	eax,[sel.end.y]
502
	sub	eax,[sel.begin.y]
492
	sub	eax,[sel.begin.y]
503
	inc	eax
493
	inc	eax
504
	mov	[copy_count],eax
494
	mov	[copy_count],eax
Line 506... Line 496...
506
	ret
496
	ret
Line 507... Line 497...
507
 
497
 
508
  .single_line:
498
  .single_line:
509
	mov	eax,[sel.end.x]
499
	mov	eax,[sel.end.x]
510
	sub	eax,[sel.begin.x]
500
	sub	eax,[sel.begin.x]
511
	mov	edi,[copy_buf] ;! AREA_CBUF
501
	mov	edi,[copy_buf]
512
	stosd
502
	stosd
513
	mov	ecx,[sel.begin.y]
503
	mov	ecx,[sel.begin.y]
514
	call	get_line_offset
504
	call	get_line_offset
515
	mov	ebx,[sel.begin.x]
505
	mov	ebx,[sel.begin.x]
Line 547... Line 537...
547
	add	ebx,[copy_size]
537
	add	ebx,[copy_size]
548
	mov	[cur_editor.Lines.Size],ebx
538
	mov	[cur_editor.Lines.Size],ebx
549
	call	mem.ReAlloc
539
	call	mem.ReAlloc
550
	mov	[cur_editor.Lines],eax
540
	mov	[cur_editor.Lines],eax
Line 551... Line 541...
551
 
541
 
552
	mov	ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
542
	mov	ecx,[cur_editor.Caret.Y]
553
	call	get_line_offset
543
	call	get_line_offset
554
	pushd	[esi] esi
544
	pushd	[esi] esi
555
	mov	ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
545
	mov	ecx,[cur_editor.Caret.X]
556
	call	line_add_spaces
546
	call	line_add_spaces
557
	add	[esp],eax		 ;!!!
547
	add	[esp],eax
558
	add	esi,eax 		 ;!!!
548
	add	esi,eax
559
	mov	ecx,[copy_size]
549
	mov	ecx,[copy_size]
560
	sub	ecx,4
550
	sub	ecx,4
561
	mov	edi,[cur_editor.Lines] ;! AREA_TEMP2
551
	mov	edi,[cur_editor.Lines]
562
	add	edi,[edi-4]
552
	add	edi,[edi-4]
563
	dec	edi
553
	dec	edi
564
	mov	eax,esi
554
	mov	eax,esi
565
	mov	esi,edi
555
	mov	esi,edi
566
	sub	esi,ecx
556
	sub	esi,ecx
567
	lea	ecx,[eax+4]
557
	lea	ecx,[eax+4]
568
	add	ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
558
	add	ecx,[cur_editor.Caret.X]
569
	neg	ecx
559
	neg	ecx
570
	lea	ecx,[esi+ecx+1]
560
	lea	ecx,[esi+ecx+1]
571
	std
561
	std
Line 576... Line 566...
576
	jz	.single_line
566
	jz	.single_line
Line 577... Line 567...
577
 
567
 
578
	cld
568
	cld
579
	pop	edi
569
	pop	edi
580
	add	edi,4
570
	add	edi,4
581
	mov	esi,[copy_buf] ;! AREA_CBUF
571
	mov	esi,[copy_buf]
Line 582... Line 572...
582
	lodsd
572
	lodsd
583
 
573
 
584
	mov	ebx,[cur_editor.Caret.X] ;! ebx,[pos.x]
574
	mov	ebx,[cur_editor.Caret.X]
585
	add	eax,ebx
575
	add	eax,ebx
586
	mov	[edi-4],ax
576
	mov	[edi-4],ax
587
	mov	byte[edi-4+2],0x0001
577
	mov	byte[edi-4+2],0x0001
Line 603... Line 593...
603
	add	[edi-4],cx
593
	add	[edi-4],cx
604
	call	.check_columns
594
	call	.check_columns
605
	mov	ecx,eax
595
	mov	ecx,eax
606
	rep	movsb
596
	rep	movsb
Line 607... Line 597...
607
 
597
 
608
	mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
598
	mov	[cur_editor.Caret.X],eax
609
	mov	[cur_editor.SelStart.X],eax ;! [sel.x],eax
599
	mov	[cur_editor.SelStart.X],eax
610
	mov	eax,[copy_count]
600
	mov	eax,[copy_count]
611
	dec	eax
601
	dec	eax
612
	add	[cur_editor.Caret.Y],eax ;! [pos.y],eax
602
	add	[cur_editor.Caret.Y],eax
613
	add	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
603
	add	[cur_editor.SelStart.Y],eax
Line 614... Line -...
614
	add	[cur_editor.Lines.Count],eax ;! [lines],eax
-
 
615
 
604
	add	[cur_editor.Lines.Count],eax
616
	call	check_inv_all
605
 
Line 617... Line 606...
617
	mov	[cur_editor.Modified],1 ;! [modified],1
606
	mov	[cur_editor.Modified],1
618
	jmp	.exit
607
	jmp	.exit
619
 
608
 
620
  .single_line:
609
  .single_line:
621
	cld
610
	cld
622
	pop	edi
611
	pop	edi
623
	add	edi,4
612
	add	edi,4
624
	mov	esi,[copy_buf] ;! AREA_CBUF
613
	mov	esi,[copy_buf]
625
	lodsd
614
	lodsd
626
	add	[edi-4],ax
615
	add	[edi-4],ax
627
	and	dword[edi-4],not 0x00020000
616
	and	dword[edi-4],not 0x00020000
628
	or	dword[edi-4],0x00010000
617
	or	dword[edi-4],0x00010000
629
	call	.check_columns
618
	call	.check_columns
630
	add	edi,[cur_editor.Caret.X] ;! edi,[pos.x]
619
	add	edi,[cur_editor.Caret.X]
Line 631... Line 620...
631
	add	esp,4
620
	add	esp,4
632
	mov	ecx,eax
621
	mov	ecx,eax
Line 633... Line -...
633
	rep	movsb
-
 
634
 
622
	rep	movsb
Line 635... Line 623...
635
	add	[cur_editor.Caret.X],eax ;! [pos.x],eax
623
 
636
	add	[cur_editor.SelStart.X],eax ;! [sel.x],eax
624
	add	[cur_editor.Caret.X],eax
Line 637... Line 625...
637
 
625
	add	[cur_editor.SelStart.X],eax
638
	call	check_inv_all
626
 
639
	mov	[cur_editor.Modified],1 ;! [modified],1
627
	mov	[cur_editor.Modified],1
640
 
628
 
641
  .exit:
629
  .exit:
642
	ret
630
	ret
643
 
631
 
644
  .check_columns:
632
  .check_columns:
645
	push	eax
-
 
646
	movzx	eax,word[edi-4]
-
 
647
	cmp	eax,[cur_editor.Columns.Count] ;! eax,[columns]
-
 
648
	jbe	@f
-
 
649
	mov	[cur_editor.Columns.Count],eax ;! [columns],eax
-
 
650
    @@: pop	eax
-
 
651
	ret
-
 
652
;        push    eax ebx esi
-
 
653
;        add     esi,eax
-
 
654
;        xor     ebx,ebx
-
 
655
;        neg     eax
-
 
656
;        jz      .lp1
-
 
657
;    @@: cmp     byte[esi+ebx-1],' '
-
 
658
;        jne     .lp1
-
 
659
;        dec     ebx
-
 
660
;        cmp     ebx,eax
-
 
661
;        jg      @b
-
 
662
;  .lp1: add     ebx,[edi-4]
633
	push	eax
Line 663... Line 634...
663
;        cmp     [columns],ebx
634
	movzx	eax,word[edi-4]
664
;        jae     @f
635
	cmp	eax,[cur_editor.Columns.Count]
665
;        mov     [columns],ebx
636
	jbe	@f
666
;    @@: pop     esi ebx eax
637
	mov	[cur_editor.Columns.Count],eax
667
;        ret
638
    @@: pop	eax
Line 668... Line 639...
668
 
639
	ret
669
endf
640
endf
670
 
641
 
Line 671... Line 642...
671
;-----------------------------------------------------------------------------
642
;-----------------------------------------------------------------------------
672
func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
643
func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
673
;-----------------------------------------------------------------------------
644
;-----------------------------------------------------------------------------
674
	mov	eax,94
645
	mov	eax,94
675
	call	editor_realloc_lines
646
	call	editor_realloc_lines
676
 
647
 
Line 695... Line 666...
695
	mov	al,' '
666
	mov	al,' '
696
	mov	ecx,10
667
	mov	ecx,10
697
	rep	stosb
668
	rep	stosb
698
	mov	byte[ebx+4],';'
669
	mov	byte[ebx+4],';'
Line 699... Line 670...
699
 
670
 
700
	inc	[cur_editor.Lines.Count] ;! [lines]
671
	inc	[cur_editor.Lines.Count]
701
	inc	[cur_editor.Caret.Y] ;! [pos.y]
672
	inc	[cur_editor.Caret.Y]
Line 702... Line -...
702
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
-
 
703
 
673
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
Line 704... Line 674...
704
	call	check_inv_all
674
 
705
	mov	[cur_editor.Modified],1 ;! [modified],1
675
	mov	[cur_editor.Modified],1
706
 
676
 
Line 707... Line 677...
707
  .exit:
677
  .exit:
708
	ret
678
	ret
709
endf
679
endf
710
 
680
 
711
;-----------------------------------------------------------------------------
681
;-----------------------------------------------------------------------------
712
func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
682
func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
713
;-----------------------------------------------------------------------------
683
;-----------------------------------------------------------------------------
Line 714... Line 684...
714
	mov	eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
684
	mov	eax,[cur_editor.Caret.Y]
715
	inc	eax
685
	inc	eax
716
	cmp	eax,[cur_editor.Lines.Count] ;! eax,[lines]
686
	cmp	eax,[cur_editor.Lines.Count]
717
	jge	.exit
687
	jge	.exit
718
 
688
 
719
	mov	ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
689
	mov	ecx,[cur_editor.Caret.Y]
720
	call	get_line_offset
690
	call	get_line_offset
Line 721... Line 691...
721
	mov	edi,esi
691
	mov	edi,esi
722
	lodsd
-
 
723
	and	eax,0x0000FFFF
692
	lodsd
724
	add	esi,eax
693
	and	eax,0x0000FFFF
725
	push	eax
694
	add	esi,eax
726
 
695
	push	eax
727
	dec	[cur_editor.Lines.Count] ;! [lines]
696
 
728
	;mov     ecx,[temp_buf] ;! AREA_TEMP2
697
	dec	[cur_editor.Lines.Count]
Line 729... Line 698...
729
	mov	ecx,[cur_editor.Lines]
698
	mov	ecx,[cur_editor.Lines]
730
	add	ecx,[ecx-4]
699
	add	ecx,[ecx-4]
Line 739... Line 708...
739
	call	editor_realloc_lines
708
	call	editor_realloc_lines
Line 740... Line 709...
740
 
709
 
741
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
710
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
Line 742... Line -...
742
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
-
 
743
 
711
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
Line 744... Line 712...
744
	call	check_inv_all
712
 
745
	mov	[cur_editor.Modified],1 ;! [modified],1
713
	mov	[cur_editor.Modified],1
746
 
714
 
Line 754... Line 722...
754
	call	clear_selection
722
	call	clear_selection
Line 755... Line 723...
755
 
723
 
756
;-----------------------------------------------------------------------------
724
;-----------------------------------------------------------------------------
757
     key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
725
     key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
758
;-----------------------------------------------------------------------------
726
;-----------------------------------------------------------------------------
759
	mov	eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
727
	mov	eax,[cur_editor.Caret.Y]
760
	dec	eax
728
	dec	eax
761
	jns	@f
729
	jns	@f
762
	xor	eax,eax
730
	xor	eax,eax
763
    @@: mov	ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
731
    @@: mov	ecx,[cur_editor.TopLeft.Y]
764
	cmp	eax,ecx
732
	cmp	eax,ecx
765
	jae	@f
733
	jae	@f
766
	dec	ecx
734
	dec	ecx
767
	jns	@f
735
	jns	@f
768
	xor	ecx,ecx
736
	xor	ecx,ecx
769
    @@: test	byte[shi+2],0x01
737
    @@: test	byte[shi+2],0x01
770
	jnz	@f
738
	jnz	@f
771
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
739
	mov	[cur_editor.SelStart.Y],eax
-
 
740
    @@: mov	[cur_editor.Caret.Y],eax
Line 772... Line 741...
772
    @@: call	check_inv_all.skip_init
741
	mov	[cur_editor.TopLeft.Y],ecx
773
 
742
 
774
  .exit:
743
  .exit:
Line 782... Line 751...
782
 
751
 
783
;-----------------------------------------------------------------------------
752
;-----------------------------------------------------------------------------
784
     key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
753
     key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
Line 785... Line 754...
785
;-----------------------------------------------------------------------------
754
;-----------------------------------------------------------------------------
786
 
755
 
787
	mov	eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
756
	mov	eax,[cur_editor.Caret.Y]
788
	inc	eax
757
	inc	eax
789
	cmp	eax,[cur_editor.Lines.Count] ;! eax,[lines]
758
	cmp	eax,[cur_editor.Lines.Count]
790
	jb	@f
759
	jb	@f
791
	dec	eax
760
	dec	eax
792
    @@: mov	ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
761
    @@: mov	ecx,[cur_editor.TopLeft.Y]
793
	mov	edx,eax
762
	mov	edx,eax
794
	sub	edx,ecx
763
	sub	edx,ecx
795
	cmp	edx,[lines.scr]
764
	cmp	edx,[lines.scr]
796
	jb	@f
765
	jb	@f
797
	inc	ecx
766
	inc	ecx
798
    @@: test	byte[shi+2],0x01
767
    @@: test	byte[shi+2],0x01
799
	jnz	@f
768
	jnz	@f
-
 
769
	mov	[cur_editor.SelStart.Y],eax
Line 800... Line 770...
800
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
770
    @@: mov	[cur_editor.Caret.Y],eax
801
    @@: call	check_inv_all.skip_init
771
	mov	[cur_editor.TopLeft.Y],ecx
802
 
772
 
Line 810... Line 780...
810
	call	clear_selection
780
	call	clear_selection
Line 811... Line 781...
811
 
781
 
812
;-----------------------------------------------------------------------------
782
;-----------------------------------------------------------------------------
813
     key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
783
     key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
814
;-----------------------------------------------------------------------------
784
;-----------------------------------------------------------------------------
815
	mov	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
785
	mov	eax,[cur_editor.Caret.X]
816
	dec	eax
786
	dec	eax
817
	jns	@f
787
	jns	@f
818
	inc	eax
788
	inc	eax
819
    @@: test	byte[shi+2],0x01
789
    @@: test	byte[shi+2],0x01
820
	jnz	@f
790
	jnz	@f
821
	mov	[cur_editor.SelStart.X],eax ;! [sel.x],eax
791
	mov	[cur_editor.SelStart.X],eax
822
    @@: mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
-
 
Line 823... Line 792...
823
	call	 check_inv_all
792
    @@: mov	[cur_editor.Caret.X],eax
824
 
793
 
825
  .exit:
794
  .exit:
Line 832... Line 801...
832
	call	clear_selection
801
	call	clear_selection
Line 833... Line 802...
833
 
802
 
834
;-----------------------------------------------------------------------------
803
;-----------------------------------------------------------------------------
835
     key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
804
     key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
836
;-----------------------------------------------------------------------------
805
;-----------------------------------------------------------------------------
837
	mov	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
806
	mov	eax,[cur_editor.Caret.X]
838
	inc	eax
807
	inc	eax
839
	cmp	eax,[cur_editor.Columns.Count] ;! eax,[columns]
808
	cmp	eax,[cur_editor.Columns.Count]
840
	jbe	@f
809
	jbe	@f
841
	dec	eax
810
	dec	eax
842
    @@: test	byte[shi+2],0x01
811
    @@: test	byte[shi+2],0x01
843
	jnz	@f
812
	jnz	@f
844
	mov	[cur_editor.SelStart.X],eax ;! [sel.x],eax
813
	mov	[cur_editor.SelStart.X],eax
845
    @@: mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
-
 
Line 846... Line 814...
846
	call	check_inv_all
814
    @@: mov	[cur_editor.Caret.X],eax
847
 
815
 
848
  .exit:
816
  .exit:
Line 857... Line 825...
857
;-----------------------------------------------------------------------------
825
;-----------------------------------------------------------------------------
858
     key.shift_pgup: ;///// GO TO PREVIOUS PAGE, WITH SELECTION //////////////
826
     key.shift_pgup: ;///// GO TO PREVIOUS PAGE, WITH SELECTION //////////////
859
;-----------------------------------------------------------------------------
827
;-----------------------------------------------------------------------------
860
	mov	edx,[lines.scr]
828
	mov	edx,[lines.scr]
861
	dec	edx
829
	dec	edx
862
	mov	eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
830
	mov	eax,[cur_editor.Caret.Y]
863
	mov	ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
831
	mov	ecx,[cur_editor.TopLeft.Y]
864
	sub	eax,edx
832
	sub	eax,edx
865
	jns	@f
833
	jns	@f
866
	xor	eax,eax
834
	xor	eax,eax
867
    @@: sub	ecx,edx
835
    @@: sub	ecx,edx
868
	jns	@f
836
	jns	@f
869
	xor	ecx,ecx
837
	xor	ecx,ecx
870
    @@: test	byte[shi+2],0x01
838
    @@: test	byte[shi+2],0x01
871
	jnz	@f
839
	jnz	@f
872
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
840
	mov	[cur_editor.SelStart.Y],eax
873
    @@: call	check_inv_all.skip_init
841
    @@: mov	[cur_editor.Caret.Y],eax
-
 
842
	mov	[cur_editor.TopLeft.Y],ecx
Line 874... Line 843...
874
 
843
 
875
  .exit:
844
  .exit:
876
	ret
845
	ret
Line 884... Line 853...
884
;-----------------------------------------------------------------------------
853
;-----------------------------------------------------------------------------
885
     key.shift_pgdn: ;///// GO TO NEXT PAGE, WITH SELECTION //////////////////
854
     key.shift_pgdn: ;///// GO TO NEXT PAGE, WITH SELECTION //////////////////
886
;-----------------------------------------------------------------------------
855
;-----------------------------------------------------------------------------
887
	mov	edx,[lines.scr]
856
	mov	edx,[lines.scr]
888
	dec	edx
857
	dec	edx
889
	mov	eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
858
	mov	eax,[cur_editor.Caret.Y]
890
	mov	ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
859
	mov	ecx,[cur_editor.TopLeft.Y]
891
	add	eax,edx
860
	add	eax,edx
892
	add	ecx,edx
861
	add	ecx,edx
893
	cmp	eax,[cur_editor.Lines.Count] ;! eax,[lines]
862
	cmp	eax,[cur_editor.Lines.Count]
894
	jb	@f
863
	jb	@f
895
	mov	eax,[cur_editor.Lines.Count] ;! eax,[lines]
864
	mov	eax,[cur_editor.Lines.Count]
896
	dec	eax
865
	dec	eax
897
    @@: test	byte[shi+2],0x01
866
    @@: test	byte[shi+2],0x01
898
	jnz	@f
867
	jnz	@f
899
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
868
	mov	[cur_editor.SelStart.Y],eax
900
    @@: call	check_inv_all.skip_init
869
    @@: mov	[cur_editor.Caret.Y],eax
-
 
870
	mov	[cur_editor.TopLeft.Y],ecx
Line 901... Line 871...
901
 
871
 
902
  .exit:
872
  .exit:
903
	ret
873
	ret
Line 909... Line 879...
909
	call	clear_selection
879
	call	clear_selection
Line 910... Line 880...
910
 
880
 
911
;-----------------------------------------------------------------------------
881
;-----------------------------------------------------------------------------
912
     key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
882
     key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
913
;-----------------------------------------------------------------------------
883
;-----------------------------------------------------------------------------
914
	mov	[cur_editor.Caret.X],0 ;! [pos.x],0
884
	mov	[cur_editor.Caret.X],0
915
	test	byte[shi+2],0x01
885
	test	byte[shi+2],0x01
916
	jnz	@f
886
	jnz	@f
917
	mov	[cur_editor.SelStart.X],0 ;! [sel.x],0
887
	mov	[cur_editor.SelStart.X],0
Line 918... Line 888...
918
    @@: call	check_inv_all
888
    @@:
919
 
889
 
920
  .exit:
890
  .exit:
Line 927... Line 897...
927
	call	clear_selection
897
	call	clear_selection
Line 928... Line 898...
928
 
898
 
929
;-----------------------------------------------------------------------------
899
;-----------------------------------------------------------------------------
930
     key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
900
     key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
931
;-----------------------------------------------------------------------------
901
;-----------------------------------------------------------------------------
932
	mov	ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
902
	mov	ecx,[cur_editor.Caret.Y]
933
	call	get_line_offset
903
	call	get_line_offset
934
	call	get_real_length
904
	call	get_real_length
935
	mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
905
	mov	[cur_editor.Caret.X],eax
936
	test	byte[shi+2],0x01
906
	test	byte[shi+2],0x01
937
	jnz	@f
907
	jnz	@f
938
	mov	[cur_editor.SelStart.X],eax ;! [sel.x],eax
908
	mov	[cur_editor.SelStart.X],eax
Line 939... Line 909...
939
    @@: call	check_inv_all
909
    @@:
940
 
910
 
941
  .exit:
911
  .exit:
Line 948... Line 918...
948
	call	clear_selection
918
	call	clear_selection
Line 949... Line 919...
949
 
919
 
950
;-----------------------------------------------------------------------------
920
;-----------------------------------------------------------------------------
951
     key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
921
     key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
952
;-----------------------------------------------------------------------------
922
;-----------------------------------------------------------------------------
953
	mov	eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
923
	mov	eax,[cur_editor.TopLeft.Y]
954
	mov	ecx,eax
924
	mov	ecx,eax
955
	test	byte[shi+2],0x01
925
	test	byte[shi+2],0x01
956
	jnz	@f
926
	jnz	@f
957
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
927
	mov	[cur_editor.SelStart.Y],eax
-
 
928
    @@: mov	[cur_editor.Caret.Y],eax
Line 958... Line 929...
958
    @@: call	check_inv_all.skip_init
929
	mov	[cur_editor.TopLeft.Y],ecx
959
 
930
 
960
  .exit:
931
  .exit:
Line 967... Line 938...
967
	call	clear_selection
938
	call	clear_selection
Line 968... Line 939...
968
 
939
 
969
;-----------------------------------------------------------------------------
940
;-----------------------------------------------------------------------------
970
     key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
941
     key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
971
;-----------------------------------------------------------------------------
942
;-----------------------------------------------------------------------------
972
	mov	ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
943
	mov	ecx,[cur_editor.TopLeft.Y]
973
	mov	eax,[lines.scr]
944
	mov	eax,[lines.scr]
974
	cmp	eax,[cur_editor.Lines.Count] ;! eax,[lines]
945
	cmp	eax,[cur_editor.Lines.Count]
975
	jle	@f
946
	jle	@f
976
	mov	eax,[cur_editor.Lines.Count] ;! eax,[lines]
947
	mov	eax,[cur_editor.Lines.Count]
977
    @@: add	eax,ecx
948
    @@: add	eax,ecx
978
	dec	eax
949
	dec	eax
979
	test	byte[shi+2],0x01
950
	test	byte[shi+2],0x01
980
	jnz	@f
951
	jnz	@f
981
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
952
	mov	[cur_editor.SelStart.Y],eax
-
 
953
    @@: mov	[cur_editor.Caret.Y],eax
Line 982... Line 954...
982
    @@: call	check_inv_all.skip_init
954
	mov	[cur_editor.TopLeft.Y],ecx
983
 
955
 
984
  .exit:
956
  .exit:
Line 992... Line 964...
992
 
964
 
993
;-----------------------------------------------------------------------------
965
;-----------------------------------------------------------------------------
994
     key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
966
     key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
995
;-----------------------------------------------------------------------------
967
;-----------------------------------------------------------------------------
996
	xor	eax,eax
968
	xor	eax,eax
997
	mov	[cur_editor.TopLeft.Y],eax ;! [top_line],eax
969
	mov	[cur_editor.TopLeft.Y],eax
998
	mov	[cur_editor.Caret.Y],eax ;! [pos.y],eax
970
	mov	[cur_editor.Caret.Y],eax
999
	test	byte[shi+2],0x01
971
	test	byte[shi+2],0x01
1000
	jnz	@f
972
	jnz	@f
1001
	mov	[cur_editor.SelStart.Y],eax ;! [sel.y],eax
973
	mov	[cur_editor.SelStart.Y],eax
Line 1002... Line 974...
1002
    @@: call	check_inv_all.skip_check
974
    @@:
1003
 
975
 
1004
  .exit:
976
  .exit:
Line 1011... Line 983...
1011
	call	clear_selection
983
	call	clear_selection
Line 1012... Line 984...
1012
 
984
 
1013
;-----------------------------------------------------------------------------
985
;-----------------------------------------------------------------------------
1014
     key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
986
     key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
1015
;-----------------------------------------------------------------------------
987
;-----------------------------------------------------------------------------
1016
	mov	eax,[cur_editor.Lines.Count] ;! eax,[lines]    ; eax = lines in the file
988
	mov	eax,[cur_editor.Lines.Count]
1017
	mov	[cur_editor.Caret.Y],eax ;! [pos.y],eax
989
	mov	[cur_editor.Caret.Y],eax
1018
	sub	eax,[lines.scr]   ; eax -= lines on the screen
990
	sub	eax,[lines.scr]
1019
	jns	@f
991
	jns	@f
1020
	xor	eax,eax
992
	xor	eax,eax
1021
    @@: mov	[cur_editor.TopLeft.Y],eax ;! [top_line],eax
993
    @@: mov	[cur_editor.TopLeft.Y],eax
1022
	dec	[cur_editor.Caret.Y] ;! [pos.y]
994
	dec	[cur_editor.Caret.Y]
1023
	test	byte[shi+2],0x01
995
	test	byte[shi+2],0x01
1024
	jnz	@f
996
	jnz	@f
1025
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
-
 
1026
;!      push    [pos.y]
997
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
1027
;!      pop     [sel.y]
-
 
Line 1028... Line 998...
1028
    @@: call	check_inv_all.skip_check
998
    @@:
1029
 
999
 
1030
  .exit:
1000
  .exit:
Line 1031... Line 1001...
1031
	ret
1001
	ret
1032
endf
1002
endf
1033
 
1003
 
1034
;-----------------------------------------------------------------------------
1004
;-----------------------------------------------------------------------------
1035
func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
1005
func key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
Line 1036... Line 1006...
1036
;-----------------------------------------------------------------------------
1006
;-----------------------------------------------------------------------------
1037
	call	delete_selection
1007
	call	delete_selection
1038
	jnc	.exit.2
1008
	jnc	.exit
1039
 
1009
 
1040
	mov	ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
1010
	mov	ecx,[cur_editor.Caret.Y]
1041
	call	get_line_offset
1011
	call	get_line_offset
Line 1042... Line 1012...
1042
	and	dword[esi],not 0x00020000
1012
	and	dword[esi],not 0x00020000
1043
	or	dword[esi],0x00010000
1013
	or	dword[esi],0x00010000
1044
	lea	ebx,[esi+4]
1014
	lea	ebx,[esi+4]
Line 1045... Line 1015...
1045
	mov	ebp,esi
1015
	mov	ebp,esi
1046
 
1016
 
1047
	call	get_real_length
1017
	call	get_real_length
1048
	or	eax,eax
1018
	or	eax,eax
1049
	je	.line_up
1019
	je	.line_up
1050
 
1020
 
1051
	mov	ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
1021
	mov	ecx,[cur_editor.Caret.X]
1052
	cmp	ecx,eax
1022
	cmp	ecx,eax
1053
	jae	.line_up
1023
	jae	.line_up
Line 1054... Line 1024...
1054
	lea	edi,[ebx+ecx]
1024
	lea	edi,[ebx+ecx]
1055
	neg	ecx
1025
	neg	ecx
1056
	movzx	eax,word[ebp]
1026
	movzx	eax,word[ebp]
1057
	add	ecx,eax;[ebp]
1027
	add	ecx,eax;[ebp]
1058
	repe	scasb
1028
	repe	scasb
1059
	je	.line_up
1029
	je	.line_up
1060
 
1030
 
1061
	mov	edi,ebx
1031
	mov	edi,ebx
1062
	mov	ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
1032
	mov	ecx,[cur_editor.Caret.X]
1063
	add	edi,ecx
1033
	add	edi,ecx
Line 1064... Line 1034...
1064
	lea	esi,[edi+1]
1034
	lea	esi,[edi+1]
1065
	neg	ecx
1035
	neg	ecx
1066
	movzx	eax,word[ebp]
-
 
1067
	add	ecx,eax;[ebp]
1036
	movzx	eax,word[ebp]
1068
	dec	ecx
1037
	add	ecx,eax;[ebp]
Line 1069... Line 1038...
1069
	rep	movsb
1038
	dec	ecx
1070
	mov	byte[edi],' '
1039
	rep	movsb
1071
 
1040
	mov	byte[edi],' '
1072
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
1041
 
1073
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
1042
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
1074
	call	check_inv_all
1043
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
1075
	mov	[cur_editor.Modified],1 ;! [modified],1
1044
	mov	[cur_editor.Modified],1
1076
	ret
1045
	ret
1077
 
1046
 
1078
  .line_up:
1047
  .line_up:
1079
	mov	eax,[cur_editor.Lines.Count] ;! eax,[lines]
1048
	mov	eax,[cur_editor.Lines.Count]
1080
	dec	eax
1049
	dec	eax
1081
	cmp	eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
1050
	cmp	eax,[cur_editor.Caret.Y]
1082
	je	.exit
1051
	je	.exit
1083
	mov	edi,[temp_buf] ;! AREA_TEMP+4
1052
	mov	edi,[temp_buf]
1084
	add	edi,4
1053
	add	edi,4
1085
	mov	esi,ebx
1054
	mov	esi,ebx
1086
	mov	ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
1055
	mov	ecx,[cur_editor.Caret.X]
1087
	rep	movsb
1056
	rep	movsb
1088
	mov	ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
1057
	mov	ecx,[cur_editor.Caret.X]
1089
	mov	eax,[temp_buf]
1058
	mov	eax,[temp_buf]
1090
	mov	[eax],ecx ;! [AREA_TEMP],ecx
1059
	mov	[eax],ecx
1091
	cmp	cx,[ebp]
1060
	cmp	cx,[ebp]
1092
	jbe	@f
1061
	jbe	@f
1093
	movzx	eax,word[ebp]
1062
	movzx	eax,word[ebp]
1094
	sub	ecx,eax;[ebp]
1063
	sub	ecx,eax
1095
	sub	edi,ecx
1064
	sub	edi,ecx
1096
	mov	al,' '
1065
	mov	al,' '
Line 1097... Line 1066...
1097
	rep	stosb
1066
	rep	stosb
1098
    @@: lea	esi,[ebx+4]
1067
    @@: lea	esi,[ebx+4]
Line 1099... Line 1068...
1099
	movzx	eax,word[ebp]
1068
	movzx	eax,word[ebp]
1100
	add	esi,eax;[ebp]
1069
	add	esi,eax
1101
	movzx	ecx,word[esi-4]
1070
	movzx	ecx,word[esi-4]
1102
	mov	eax,[temp_buf]
1071
	mov	eax,[temp_buf]
1103
	add	[eax],ecx ;! [AREA_TEMP],ecx
1072
	add	[eax],ecx
1104
	or	dword[eax],0x00010000 ;! dword[AREA_TEMP],0x00010000
1073
	or	dword[eax],0x00010000
1105
	rep	movsb
1074
	rep	movsb
1106
 
1075
 
1107
	mov	ecx,edi ;! [edi-AREA_TEMP]
1076
	mov	ecx,edi
1108
	sub	ecx,[temp_buf]
1077
	sub	ecx,[temp_buf]
1109
 
1078
 
1110
	mov	esi,[temp_buf] ;! AREA_TEMP
1079
	mov	esi,[temp_buf]
1111
	call	get_real_length
1080
	call	get_real_length
1112
	cmp	eax,[cur_editor.Columns.Count] ;! eax,[columns]
1081
	cmp	eax,[cur_editor.Columns.Count]
1113
	jbe	@f
-
 
1114
	mov	[cur_editor.Columns.Count],eax ;! [columns],eax
-
 
1115
    @@:
1082
	jbe	@f
1116
	push	ecx
1083
	mov	[cur_editor.Columns.Count],eax
1117
	mov	edi,[cur_editor.Lines] ;! AREA_TEMP2
1084
    @@:
1118
	add	edi,[edi-4]
1085
	push	ecx
1119
	dec	edi
1086
	mov	edi,[cur_editor.Lines]
1120
	lea	esi,[edi+8]
1087
	add	edi,[edi-4]
1121
	sub	esi,ecx
1088
	dec	edi
1122
	movzx	eax,word[ebp]
1089
	lea	esi,[edi+8]
1123
	add	esi,eax;[ebp]
1090
	sub	esi,ecx
1124
;       lea     eax,[ebp+4]
1091
	movzx	eax,word[ebp]
1125
;       add     eax,[ebp]
1092
	add	esi,eax
1126
	movzx	eax,word[ebp]
1093
	movzx	eax,word[ebp]
1127
	movzx	eax,word[ebp+eax+4]
1094
	movzx	eax,word[ebp+eax+4]
1128
	add	esi,eax;[eax]
1095
	add	esi,eax
1129
	lea	ecx,[esi-4]
1096
	lea	ecx,[esi-4]
1130
	sub	ecx,ebp
1097
	sub	ecx,ebp
1131
	std
1098
	std
1132
	cmp	esi,edi
1099
	cmp	esi,edi
1133
	jb	@f
1100
	jb	@f
1134
	jz	.lp1
1101
	jz	.lp1
1135
	mov	edi,ebp
1102
	mov	edi,ebp
1136
	add	edi,[esp]
1103
	add	edi,[esp]
1137
	lea	esi,[ebp+8]
1104
	lea	esi,[ebp+8]
1138
	movzx	eax,word[esi-8]
1105
	movzx	eax,word[esi-8]
1139
	add	esi,eax;[esi-8]
1106
	add	esi,eax
1140
	movzx	eax,word[esi-4]
1107
	movzx	eax,word[esi-4]
Line 1141... Line 1108...
1141
	add	esi,eax;[esi-4]
1108
	add	esi,eax
1142
	mov	ecx,[cur_editor.Lines] ;! AREA_TEMP2
1109
	mov	ecx,[cur_editor.Lines]
1143
	add	ecx,[ecx-4]
1110
	add	ecx,[ecx-4]
1144
	sub	ecx,esi
1111
	sub	ecx,esi
1145
	cld
1112
	cld
1146
    @@: rep	movsb
1113
    @@: rep	movsb
1147
  .lp1: pop	ecx
1114
  .lp1: pop	ecx
1148
	mov	esi,[temp_buf] ;! AREA_TEMP
1115
	mov	esi,[temp_buf]
1149
	mov	edi,ebp
1116
	mov	edi,ebp
Line 1150... Line 1117...
1150
	cld
1117
	cld
1151
	rep	movsb
1118
	rep	movsb
1152
 
1119
 
1153
  .ok.dec.lines:
1120
  .ok.dec.lines:
Line 1168... Line 1135...
1168
	add	eax,[eax-4]
1135
	add	eax,[eax-4]
1169
	sub	esi,eax
1136
	sub	esi,eax
1170
	lea	eax,[esi+4096]
1137
	lea	eax,[esi+4096]
1171
	call	editor_realloc_lines
1138
	call	editor_realloc_lines
Line 1172... Line 1139...
1172
 
1139
 
1173
	mov	[cur_editor.Modified],1 ;! [modified],1
-
 
1174
  .exit.2:
-
 
Line 1175... Line 1140...
1175
	call	check_inv_all
1140
	mov	[cur_editor.Modified],1
1176
 
1141
 
1177
  .exit:
1142
  .exit:
Line 1178... Line 1143...
1178
	ret
1143
	ret
1179
endf
-
 
1180
 
1144
endf
1181
;-----------------------------------------------------------------------------
1145
 
1182
; INSERT {
1146
;-----------------------------------------------------------------------------
-
 
1147
  key.ins:
-
 
1148
;// ... toggle insert/overwrite mode here ...
-
 
1149
	xor	[ins_mode],1
1183
  key.ins:
1150
	mov	eax,[cur_editor.Caret.Y]
1184
;// ... toggle insert/overwrite mode here ...
1151
	mov	ebx,eax
1185
	xor	[ins_mode],1
-
 
Line 1186... Line 1152...
1186
	call	check_inv_str
1152
	call	draw_editor_text.part
1187
	ret
1153
	call	draw_editor_caret
1188
; INSERT }
1154
	ret
1189
 
1155
 
1190
;-----------------------------------------------------------------------------
1156
;-----------------------------------------------------------------------------
Line 1191... Line 1157...
1191
func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
1157
func key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
1192
;-----------------------------------------------------------------------------
1158
;-----------------------------------------------------------------------------
1193
	call	delete_selection
1159
	call	delete_selection
Line 1194... Line 1160...
1194
	jnc	key.del.exit.2
1160
	jnc	key.del.exit
1195
 
1161
 
1196
	mov	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
1162
	mov	eax,[cur_editor.Caret.X]
1197
	dec	eax
1163
	dec	eax
1198
	js	.line_up
1164
	js	.line_up
Line 1199... Line 1165...
1199
 
1165
 
1200
	dec	[cur_editor.Caret.X] ;! [pos.x]
1166
	dec	[cur_editor.Caret.X]
1201
	mov	ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
1167
	mov	ecx,[cur_editor.Caret.Y]
1202
	call	get_line_offset
1168
	call	get_line_offset
1203
	and	dword[esi],not 0x00020000
1169
	and	dword[esi],not 0x00020000
1204
	or	dword[esi],0x00010000
-
 
1205
 
1170
	or	dword[esi],0x00010000
1206
	mov	ebx,eax
1171
 
Line 1207... Line 1172...
1207
	call	get_real_length
1172
	mov	ebx,eax
1208
	cmp	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
1173
	call	get_real_length
1209
	jae	@f
1174
	cmp	eax,[cur_editor.Caret.X]
1210
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
1175
	jae	@f
1211
	call	check_inv_all
1176
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
1212
	mov	[cur_editor.Modified],1 ;! [modified],1
1177
	mov	[cur_editor.Modified],1
1213
	ret
1178
	ret
1214
 
1179
 
1215
    @@: lea	edi,[esi+4+ebx]
1180
    @@: lea	edi,[esi+4+ebx]
1216
	mov	ecx,ebx
1181
	mov	ecx,ebx
Line 1217... Line 1182...
1217
	neg	ecx
1182
	neg	ecx
1218
	movzx	eax,word[esi]
1183
	movzx	eax,word[esi]
1219
	add	ecx,eax;[esi]
-
 
1220
	dec	ecx
1184
	add	ecx,eax
1221
	lea	esi,[edi+1]
1185
	dec	ecx
Line 1222... Line 1186...
1222
	cld
1186
	lea	esi,[edi+1]
1223
	rep	movsb
1187
	cld
1224
	mov	byte[edi],' '
1188
	rep	movsb
1225
 
1189
	mov	byte[edi],' '
1226
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
1190
 
1227
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
1191
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
1228
	call	check_inv_str
1192
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
1229
	mov	[cur_editor.Modified],1 ;! [modified],1
1193
	mov	[cur_editor.Modified],1
1230
	ret
1194
	ret
Line 1244... Line 1208...
1244
	movzx	ecx,word[ebp]
1208
	movzx	ecx,word[ebp]
1245
    @@: cmp	byte[ebx+ecx-1],' '
1209
    @@: cmp	byte[ebx+ecx-1],' '
1246
	jne	@f
1210
	jne	@f
1247
	dec	ecx
1211
	dec	ecx
1248
	jg	@b
1212
	jg	@b
1249
    @@: mov	[cur_editor.Caret.X],ecx ;! [pos.x],ecx
1213
    @@: mov	[cur_editor.Caret.X],ecx
1250
	dec	[cur_editor.Caret.Y] ;! [pos.y]
1214
	dec	[cur_editor.Caret.Y]
1251
	cld
1215
	cld
1252
	jmp	key.del.line_up
1216
	jmp	key.del.line_up
1253
endf
1217
endf
Line 1254... Line 1218...
1254
 
1218
 
1255
;-----------------------------------------------------------------------------
1219
;-----------------------------------------------------------------------------
1256
func key.tab ;///// TABULATE /////////////////////////////////////////////////
1220
func key.tab ;///// TABULATE /////////////////////////////////////////////////
1257
;-----------------------------------------------------------------------------
1221
;-----------------------------------------------------------------------------
1258
	call	delete_selection
1222
	call	delete_selection
Line 1259... Line 1223...
1259
	mov	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
1223
	mov	eax,[cur_editor.Caret.X]
1260
 
1224
 
1261
	mov	ecx,eax
1225
	mov	ecx,eax
1262
	add	eax,ATABW
1226
	add	eax,ATABW
1263
	and	eax,not(ATABW-1)
1227
	and	eax,not(ATABW-1)
1264
	push	eax ' '
1228
	push	eax ' '
1265
	sub	eax,ecx
1229
	sub	eax,ecx
1266
  .direct:
1230
  .direct:
1267
	push	eax
1231
	push	eax
1268
	call	editor_realloc_lines
1232
	call	editor_realloc_lines
1269
	pop	eax
1233
	pop	eax
1270
	mov	ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
1234
	mov	ecx,[cur_editor.Caret.Y]
1271
	call	get_line_offset
1235
	call	get_line_offset
Line 1272... Line 1236...
1272
	and	dword[esi],not 0x00020000
1236
	and	dword[esi],not 0x00020000
Line 1273... Line 1237...
1273
	or	dword[esi],0x00010000
1237
	or	dword[esi],0x00010000
1274
 
1238
 
1275
	xchg	eax,ecx
1239
	xchg	eax,ecx
1276
 
1240
 
1277
	call	get_real_length
1241
	call	get_real_length
1278
	cmp	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
1242
	cmp	eax,[cur_editor.Caret.X]
1279
	jae	@f
1243
	jae	@f
1280
	mov	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
1244
	mov	eax,[cur_editor.Caret.X]
1281
    @@: movzx	edx,word[esi]
1245
    @@: movzx	edx,word[esi]
1282
	sub	edx,eax
1246
	sub	edx,eax
1283
	cmp	ecx,edx
1247
	cmp	ecx,edx
1284
	jl	@f
1248
	jl	@f
1285
	push	eax
1249
	push	eax
1286
	mov	eax,10
1250
	mov	eax,10
1287
	call	editor_realloc_lines
1251
	call	editor_realloc_lines
1288
	add	esi,eax
1252
	add	esi,eax
1289
	pop	eax
1253
	pop	eax
1290
	pushad; esi ecx eax
1254
	pushad
1291
	mov	ecx,[cur_editor.Lines] ;! AREA_TEMP2-10+1
1255
	mov	ecx,[cur_editor.Lines]
1292
	add	ecx,[ecx-4]
-
 
1293
	dec	ecx
-
 
1294
	mov	edi,ecx ;! AREA_TEMP2
1256
	add	ecx,[ecx-4]
1295
	add	ecx,-10+1
1257
	dec	ecx
1296
;       lea     eax,[esi+4]
1258
	mov	edi,ecx
1297
;       add     eax,[esi]
1259
	add	ecx,-10+1
1298
	movzx	eax,word[esi]
1260
	movzx	eax,word[esi]
1299
	lea	eax,[esi+eax+4]
1261
	lea	eax,[esi+eax+4]
1300
	sub	ecx,eax
1262
	sub	ecx,eax
1301
	lea	esi,[edi-10] ;! AREA_TEMP2-10
1263
	lea	esi,[edi-10]
1302
	std
1264
	std
1303
	rep	movsb
1265
	rep	movsb
1304
	mov	ecx,10
1266
	mov	ecx,10
1305
	mov	al,' '
1267
	mov	al,' '
1306
	rep	stosb
1268
	rep	stosb
1307
	popad;  eax ecx esi
1269
	popad
1308
	add	word[esi],10
-
 
1309
	jmp	@b
-
 
1310
    @@: lea	ebx,[esi+4]
1270
	add	word[esi],10
1311
	push	ecx
1271
	jmp	@b
1312
;       lea     edi,[ebx-1]
1272
    @@: lea	ebx,[esi+4]
1313
;       add     edi,[esi]
1273
	push	ecx
1314
	movzx	edi,word[esi]
1274
	movzx	edi,word[esi]
1315
	lea	edi,[ebx+edi-1]
1275
	lea	edi,[ebx+edi-1]
1316
	mov	esi,edi
1276
	mov	esi,edi
1317
	sub	esi,ecx
1277
	sub	esi,ecx
1318
	lea	ecx,[esi+1]
1278
	lea	ecx,[esi+1]
1319
	sub	ecx,ebx
1279
	sub	ecx,ebx
1320
	sub	ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
1280
	sub	ecx,[cur_editor.Caret.X]
1321
	std
1281
	std
1322
	rep	movsb
1282
	rep	movsb
1323
  .ok:	pop	ecx		;*******
1283
  .ok:	pop	ecx
1324
	pop	eax
1284
	pop	eax
1325
	rep	stosb
1285
	rep	stosb
1326
	cld
1286
	cld
1327
	pop	[cur_editor.Caret.X] ;! [pos.x]
1287
	pop	[cur_editor.Caret.X]
1328
	lea	esi,[ebx-4]
1288
	lea	esi,[ebx-4]
1329
	call	get_real_length
1289
	call	get_real_length
1330
	cmp	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
1290
	cmp	eax,[cur_editor.Caret.X]
1331
	jae	@f
1291
	jae	@f
1332
	mov	eax,[cur_editor.Caret.X] ;! eax,[pos.x]
1292
	mov	eax,[cur_editor.Caret.X]
1333
    @@: cmp	eax,[cur_editor.Columns.Count] ;! eax,[columns]
1293
    @@: cmp	eax,[cur_editor.Columns.Count]
1334
	jbe	@f
-
 
1335
	mov	[cur_editor.Columns.Count],eax ;! [columns],eax
1294
	jbe	@f
Line 1336... Line 1295...
1336
    @@: m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
1295
	mov	[cur_editor.Columns.Count],eax
1337
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
1296
    @@: m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
1338
	call	check_inv_all
1297
	m2m	[cur_editor.SelStart.Y],[cur_editor.Caret.Y]
Line 1348... Line 1307...
1348
	call	delete_selection
1307
	call	delete_selection
Line 1349... Line 1308...
1349
 
1308
 
1350
	mov	eax,14
1309
	mov	eax,14
Line 1351... Line 1310...
1351
	call	editor_realloc_lines
1310
	call	editor_realloc_lines
1352
 
1311
 
Line 1353... Line 1312...
1353
	mov	ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
1312
	mov	ecx,[cur_editor.Caret.Y]
1354
	call	get_line_offset
1313
	call	get_line_offset
1355
 
1314
 
1356
	mov	ebx,[cur_editor.Caret.X] ;! ebx,[pos.x]
1315
	mov	ebx,[cur_editor.Caret.X]
1357
	cmp	bx,[esi]
1316
	cmp	bx,[esi]
1358
	jb	@f
1317
	jb	@f
1359
	movzx	ebx,word[esi]
1318
	movzx	ebx,word[esi]
1360
	dec	ebx
1319
	dec	ebx
1361
	jns	@f
1320
	jns	@f
Line 1362... Line 1321...
1362
	xor	ebx,ebx
1321
	xor	ebx,ebx
1363
    @@:
1322
    @@:
1364
	cld
1323
	cld
1365
 
1324
 
1366
	mov	edi,[temp_buf] ;! AREA_TEMP
1325
	mov	edi,[temp_buf]
1367
	mov	ebp,esi
1326
	mov	ebp,esi
Line 1381... Line 1340...
1381
    @@: mov	al,' '
1340
    @@: mov	al,' '
1382
	mov	ecx,10
1341
	mov	ecx,10
1383
	rep	stosb
1342
	rep	stosb
Line 1384... Line 1343...
1384
 
1343
 
1385
	movzx	ecx,word[esi]
1344
	movzx	ecx,word[esi]
1386
	sub	ecx,ebx;[pos.x]
1345
	sub	ecx,ebx
1387
	add	esi,ebx;[pos.x]
1346
	add	esi,ebx
1388
	add	esi,4
1347
	add	esi,4
1389
	inc	ecx
1348
	inc	ecx
1390
    @@: dec	ecx
1349
    @@: dec	ecx
1391
	jz	@f
1350
	jz	@f
Line 1412... Line 1371...
1412
	dec	eax
1371
	dec	eax
1413
	jmp	@f
1372
	jmp	@f
1414
  .lp2: xor	eax,eax
1373
  .lp2: xor	eax,eax
1415
    @@: mov	edx,edi
1374
    @@: mov	edx,edi
1416
	add	edi,4
1375
	add	edi,4
1417
	mov	[cur_editor.Caret.X],eax ;! [pos.x],eax
1376
	mov	[cur_editor.Caret.X],eax
1418
	jecxz	@f
1377
	jecxz	@f
1419
	push	ecx
1378
	push	ecx
1420
	mov	ecx,eax
1379
	mov	ecx,eax
1421
	mov	al,' '
1380
	mov	al,' '
1422
	rep	stosb
1381
	rep	stosb
Line 1430... Line 1389...
1430
	lea	eax,[edi-4]
1389
	lea	eax,[edi-4]
1431
	sub	eax,edx
1390
	sub	eax,edx
1432
	or	eax,0x00010000
1391
	or	eax,0x00010000
1433
	mov	[edx],eax
1392
	mov	[edx],eax
Line 1434... Line 1393...
1434
 
1393
 
1435
	mov	ecx,edi ;! [edi-AREA_TEMP]
1394
	mov	ecx,edi
Line 1436... Line 1395...
1436
	sub	ecx,[temp_buf]
1395
	sub	ecx,[temp_buf]
1437
 
1396
 
1438
	push	ecx
1397
	push	ecx
1439
	mov	edi,[cur_editor.Lines] ;! AREA_TEMP2
1398
	mov	edi,[cur_editor.Lines]
1440
	add	edi,[edi-4]
1399
	add	edi,[edi-4]
1441
	dec	edi
1400
	dec	edi
1442
	lea	esi,[edi+4]
1401
	lea	esi,[edi+4]
1443
	sub	esi,ecx
1402
	sub	esi,ecx
1444
	movzx	ecx,word[ebp]
1403
	movzx	ecx,word[ebp]
1445
	add	esi,ecx;[ebp]
1404
	add	esi,ecx
1446
	lea	ecx,[esi-4]
1405
	lea	ecx,[esi-4]
1447
	sub	ecx,ebp
1406
	sub	ecx,ebp
1448
	std
1407
	std
1449
	cmp	esi,edi
1408
	cmp	esi,edi
1450
	jb	@f
1409
	jb	@f
1451
	je	.lp3
1410
	je	.lp3
1452
	lea	esi,[ebp+4]
1411
	lea	esi,[ebp+4]
1453
	mov	eax,[esp]
1412
	mov	eax,[esp]
1454
	lea	edi,[esi+eax-4]
1413
	lea	edi,[esi+eax-4]
1455
	movzx	ecx,word[ebp]
1414
	movzx	ecx,word[ebp]
1456
	add	esi,ecx;[ebp]
1415
	add	esi,ecx
1457
	mov	ecx,[cur_editor.Lines] ;! AREA_TEMP2
1416
	mov	ecx,[cur_editor.Lines]
1458
	add	ecx,[ecx-4]
1417
	add	ecx,[ecx-4]
1459
	sub	ecx,esi
1418
	sub	ecx,esi
1460
	cld
1419
	cld
1461
    @@: rep	movsb
1420
    @@: rep	movsb
1462
  .lp3: pop	ecx
1421
  .lp3: pop	ecx
1463
	mov	esi,[temp_buf] ;! AREA_TEMP
1422
	mov	esi,[temp_buf]
1464
	mov	edi,ebp
1423
	mov	edi,ebp
Line 1465... Line 1424...
1465
	cld
1424
	cld
1466
	rep	movsb
1425
	rep	movsb
1467
 
1426
 
Line 1468... Line 1427...
1468
	inc	[cur_editor.Caret.Y] ;! [pos.y]
1427
	inc	[cur_editor.Caret.Y]
Line 1469... Line -...
1469
	inc	[cur_editor.SelStart.Y] ;! [sel.y]
-
 
1470
	inc	[cur_editor.Lines.Count] ;! [lines]
1428
	inc	[cur_editor.SelStart.Y]
Line 1471... Line 1429...
1471
 
1429
	inc	[cur_editor.Lines.Count]
1472
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
1430
 
1473
 
1431
	m2m	[cur_editor.SelStart.X],[cur_editor.Caret.X]
Line 1498... Line 1456...
1498
    @@: call	set_cur_tab
1456
    @@: call	set_cur_tab
1499
	call	make_tab_visible
1457
	call	make_tab_visible
1500
	call	align_editor_in_tab
1458
	call	align_editor_in_tab
1501
	call	draw_editor
1459
	call	draw_editor
1502
	call	draw_tabctl
1460
	call	draw_tabctl
-
 
1461
	call	update_caption
1503
  .exit:
1462
  .exit:
1504
	ret
1463
	ret
1505
endf
1464
endf
Line 1506... Line 1465...
1506
 
1465
 
Line 1525... Line 1484...
1525
    @@: call	set_cur_tab
1484
    @@: call	set_cur_tab
1526
	call	make_tab_visible
1485
	call	make_tab_visible
1527
	call	align_editor_in_tab
1486
	call	align_editor_in_tab
1528
	call	draw_editor
1487
	call	draw_editor
1529
	call	draw_tabctl
1488
	call	draw_tabctl
-
 
1489
	call	update_caption
1530
  .exit:
1490
  .exit:
1531
	ret
1491
	ret
1532
endf
1492
endf
Line 1533... Line 1493...
1533
 
1493
 
1534
;-----------------------------------------------------------------------------
1494
;-----------------------------------------------------------------------------
1535
func key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
1495
func key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
1536
;-----------------------------------------------------------------------------
1496
;-----------------------------------------------------------------------------
1537
	mov	ebp,[tab_bar.Current.Ptr]
1497
	mov	[do_not_draw],1
1538
	call	delete_tab
1498
	push	[tab_bar.Current.Ptr]
1539
	cmp	[tab_bar.Items.Count],0
1499
	cmp	[tab_bar.Items.Count],1
1540
	jne	@f
1500
	jne	@f
1541
	call	create_tab
1501
	call	create_tab
-
 
1502
    @@: pop	ebp
-
 
1503
	call	delete_tab
-
 
1504
	dec	[do_not_draw]
-
 
1505
	call	align_editor_in_tab
-
 
1506
	call	draw_editor
-
 
1507
	call	draw_tabctl
-
 
1508
	call	draw_statusbar
1542
    @@: ret
1509
	ret
Line 1543... Line 1510...
1543
endf
1510
endf
1544
 
1511
 
1545
;-----------------------------------------------------------------------------
1512
;-----------------------------------------------------------------------------
Line 1557... Line 1524...
1557
	call	align_editor_in_tab
1524
	call	align_editor_in_tab
1558
	call	draw_editor
1525
	call	draw_editor
1559
    @@: call	draw_tabctl
1526
    @@: call	draw_tabctl
1560
	ret
1527
	ret
1561
endf
1528
endf
-
 
1529
 
-
 
1530
;-----------------------------------------------------------------------------
-
 
1531
func key.f3 ;///// FIND NEXT MATCH ///////////////////////////////////////////
-
 
1532
;-----------------------------------------------------------------------------
-
 
1533
	call	search
-
 
1534
	jc	@f
-
 
1535
    @@: ret
-
 
1536
endf
-
 
1537
 
-
 
1538
;-----------------------------------------------------------------------------
-
 
1539
func key.f9 ;///// COMPILE AND RUN ///////////////////////////////////////////
-
 
1540
;-----------------------------------------------------------------------------
-
 
1541
	mov	bl,1
-
 
1542
	call	start_fasm
-
 
1543
	ret
-
 
1544
endf
-
 
1545
 
-
 
1546
;-----------------------------------------------------------------------------
-
 
1547
func key.ctrl_f9 ;///// COMPILE //////////////////////////////////////////////
-
 
1548
;-----------------------------------------------------------------------------
-
 
1549
	mov	bl,0
-
 
1550
	call	start_fasm
-
 
1551
	ret
-
 
1552
endf
-
 
1553
 
-
 
1554
;-----------------------------------------------------------------------------
-
 
1555
func key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
-
 
1556
;-----------------------------------------------------------------------------
-
 
1557
	mov	esi,self_path
-
 
1558
	mov	byte[esi+PATHL-1],0
-
 
1559
	mov	edi,f_info.path
-
 
1560
	cld
-
 
1561
    @@: lodsb
-
 
1562
	stosb
-
 
1563
	or	al,al
-
 
1564
	jnz	@b
-
 
1565
 
-
 
1566
	mov	[f_info70+0],2
-
 
1567
	mov	[f_info70+4],0
-
 
1568
	mov	[f_info70+8],0
-
 
1569
	mov	[f_info70+12],TINYPAD_END
-
 
1570
	mov	[f_info70+16],0
-
 
1571
	mov	byte[f_info70+20],0
-
 
1572
	mov	[f_info70+21],f_info.path
-
 
1573
	mcall	70,f_info70
-
 
1574
 
-
 
1575
  .close:
-
 
1576
	mov	[main_closed],1
-
 
1577
	mcall	-1
-
 
1578
endf