Subversion Repositories Kolibri OS

Rev

Rev 3357 | Rev 4274 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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