2008-07-16 08:55:19 +04:00
|
|
|
diff16 'tp-key.asm',0,$
|
|
|
|
|
2006-10-12 00:40:53 +04:00
|
|
|
key:
|
|
|
|
mov ecx,1
|
|
|
|
mcall 66,3
|
2008-07-18 01:41:30 +04:00
|
|
|
mov [shi],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
xor ebx,ebx
|
|
|
|
test al,0x03
|
|
|
|
jz @f
|
|
|
|
or ebx,KM_SHIFT
|
|
|
|
@@: test al,0x0C
|
|
|
|
jz @f
|
|
|
|
or ebx,KM_CTRL
|
|
|
|
@@: test al,0x30
|
|
|
|
jz @f
|
|
|
|
or ebx,KM_ALT
|
2008-07-18 01:41:30 +04:00
|
|
|
@@: mov edx,ebx
|
2006-10-12 00:40:53 +04:00
|
|
|
test al,0x03
|
|
|
|
jz @f
|
|
|
|
inc cl
|
2008-07-18 01:41:30 +04:00
|
|
|
@@:
|
2006-10-12 00:40:53 +04:00
|
|
|
mcall 2
|
|
|
|
cmp al,0
|
|
|
|
jne still.skip_write
|
|
|
|
shr eax,8
|
2012-04-20 19:41:25 +04:00
|
|
|
;--------------------------------------
|
2013-03-08 21:26:40 +04:00
|
|
|
; this code for Win-keys, works with
|
|
|
|
; kernel SVN r.3356 or later
|
|
|
|
test [shi],0x200 ; LWin
|
|
|
|
jnz still.skip_write
|
|
|
|
test [shi],0x400 ; RWin
|
|
|
|
jnz still.skip_write
|
2012-04-20 19:41:25 +04:00
|
|
|
;--------------------------------------
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp al,224
|
|
|
|
jne @f
|
|
|
|
mov [ext],0x01
|
|
|
|
jmp still.skip_write
|
|
|
|
@@: cmp al,225
|
|
|
|
jne @f
|
|
|
|
mov [ext],0x02
|
|
|
|
jmp still.skip_write
|
|
|
|
@@:
|
|
|
|
mov ah,[ext]
|
|
|
|
mov [ext],0
|
|
|
|
|
2008-07-18 01:41:30 +04:00
|
|
|
mov esi,numpad_table_off
|
|
|
|
test [shi], 0x00000080 ; NumLock is on?
|
|
|
|
jz .num
|
|
|
|
mov esi,numpad_table_on
|
|
|
|
.num: cmp eax,[esi]
|
|
|
|
jne @f
|
|
|
|
mov eax,[esi+4]
|
|
|
|
mov ebx,eax
|
|
|
|
or eax,edx
|
|
|
|
shr ebx,8
|
|
|
|
or ebx,0x0000FFFF
|
|
|
|
and eax,ebx
|
|
|
|
mov ecx,eax
|
|
|
|
shr ecx,16
|
|
|
|
and cl,1
|
|
|
|
inc cl
|
|
|
|
jmp .lp0
|
|
|
|
@@: add esi,8
|
|
|
|
cmp dword[esi],0
|
|
|
|
jne .num
|
|
|
|
|
|
|
|
or eax,edx
|
|
|
|
|
|
|
|
.lp0: test al,0x80
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz still.skip_write
|
2011-09-12 03:31:31 +04:00
|
|
|
;--------------------------------------
|
|
|
|
; it is CAPS LOCK correct processing for chars
|
|
|
|
test [shi], 0x00000040 ; CAPS LOCK is on?
|
|
|
|
jz .no_caps_lock
|
|
|
|
cmp ecx,1
|
|
|
|
jnz @f
|
|
|
|
inc ecx
|
|
|
|
jmp .no_caps_lock
|
|
|
|
@@:
|
|
|
|
cmp ecx,2
|
|
|
|
jnz .no_caps_lock
|
|
|
|
dec ecx
|
|
|
|
.no_caps_lock:
|
|
|
|
;--------------------------------------
|
2008-07-18 01:41:30 +04:00
|
|
|
push eax
|
|
|
|
mcall 26,2,,key1
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
mov [chr],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
cmp [bot_mode],0
|
|
|
|
je @f
|
|
|
|
mov ebx,eax
|
|
|
|
mov al,2
|
|
|
|
call [bot_dlg_handler]
|
2010-06-06 18:34:10 +04:00
|
|
|
jmp still.skip_write
|
2006-10-12 00:40:53 +04:00
|
|
|
@@:
|
|
|
|
|
2007-01-10 09:03:39 +03:00
|
|
|
mov esi,accel_table_main
|
2006-10-12 00:40:53 +04:00
|
|
|
.acc: cmp eax,[esi]
|
|
|
|
jne @f
|
2008-12-29 22:08:59 +03:00
|
|
|
test [secure_sel],1
|
2006-10-12 00:40:53 +04:00
|
|
|
jz .lp1
|
2007-01-28 02:36:07 +03:00
|
|
|
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
.lp1: mov [s_status],0
|
|
|
|
call dword[esi+4]
|
2007-01-28 02:36:07 +03:00
|
|
|
call editor_check_for_changes
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp still
|
|
|
|
@@: add esi,8
|
2008-07-18 01:41:30 +04:00
|
|
|
cmp dword[esi],0
|
2006-10-12 00:40:53 +04:00
|
|
|
jne .acc
|
|
|
|
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_CTRLALT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz still.skip_write
|
|
|
|
|
|
|
|
mov [s_status],0
|
|
|
|
|
2008-07-18 01:41:30 +04:00
|
|
|
movzx eax,byte[chr]
|
2006-10-12 00:40:53 +04:00
|
|
|
movzx eax,[eax+key0]
|
|
|
|
or al,al
|
|
|
|
jz still.skip_write
|
|
|
|
movzx eax,[eax+key1]
|
|
|
|
push eax
|
|
|
|
|
2008-12-29 22:08:59 +03:00
|
|
|
test [secure_sel],1
|
2006-10-12 00:40:53 +04:00
|
|
|
jz .lp2
|
2007-01-28 02:36:07 +03:00
|
|
|
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp .put
|
|
|
|
.lp2: call delete_selection
|
|
|
|
|
2008-12-29 22:08:59 +03:00
|
|
|
test [auto_braces],1
|
2006-10-12 00:40:53 +04:00
|
|
|
jz .put
|
|
|
|
cmp al,'['
|
|
|
|
jne @f
|
|
|
|
mov al,']'
|
|
|
|
call .lp3
|
2007-01-28 02:36:07 +03:00
|
|
|
dec [cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp .put
|
|
|
|
@@: cmp al,'('
|
|
|
|
jne @f
|
|
|
|
mov al,')'
|
|
|
|
call .lp3
|
2007-01-28 02:36:07 +03:00
|
|
|
dec [cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp .put
|
|
|
|
@@: cmp al,'{'
|
|
|
|
jne .put
|
|
|
|
mov al,'}'
|
|
|
|
call .lp3
|
2007-01-28 02:36:07 +03:00
|
|
|
dec [cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.put: pop eax
|
2007-01-28 02:36:07 +03:00
|
|
|
push still editor_check_for_changes
|
|
|
|
inc [cur_editor.SelStart.X]
|
|
|
|
.lp3: push [cur_editor.Caret.X] eax
|
2006-10-12 00:40:53 +04:00
|
|
|
inc dword[esp+4]
|
|
|
|
mov eax,1
|
|
|
|
jmp key.tab.direct
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
xor eax,eax
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.X],eax
|
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
mov ecx,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec ecx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.Y],ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
|
|
|
call get_real_length
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.X],eax
|
|
|
|
call draw_editor
|
2006-10-12 00:40:53 +04:00
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_o ;///// ENTER OPEN FILENAME ///////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-18 04:41:58 +04:00
|
|
|
mov [bot_mode2],0
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.direct:
|
2007-09-18 04:41:58 +04:00
|
|
|
cmp [bot_mode2], 2
|
2007-07-29 06:06:58 +04:00
|
|
|
je .ask
|
2006-10-12 00:40:53 +04:00
|
|
|
mov [s_status],s_enter_filename
|
2007-07-29 06:06:58 +04:00
|
|
|
jmp .ask1
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-07-29 06:06:58 +04:00
|
|
|
.ask:
|
|
|
|
mov [s_status],s_ask_save
|
|
|
|
.ask1:
|
2006-10-12 00:40:53 +04:00
|
|
|
mov [bot_mode],1
|
|
|
|
mov [bot_dlg_height],16*2+4*2-1
|
|
|
|
mov [bot_dlg_handler],osdlg_handler
|
|
|
|
mov [focused_tb],tb_opensave
|
|
|
|
|
|
|
|
@@: mov al,[tb_opensave.length]
|
|
|
|
mov [tb_opensave.pos.x],al
|
|
|
|
mov [tb_opensave.sel.x],0
|
2007-01-10 09:03:39 +03:00
|
|
|
mov [tb_casesen],0;1
|
2006-10-12 00:40:53 +04:00
|
|
|
call drawwindow
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-07-29 06:06:58 +04:00
|
|
|
cmp [cur_editor.FilePath], 0
|
|
|
|
je key.shift_ctrl_s
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp [cur_editor.Modified],0
|
2006-10-12 00:40:53 +04:00
|
|
|
je .exit
|
|
|
|
call save_file
|
|
|
|
call drawwindow
|
|
|
|
.exit:
|
|
|
|
ret
|
|
|
|
|
|
|
|
key.shift_ctrl_s:
|
2007-09-18 04:41:58 +04:00
|
|
|
mov [bot_mode2],1
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp key.ctrl_o.direct
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_n ;///// CREATE NEW FILE (TAB) /////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-03 21:22:05 +03:00
|
|
|
call create_tab
|
2006-10-12 00:40:53 +04:00
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_f ;///// ENTER KEYWORD TO FIND /////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-18 04:41:58 +04:00
|
|
|
mov [bot_mode2],0
|
2006-10-12 00:40:53 +04:00
|
|
|
mov [bot_dlg_height],16*2+4*2-1
|
|
|
|
|
|
|
|
mov [s_status],s_enter_text_to_find
|
|
|
|
|
|
|
|
.direct:
|
|
|
|
mov [bot_mode],1
|
|
|
|
mov [bot_dlg_handler],finddlg_handler
|
|
|
|
mov [focused_tb],tb_find
|
|
|
|
|
|
|
|
mov ecx,[s_search.size]
|
|
|
|
mov [tb_find.length],cl
|
|
|
|
jecxz @f
|
|
|
|
mov esi,s_search
|
|
|
|
mov edi,tb_find.text
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
@@: mov al,[tb_find.length]
|
|
|
|
mov [tb_find.pos.x],al
|
|
|
|
mov [tb_find.sel.x],0
|
|
|
|
mov [tb_casesen],0
|
|
|
|
call drawwindow
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_h
|
2007-09-18 04:41:58 +04:00
|
|
|
mov [bot_mode2],1
|
2006-10-12 00:40:53 +04:00
|
|
|
mov [bot_dlg_height],16*3+4*2+1
|
|
|
|
|
|
|
|
mov [s_status],s_enter_text_to_replace
|
|
|
|
|
|
|
|
jmp key.ctrl_f.direct
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_g
|
2006-10-12 00:40:53 +04:00
|
|
|
ret
|
2007-01-28 02:36:07 +03:00
|
|
|
@^
|
2007-09-18 04:41:58 +04:00
|
|
|
mov [bot_mode2],0
|
2006-10-12 00:40:53 +04:00
|
|
|
mov [bot_dlg_height],16*2+4*2-1
|
|
|
|
|
|
|
|
mov [bot_mode],1
|
|
|
|
mov [bot_dlg_handler],gotodlg_handler
|
|
|
|
mov [focused_tb],tb_gotorow
|
|
|
|
|
|
|
|
mov al,[tb_gotorow.length]
|
|
|
|
mov [tb_gotorow.pos.x],al
|
|
|
|
mov [tb_gotorow.sel.x],0
|
|
|
|
mov [tb_casesen],0
|
|
|
|
call drawwindow
|
|
|
|
ret
|
2007-01-28 02:36:07 +03:00
|
|
|
^@
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ebx,[cur_editor.Caret.Y]
|
|
|
|
mov edx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
cld
|
|
|
|
mov ecx,ebx
|
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
.lp1: cmp edx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
jle @f
|
2008-12-29 22:08:59 +03:00
|
|
|
mov edx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: dec edx
|
|
|
|
jl .nx1
|
2008-12-29 22:08:59 +03:00
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
add esi,edx
|
|
|
|
mov ecx,edx
|
|
|
|
@@: push ecx
|
|
|
|
mov edi,symbols_ex
|
|
|
|
mov ecx,symbols_ex.size+symbols.size
|
|
|
|
mov al,[esi]
|
|
|
|
dec esi
|
|
|
|
repne scasb
|
|
|
|
pop ecx
|
|
|
|
jne @f
|
|
|
|
dec edx
|
|
|
|
dec ecx
|
|
|
|
jnz @b
|
|
|
|
.nx1: dec ebx
|
|
|
|
js .exit.2
|
|
|
|
mov ecx,ebx
|
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
mov edx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec edx
|
|
|
|
jmp .lp1
|
|
|
|
@@:
|
|
|
|
mov ecx,ebx
|
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
.lp2: cmp edx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
jle @f
|
2008-12-29 22:08:59 +03:00
|
|
|
mov edx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: or edx,edx
|
|
|
|
jl .nx2
|
2008-12-29 22:08:59 +03:00
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
add esi,edx
|
|
|
|
@@: mov edi,symbols_ex
|
|
|
|
mov ecx,symbols_ex.size+symbols.size
|
|
|
|
mov al,[esi]
|
|
|
|
dec esi
|
|
|
|
repne scasb
|
|
|
|
je @f
|
|
|
|
dec edx
|
|
|
|
jns @b
|
|
|
|
jmp @f
|
|
|
|
.nx2: dec ebx
|
|
|
|
js .exit.2
|
|
|
|
mov ecx,ebx
|
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
mov edx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec edx
|
|
|
|
jmp .lp2
|
|
|
|
@@:
|
|
|
|
inc edx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.Y],ebx
|
|
|
|
mov [cur_editor.Caret.X],edx
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],ebx
|
|
|
|
mov [cur_editor.SelStart.X],edx
|
|
|
|
@@: sub ebx,[cur_editor.TopLeft.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
jge @f
|
2007-01-28 02:36:07 +03:00
|
|
|
add [cur_editor.TopLeft.Y],ebx
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: mov eax,edx
|
2007-01-28 02:36:07 +03:00
|
|
|
sub eax,[cur_editor.TopLeft.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp eax,[columns.scr]
|
|
|
|
jl @f
|
|
|
|
sub eax,[columns.scr]
|
|
|
|
inc eax
|
2007-01-28 02:36:07 +03:00
|
|
|
add [cur_editor.TopLeft.X],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp .exit
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: cmp edx,[cur_editor.TopLeft.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
jge .exit
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.TopLeft.X],edx
|
2006-10-12 00:40:53 +04:00
|
|
|
.exit:
|
2007-01-28 02:36:07 +03:00
|
|
|
call editor_check_for_changes
|
2006-10-12 00:40:53 +04:00
|
|
|
.exit.2:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ebx,[cur_editor.Caret.Y]
|
|
|
|
mov edx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
cld
|
|
|
|
.lp1: mov ecx,ebx
|
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
mov ecx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp edx,ecx
|
|
|
|
jge .nx1
|
2008-12-29 22:08:59 +03:00
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
add esi,edx
|
|
|
|
sub ecx,edx
|
|
|
|
@@: push ecx
|
|
|
|
mov edi,symbols_ex
|
|
|
|
mov ecx,symbols_ex.size+symbols.size
|
|
|
|
lodsb
|
|
|
|
repne scasb
|
|
|
|
pop ecx
|
|
|
|
je @f
|
|
|
|
inc edx
|
|
|
|
dec ecx
|
|
|
|
jnz @b
|
|
|
|
.nx1: inc ebx
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp ebx,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jge .exit.2
|
|
|
|
xor edx,edx
|
|
|
|
jmp .lp1
|
|
|
|
@@:
|
|
|
|
|
|
|
|
.lp2: mov ecx,ebx
|
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
mov ecx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp edx,ecx
|
|
|
|
jge .nx2
|
2008-12-29 22:08:59 +03:00
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
add esi,edx
|
|
|
|
sub ecx,edx
|
|
|
|
@@: push ecx
|
|
|
|
mov edi,symbols_ex
|
|
|
|
mov ecx,symbols_ex.size+symbols.size
|
|
|
|
lodsb
|
|
|
|
repne scasb
|
|
|
|
pop ecx
|
|
|
|
jne @f
|
|
|
|
inc edx
|
|
|
|
dec ecx
|
|
|
|
jnz @b
|
|
|
|
.nx2: inc ebx
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp ebx,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jge .exit.2
|
|
|
|
xor edx,edx
|
|
|
|
jmp .lp2
|
|
|
|
@@:
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.Y],ebx
|
|
|
|
mov [cur_editor.Caret.X],edx
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],ebx
|
|
|
|
mov [cur_editor.SelStart.X],edx
|
|
|
|
@@: sub ebx,[cur_editor.TopLeft.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp ebx,[lines.scr]
|
|
|
|
jl @f
|
|
|
|
sub ebx,[lines.scr]
|
|
|
|
inc ebx
|
2007-01-28 02:36:07 +03:00
|
|
|
add [cur_editor.TopLeft.Y],ebx
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: mov eax,edx
|
2007-01-28 02:36:07 +03:00
|
|
|
sub eax,[cur_editor.TopLeft.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp eax,[columns.scr]
|
|
|
|
jl @f
|
|
|
|
sub eax,[columns.scr]
|
|
|
|
inc eax
|
2007-01-28 02:36:07 +03:00
|
|
|
add [cur_editor.TopLeft.X],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp .exit
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: cmp edx,[cur_editor.TopLeft.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
jge .exit
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.TopLeft.X],edx
|
2006-10-12 00:40:53 +04:00
|
|
|
.exit:
|
2007-01-28 02:36:07 +03:00
|
|
|
call editor_check_for_changes
|
2006-10-12 00:40:53 +04:00
|
|
|
.exit.2:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_x
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp [sel.selected],0
|
|
|
|
je @f
|
|
|
|
call key.ctrl_c
|
|
|
|
call key.del
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_c
|
2006-10-12 00:40:53 +04:00
|
|
|
mov [copy_size],0
|
|
|
|
cmp [sel.selected],0
|
|
|
|
je .exit
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
call get_selection_size
|
2007-09-02 01:38:00 +04:00
|
|
|
stdcall mem.ReAlloc,[copy_buf],eax
|
2007-01-03 21:22:05 +03:00
|
|
|
mov [copy_buf],eax
|
|
|
|
|
2006-10-12 00:40:53 +04:00
|
|
|
cld
|
|
|
|
mov eax,[sel.begin.y]
|
|
|
|
cmp eax,[sel.end.y]
|
|
|
|
je .single_line
|
|
|
|
mov ecx,[sel.begin.y]
|
|
|
|
call get_line_offset
|
|
|
|
inc ecx
|
|
|
|
push ecx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov edi,[copy_buf]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_real_length
|
|
|
|
sub eax,[sel.begin.x]
|
|
|
|
jge @f
|
|
|
|
xor eax,eax
|
|
|
|
@@: add esi,[sel.begin.x]
|
2008-12-29 22:08:59 +03:00
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
|
|
|
mov [edi+EDITOR_LINE_DATA.Size],eax
|
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
mov ecx,eax
|
|
|
|
jecxz @f
|
|
|
|
rep movsb
|
|
|
|
@@: mov ecx,[sel.end.y]
|
|
|
|
call get_line_offset
|
|
|
|
pop ecx
|
|
|
|
cmp ecx,[sel.end.y]
|
|
|
|
je @f
|
|
|
|
mov eax,esi
|
|
|
|
call get_line_offset
|
|
|
|
sub eax,esi
|
|
|
|
mov ecx,eax
|
|
|
|
rep movsb
|
|
|
|
mov ecx,[sel.end.y]
|
|
|
|
@@: call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi+EDITOR_LINE_DATA.Size]
|
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp eax,[sel.end.x]
|
|
|
|
jle @f
|
|
|
|
mov eax,[sel.end.x]
|
|
|
|
@@: mov ebx,edi
|
2008-12-29 22:08:59 +03:00
|
|
|
mov [edi+EDITOR_LINE_DATA.Size],eax
|
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
mov ecx,eax
|
|
|
|
jecxz @f
|
|
|
|
rep movsb
|
|
|
|
sub eax,[sel.end.x]
|
|
|
|
jz @f
|
|
|
|
neg eax
|
|
|
|
mov ecx,eax
|
|
|
|
add [ebx],eax
|
|
|
|
mov al,' '
|
|
|
|
rep stosb
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: sub edi,[copy_buf]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov [copy_size],edi
|
|
|
|
mov eax,[sel.end.y]
|
|
|
|
sub eax,[sel.begin.y]
|
|
|
|
inc eax
|
|
|
|
mov [copy_count],eax
|
|
|
|
.exit:
|
|
|
|
ret
|
|
|
|
|
|
|
|
.single_line:
|
|
|
|
mov eax,[sel.end.x]
|
|
|
|
sub eax,[sel.begin.x]
|
2007-01-28 02:36:07 +03:00
|
|
|
mov edi,[copy_buf]
|
2008-12-29 22:08:59 +03:00
|
|
|
mov [edi+EDITOR_LINE_DATA.Size],eax
|
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
mov ecx,[sel.begin.y]
|
|
|
|
call get_line_offset
|
|
|
|
mov ebx,[sel.begin.x]
|
|
|
|
mov ecx,[sel.end.x]
|
2008-12-29 22:08:59 +03:00
|
|
|
cmp ebx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
jge .add_spaces
|
2008-12-29 22:08:59 +03:00
|
|
|
cmp ecx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
jle .lp1
|
2008-12-29 22:08:59 +03:00
|
|
|
mov ecx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
.lp1: sub ecx,[sel.begin.x]
|
|
|
|
sub eax,ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
lea esi,[esi+ebx+sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
rep movsb
|
|
|
|
|
|
|
|
.add_spaces:
|
|
|
|
mov ecx,eax
|
|
|
|
mov al,' '
|
|
|
|
jecxz @b
|
|
|
|
rep stosb
|
|
|
|
jmp @b
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_v
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp [copy_size],0
|
|
|
|
je .exit
|
|
|
|
|
|
|
|
call delete_selection
|
|
|
|
|
2007-01-19 00:14:15 +03:00
|
|
|
mov eax,[copy_size]
|
|
|
|
call editor_realloc_lines
|
|
|
|
|
|
|
|
mov ebx,[cur_editor.Lines.Size]
|
|
|
|
add ebx,[copy_size]
|
|
|
|
mov [cur_editor.Lines.Size],ebx
|
2007-09-02 01:38:00 +04:00
|
|
|
stdcall mem.ReAlloc,[cur_editor.Lines],ebx
|
2007-01-19 00:14:15 +03:00
|
|
|
mov [cur_editor.Lines],eax
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
pushd [esi+EDITOR_LINE_DATA.Size] esi
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
call line_add_spaces
|
2007-01-28 02:36:07 +03:00
|
|
|
add [esp],eax
|
|
|
|
add esi,eax
|
2006-10-12 00:40:53 +04:00
|
|
|
mov ecx,[copy_size]
|
2008-12-29 22:08:59 +03:00
|
|
|
sub ecx,sizeof.EDITOR_LINE_DATA
|
2007-01-28 02:36:07 +03:00
|
|
|
mov edi,[cur_editor.Lines]
|
2008-07-16 08:55:19 +04:00
|
|
|
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
|
2007-01-03 21:22:05 +03:00
|
|
|
dec edi
|
2006-10-12 00:40:53 +04:00
|
|
|
mov eax,esi
|
|
|
|
mov esi,edi
|
|
|
|
sub esi,ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
lea ecx,[eax+sizeof.EDITOR_LINE_DATA]
|
2007-01-28 02:36:07 +03:00
|
|
|
add ecx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
neg ecx
|
|
|
|
lea ecx,[esi+ecx+1]
|
|
|
|
std
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
mov ecx,[copy_count]
|
|
|
|
dec ecx
|
|
|
|
jz .single_line
|
|
|
|
|
|
|
|
cld
|
|
|
|
pop edi
|
2008-12-29 22:08:59 +03:00
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2007-01-28 02:36:07 +03:00
|
|
|
mov esi,[copy_buf]
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi+EDITOR_LINE_DATA.Size]
|
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ebx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
add eax,ebx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],eax
|
|
|
|
mov [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
2006-10-12 00:40:53 +04:00
|
|
|
sub eax,ebx
|
|
|
|
call .check_columns
|
|
|
|
add edi,ebx
|
|
|
|
@@: push ecx
|
|
|
|
mov ecx,eax
|
|
|
|
rep movsb
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi+EDITOR_LINE_DATA.Size]
|
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
|
|
|
mov [edi+EDITOR_LINE_DATA.Size],eax
|
|
|
|
mov [edi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
pop ecx
|
|
|
|
loop @b
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
sub ecx,ebx
|
2008-12-29 22:08:59 +03:00
|
|
|
add [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
call .check_columns
|
|
|
|
mov ecx,eax
|
|
|
|
rep movsb
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.X],eax
|
|
|
|
mov [cur_editor.SelStart.X],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
mov eax,[copy_count]
|
|
|
|
dec eax
|
2007-01-28 02:36:07 +03:00
|
|
|
add [cur_editor.Caret.Y],eax
|
|
|
|
add [cur_editor.SelStart.Y],eax
|
|
|
|
add [cur_editor.Lines.Count],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp .exit
|
|
|
|
|
|
|
|
.single_line:
|
|
|
|
cld
|
|
|
|
pop edi
|
2008-12-29 22:08:59 +03:00
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2007-01-28 02:36:07 +03:00
|
|
|
mov esi,[copy_buf]
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi+EDITOR_LINE_DATA.Size]
|
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
|
|
|
add [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],eax
|
|
|
|
and [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
|
|
|
|
or [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
2006-10-12 00:40:53 +04:00
|
|
|
call .check_columns
|
2007-01-28 02:36:07 +03:00
|
|
|
add edi,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
add esp,4
|
|
|
|
mov ecx,eax
|
|
|
|
rep movsb
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
add [cur_editor.Caret.X],eax
|
|
|
|
add [cur_editor.SelStart.X],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
|
|
|
|
|
|
|
.check_columns:
|
|
|
|
push eax
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Columns.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jbe @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Columns.Count],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: pop eax
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,90+sizeof.EDITOR_LINE_DATA
|
2007-01-19 00:14:15 +03:00
|
|
|
call editor_realloc_lines
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
|
|
|
mov ebx,esi
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
lea edi,[esi+90+sizeof.EDITOR_LINE_DATA]
|
|
|
|
lea ecx,[esi+sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub ecx,ebx
|
|
|
|
std
|
|
|
|
rep movsb
|
|
|
|
|
2008-12-29 22:08:59 +03:00
|
|
|
lea edi,[ebx+sizeof.EDITOR_LINE_DATA+1]
|
|
|
|
mov [ebx+EDITOR_LINE_DATA.Size],90
|
2006-10-12 00:40:53 +04:00
|
|
|
mov al,ASEPC
|
|
|
|
mov ecx,79
|
|
|
|
cld
|
|
|
|
rep stosb
|
|
|
|
mov al,' '
|
|
|
|
mov ecx,10
|
|
|
|
rep stosb
|
2008-12-29 22:08:59 +03:00
|
|
|
mov byte[ebx+sizeof.EDITOR_LINE_DATA],';'
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
inc [cur_editor.Lines.Count]
|
|
|
|
inc [cur_editor.Caret.Y]
|
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
inc eax
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jge .exit
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
|
|
|
mov edi,esi
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi+EDITOR_LINE_DATA.Size]
|
|
|
|
lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA]
|
2007-01-19 00:14:15 +03:00
|
|
|
push eax
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
dec [cur_editor.Lines.Count]
|
2007-01-19 00:14:15 +03:00
|
|
|
mov ecx,[cur_editor.Lines]
|
2008-07-16 08:55:19 +04:00
|
|
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub ecx,esi
|
2007-01-28 02:36:07 +03:00
|
|
|
shr ecx,2
|
2006-10-12 00:40:53 +04:00
|
|
|
cld
|
|
|
|
rep movsd
|
2007-01-19 00:14:15 +03:00
|
|
|
|
|
|
|
pop eax
|
2008-12-29 22:08:59 +03:00
|
|
|
add eax,sizeof.EDITOR_LINE_DATA
|
2007-01-19 00:14:15 +03:00
|
|
|
neg eax
|
|
|
|
call editor_realloc_lines
|
|
|
|
|
|
|
|
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.up ;///// GO TO PREVIOUS LINE ///////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec eax
|
|
|
|
jns @f
|
|
|
|
xor eax,eax
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: mov ecx,[cur_editor.TopLeft.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp eax,ecx
|
|
|
|
jae @f
|
|
|
|
dec ecx
|
|
|
|
jns @f
|
|
|
|
xor ecx,ecx
|
2008-07-18 01:41:30 +04:00
|
|
|
@@: test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
@@: mov [cur_editor.Caret.Y],eax
|
|
|
|
mov [cur_editor.TopLeft.Y],ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.down ;///// GO TO NEXT LINE /////////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
inc eax
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jb @f
|
|
|
|
dec eax
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: mov ecx,[cur_editor.TopLeft.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov edx,eax
|
|
|
|
sub edx,ecx
|
|
|
|
cmp edx,[lines.scr]
|
|
|
|
jb @f
|
|
|
|
inc ecx
|
2008-07-18 01:41:30 +04:00
|
|
|
@@: test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
@@: mov [cur_editor.Caret.Y],eax
|
|
|
|
mov [cur_editor.TopLeft.Y],ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.left ;///// GO TO PREVIOUS CHAR /////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec eax
|
|
|
|
jns @f
|
|
|
|
inc eax
|
2008-07-18 01:41:30 +04:00
|
|
|
@@: test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.X],eax
|
|
|
|
@@: mov [cur_editor.Caret.X],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.right ;///// GO TO NEXT CHAR ////////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
inc eax
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Columns.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jbe @f
|
|
|
|
dec eax
|
2008-07-18 01:41:30 +04:00
|
|
|
@@: test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.X],eax
|
|
|
|
@@: mov [cur_editor.Caret.X],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.pgup ;///// GO TO PREVIOUS PAGE /////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_pgup: ;///// GO TO PREVIOUS PAGE, WITH SELECTION //////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
mov edx,[lines.scr]
|
|
|
|
dec edx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.Y]
|
|
|
|
mov ecx,[cur_editor.TopLeft.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub eax,edx
|
|
|
|
jns @f
|
|
|
|
xor eax,eax
|
|
|
|
@@: sub ecx,edx
|
|
|
|
jns @f
|
|
|
|
xor ecx,ecx
|
2008-07-18 01:41:30 +04:00
|
|
|
@@: test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
@@: mov [cur_editor.Caret.Y],eax
|
|
|
|
mov [cur_editor.TopLeft.Y],ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.pgdn ;///// GO TO NEXT PAGE /////////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_pgdn: ;///// GO TO NEXT PAGE, WITH SELECTION //////////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
mov edx,[lines.scr]
|
|
|
|
dec edx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.Y]
|
|
|
|
mov ecx,[cur_editor.TopLeft.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
add eax,edx
|
|
|
|
add ecx,edx
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jb @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec eax
|
2008-07-18 01:41:30 +04:00
|
|
|
@@: test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
@@: mov [cur_editor.Caret.Y],eax
|
|
|
|
mov [cur_editor.TopLeft.Y],ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.home ;///// GO TO LINE START ////////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.X],0
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.X],0
|
|
|
|
@@:
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.end ;///// GO TO LINE END ///////////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
|
|
|
call get_real_length
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.X],eax
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.X],eax
|
|
|
|
@@:
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_home ;///// GO TO PAGE START ///////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.TopLeft.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov ecx,eax
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
@@: mov [cur_editor.Caret.Y],eax
|
|
|
|
mov [cur_editor.TopLeft.Y],ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_end ;///// GO TO PAGE END //////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.TopLeft.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov eax,[lines.scr]
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jle @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: add eax,ecx
|
|
|
|
dec eax
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
@@: mov [cur_editor.Caret.Y],eax
|
|
|
|
mov [cur_editor.TopLeft.Y],ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_pgup ;///// GO TO DOCUMENT START ///////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
xor eax,eax
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.TopLeft.Y],eax
|
|
|
|
mov [cur_editor.Caret.Y],eax
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.SelStart.Y],eax
|
|
|
|
@@:
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_pgdn ;///// GO TO DOCUMENT END /////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call clear_selection
|
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Lines.Count]
|
|
|
|
mov [cur_editor.Caret.Y],eax
|
|
|
|
sub eax,[lines.scr]
|
2006-10-12 00:40:53 +04:00
|
|
|
jns @f
|
|
|
|
xor eax,eax
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: mov [cur_editor.TopLeft.Y],eax
|
|
|
|
dec [cur_editor.Caret.Y]
|
2008-07-18 01:41:30 +04:00
|
|
|
test [chr],KM_SHIFT
|
2006-10-12 00:40:53 +04:00
|
|
|
jnz @f
|
2007-01-10 09:03:39 +03:00
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
2007-01-28 02:36:07 +03:00
|
|
|
@@:
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call delete_selection
|
2007-01-28 02:36:07 +03:00
|
|
|
jnc .exit
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
|
|
|
|
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
|
|
|
lea ebx,[esi+sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov ebp,esi
|
|
|
|
|
|
|
|
call get_real_length
|
|
|
|
or eax,eax
|
|
|
|
je .line_up
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
cmp ecx,eax
|
|
|
|
jae .line_up
|
|
|
|
lea edi,[ebx+ecx]
|
|
|
|
neg ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[ebp+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
add ecx,eax;[ebp]
|
|
|
|
repe scasb
|
|
|
|
je .line_up
|
|
|
|
|
|
|
|
mov edi,ebx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
add edi,ecx
|
|
|
|
lea esi,[edi+1]
|
|
|
|
neg ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[ebp+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
add ecx,eax;[ebp]
|
|
|
|
dec ecx
|
|
|
|
rep movsb
|
|
|
|
mov byte[edi],' '
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
ret
|
|
|
|
|
|
|
|
.line_up:
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec eax
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
je .exit
|
2007-01-28 02:36:07 +03:00
|
|
|
mov edi,[temp_buf]
|
2008-12-29 22:08:59 +03:00
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
mov esi,ebx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
rep movsb
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.X]
|
2007-01-03 21:22:05 +03:00
|
|
|
mov eax,[temp_buf]
|
2008-12-29 22:08:59 +03:00
|
|
|
mov [eax+EDITOR_LINE_DATA.Size],ecx
|
|
|
|
cmp ecx,[ebp+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
jbe @f
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[ebp+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
sub ecx,eax
|
2006-10-12 00:40:53 +04:00
|
|
|
sub edi,ecx
|
|
|
|
mov al,' '
|
|
|
|
rep stosb
|
2008-12-29 22:08:59 +03:00
|
|
|
@@: lea esi,[ebx+sizeof.EDITOR_LINE_DATA]
|
|
|
|
mov eax,[ebp+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
add esi,eax
|
2008-12-29 22:08:59 +03:00
|
|
|
mov ecx,[esi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size]
|
2007-01-03 21:22:05 +03:00
|
|
|
mov eax,[temp_buf]
|
2008-12-29 22:08:59 +03:00
|
|
|
add [eax+EDITOR_LINE_DATA.Size],ecx
|
|
|
|
or [eax+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
2006-10-12 00:40:53 +04:00
|
|
|
rep movsb
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,edi
|
2007-01-03 21:22:05 +03:00
|
|
|
sub ecx,[temp_buf]
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov esi,[temp_buf]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_real_length
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Columns.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jbe @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Columns.Count],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
@@:
|
|
|
|
push ecx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov edi,[cur_editor.Lines]
|
2008-07-16 08:55:19 +04:00
|
|
|
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
|
2007-01-03 21:22:05 +03:00
|
|
|
dec edi
|
2008-12-29 22:08:59 +03:00
|
|
|
lea esi,[edi+sizeof.EDITOR_LINE_DATA*2] ; !!! CHECK THIS !!!
|
2006-10-12 00:40:53 +04:00
|
|
|
sub esi,ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[ebp+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
add esi,eax
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[ebp+eax+sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
add esi,eax
|
2008-12-29 22:08:59 +03:00
|
|
|
lea ecx,[esi-sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub ecx,ebp
|
|
|
|
std
|
|
|
|
cmp esi,edi
|
|
|
|
jb @f
|
|
|
|
jz .lp1
|
|
|
|
mov edi,ebp
|
|
|
|
add edi,[esp]
|
2008-12-29 22:08:59 +03:00
|
|
|
lea esi,[ebp+sizeof.EDITOR_LINE_DATA*2] ; !!! CHECK THIS !!!
|
|
|
|
mov eax,[esi-sizeof.EDITOR_LINE_DATA*2+EDITOR_LINE_DATA.Size] ; !!! CHECK THIS !!!
|
2007-01-28 02:36:07 +03:00
|
|
|
add esi,eax
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size] ; !!! CHECK THIS !!!
|
2007-01-28 02:36:07 +03:00
|
|
|
add esi,eax
|
|
|
|
mov ecx,[cur_editor.Lines]
|
2008-07-16 08:55:19 +04:00
|
|
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub ecx,esi
|
|
|
|
cld
|
|
|
|
@@: rep movsb
|
|
|
|
.lp1: pop ecx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov esi,[temp_buf]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov edi,ebp
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
.ok.dec.lines:
|
2007-01-28 02:36:07 +03:00
|
|
|
dec [cur_editor.Lines.Count]
|
|
|
|
mov eax,[cur_editor.Lines.Count]
|
|
|
|
cmp [cur_editor.Caret.Y],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
jb @f
|
|
|
|
dec eax
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.Y],eax
|
|
|
|
@@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-19 00:14:15 +03:00
|
|
|
mov ecx,[cur_editor.Lines.Count]
|
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi+EDITOR_LINE_DATA.Size]
|
|
|
|
lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA]
|
2007-01-19 00:14:15 +03:00
|
|
|
mov eax,[cur_editor.Lines]
|
2008-07-16 08:55:19 +04:00
|
|
|
add eax,[cur_editor.Lines.Size] ;*** add eax,[eax-4]
|
2007-01-19 00:14:15 +03:00
|
|
|
sub esi,eax
|
|
|
|
lea eax,[esi+4096]
|
|
|
|
call editor_realloc_lines
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ins ;///// TOGGLE INSERT/OVERWRITE MODE /////////////////////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
2006-10-12 00:40:53 +04:00
|
|
|
xor [ins_mode],1
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.Y]
|
|
|
|
mov ebx,eax
|
|
|
|
call draw_editor_text.part
|
|
|
|
call draw_editor_caret
|
2006-10-12 00:40:53 +04:00
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call delete_selection
|
2007-01-28 02:36:07 +03:00
|
|
|
jnc key.del.exit
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec eax
|
|
|
|
js .line_up
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
dec [cur_editor.Caret.X]
|
|
|
|
mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
|
|
|
|
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
mov ebx,eax
|
|
|
|
call get_real_length
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
jae @f
|
2007-01-28 02:36:07 +03:00
|
|
|
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
ret
|
|
|
|
|
2008-12-29 22:08:59 +03:00
|
|
|
@@: lea edi,[esi+sizeof.EDITOR_LINE_DATA+ebx]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov ecx,ebx
|
|
|
|
neg ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
add ecx,eax
|
2006-10-12 00:40:53 +04:00
|
|
|
dec ecx
|
|
|
|
lea esi,[edi+1]
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
mov byte[edi],' '
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
ret
|
|
|
|
|
|
|
|
.line_up:
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp [cur_editor.Caret.Y],0
|
2006-10-12 00:40:53 +04:00
|
|
|
jne @f
|
|
|
|
ret
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec ecx
|
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
|
|
|
|
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
mov ebp,esi
|
2008-12-29 22:08:59 +03:00
|
|
|
lea ebx,[esi+sizeof.EDITOR_LINE_DATA]
|
|
|
|
mov ecx,[ebp+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: cmp byte[ebx+ecx-1],' '
|
|
|
|
jne @f
|
|
|
|
dec ecx
|
|
|
|
jg @b
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: mov [cur_editor.Caret.X],ecx
|
|
|
|
dec [cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
cld
|
|
|
|
jmp key.del.line_up
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.tab ;///// TABULATE /////////////////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call delete_selection
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
mov ecx,eax
|
|
|
|
add eax,ATABW
|
|
|
|
and eax,not(ATABW-1)
|
|
|
|
push eax ' '
|
|
|
|
sub eax,ecx
|
|
|
|
.direct:
|
2007-01-19 00:14:15 +03:00
|
|
|
push eax
|
|
|
|
call editor_realloc_lines
|
|
|
|
pop eax
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
2008-12-29 22:08:59 +03:00
|
|
|
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
|
|
|
|
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
xchg eax,ecx
|
|
|
|
|
|
|
|
call get_real_length
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
jae @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.X]
|
2008-12-29 22:08:59 +03:00
|
|
|
@@: mov edx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub edx,eax
|
|
|
|
cmp ecx,edx
|
|
|
|
jl @f
|
2007-01-19 00:14:15 +03:00
|
|
|
push eax
|
|
|
|
mov eax,10
|
|
|
|
call editor_realloc_lines
|
|
|
|
add esi,eax
|
|
|
|
pop eax
|
2007-01-28 02:36:07 +03:00
|
|
|
pushad
|
|
|
|
mov ecx,[cur_editor.Lines]
|
2008-07-16 08:55:19 +04:00
|
|
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
2007-01-03 21:22:05 +03:00
|
|
|
dec ecx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov edi,ecx
|
2007-01-03 21:22:05 +03:00
|
|
|
add ecx,-10+1
|
2008-12-29 22:08:59 +03:00
|
|
|
mov eax,[esi+EDITOR_LINE_DATA.Size]
|
|
|
|
lea eax,[esi+eax+sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub ecx,eax
|
2007-01-28 02:36:07 +03:00
|
|
|
lea esi,[edi-10]
|
2006-10-12 00:40:53 +04:00
|
|
|
std
|
|
|
|
rep movsb
|
|
|
|
mov ecx,10
|
|
|
|
mov al,' '
|
|
|
|
rep stosb
|
2007-01-28 02:36:07 +03:00
|
|
|
popad
|
2008-12-29 22:08:59 +03:00
|
|
|
add [esi+EDITOR_LINE_DATA.Size],10
|
2006-10-12 00:40:53 +04:00
|
|
|
jmp @b
|
2008-12-29 22:08:59 +03:00
|
|
|
@@: lea ebx,[esi+sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
push ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov edi,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
lea edi,[ebx+edi-1]
|
|
|
|
mov esi,edi
|
|
|
|
sub esi,ecx
|
|
|
|
lea ecx,[esi+1]
|
|
|
|
sub ecx,ebx
|
2007-01-28 02:36:07 +03:00
|
|
|
sub ecx,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
std
|
|
|
|
rep movsb
|
2007-01-28 02:36:07 +03:00
|
|
|
.ok: pop ecx
|
2006-10-12 00:40:53 +04:00
|
|
|
pop eax
|
|
|
|
rep stosb
|
|
|
|
cld
|
2007-01-28 02:36:07 +03:00
|
|
|
pop [cur_editor.Caret.X]
|
2008-12-29 22:08:59 +03:00
|
|
|
lea esi,[ebx-sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_real_length
|
2007-01-28 02:36:07 +03:00
|
|
|
cmp eax,[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
jae @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov eax,[cur_editor.Caret.X]
|
|
|
|
@@: cmp eax,[cur_editor.Columns.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
jbe @f
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Columns.Count],eax
|
|
|
|
@@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
|
|
|
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
|
|
|
|
mov [cur_editor.Modified],1
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
|
2006-10-12 00:40:53 +04:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call delete_selection
|
|
|
|
|
2007-01-19 00:14:15 +03:00
|
|
|
mov eax,14
|
|
|
|
call editor_realloc_lines
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,[cur_editor.Caret.Y]
|
2006-10-12 00:40:53 +04:00
|
|
|
call get_line_offset
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ebx,[cur_editor.Caret.X]
|
2008-12-29 22:08:59 +03:00
|
|
|
cmp ebx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
jb @f
|
2008-12-29 22:08:59 +03:00
|
|
|
mov ebx,[esi+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
dec ebx
|
|
|
|
jns @f
|
|
|
|
xor ebx,ebx
|
|
|
|
@@:
|
|
|
|
cld
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov edi,[temp_buf]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov ebp,esi
|
2007-01-03 21:22:05 +03:00
|
|
|
lea ecx,[ebx+1]
|
2006-10-12 00:40:53 +04:00
|
|
|
@@: dec ecx
|
|
|
|
jz @f
|
2008-12-29 22:08:59 +03:00
|
|
|
cmp byte[esi+ecx+sizeof.EDITOR_LINE_DATA-1],' '
|
2006-10-12 00:40:53 +04:00
|
|
|
je @b
|
|
|
|
@@: lea eax,[ecx+10]
|
2008-12-29 22:08:59 +03:00
|
|
|
mov [edi+EDITOR_LINE_DATA.Size],eax
|
|
|
|
mov [edi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
jecxz @f
|
|
|
|
push esi
|
2008-12-29 22:08:59 +03:00
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
rep movsb
|
|
|
|
pop esi
|
|
|
|
@@: mov al,' '
|
|
|
|
mov ecx,10
|
|
|
|
rep stosb
|
|
|
|
|
2008-12-29 22:08:59 +03:00
|
|
|
mov ecx,[esi+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
sub ecx,ebx
|
|
|
|
add esi,ebx
|
2008-12-29 22:08:59 +03:00
|
|
|
add esi,sizeof.EDITOR_LINE_DATA
|
2006-10-12 00:40:53 +04:00
|
|
|
inc ecx
|
|
|
|
@@: dec ecx
|
|
|
|
jz @f
|
|
|
|
cmp byte[esi+ecx-1],' '
|
|
|
|
je @b
|
|
|
|
@@: jz .lp1
|
|
|
|
@@: cmp byte[esi],' '
|
|
|
|
jne .lp1
|
|
|
|
inc esi
|
|
|
|
loop @b
|
2008-12-29 22:08:59 +03:00
|
|
|
.lp1: test [auto_indent],1
|
2006-10-12 00:40:53 +04:00
|
|
|
jz .lp2
|
|
|
|
push edi ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov ecx,[ebp+EDITOR_LINE_DATA.Size]
|
|
|
|
lea edi,[ebp+sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov al,' '
|
|
|
|
repe scasb
|
|
|
|
mov eax,ecx
|
|
|
|
pop ecx edi
|
|
|
|
je .lp2
|
|
|
|
neg eax
|
2008-12-29 22:08:59 +03:00
|
|
|
mov edx,[ebp+EDITOR_LINE_DATA.Size]
|
2006-10-12 00:40:53 +04:00
|
|
|
add eax,edx;[ebp]
|
|
|
|
dec eax
|
|
|
|
jmp @f
|
|
|
|
.lp2: xor eax,eax
|
|
|
|
@@: mov edx,edi
|
2008-12-29 22:08:59 +03:00
|
|
|
add edi,sizeof.EDITOR_LINE_DATA
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Caret.X],eax
|
2006-10-12 00:40:53 +04:00
|
|
|
jecxz @f
|
|
|
|
push ecx
|
|
|
|
mov ecx,eax
|
|
|
|
mov al,' '
|
|
|
|
rep stosb
|
|
|
|
pop ecx
|
|
|
|
@@: jecxz @f
|
|
|
|
rep movsb
|
|
|
|
@@: mov ecx,10
|
|
|
|
mov al,' '
|
|
|
|
rep stosb
|
|
|
|
|
2008-12-29 22:08:59 +03:00
|
|
|
lea eax,[edi-sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub eax,edx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov [edx+EDITOR_LINE_DATA.Size],eax
|
|
|
|
mov [edx+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov ecx,edi
|
2007-01-03 21:22:05 +03:00
|
|
|
sub ecx,[temp_buf]
|
2006-10-12 00:40:53 +04:00
|
|
|
|
|
|
|
push ecx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov edi,[cur_editor.Lines]
|
2008-07-16 08:55:19 +04:00
|
|
|
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
|
2007-01-03 21:22:05 +03:00
|
|
|
dec edi
|
2008-12-29 22:08:59 +03:00
|
|
|
lea esi,[edi+sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub esi,ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
mov ecx,[ebp+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
add esi,ecx
|
2008-12-29 22:08:59 +03:00
|
|
|
lea ecx,[esi-sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub ecx,ebp
|
|
|
|
std
|
|
|
|
cmp esi,edi
|
|
|
|
jb @f
|
|
|
|
je .lp3
|
2008-12-29 22:08:59 +03:00
|
|
|
lea esi,[ebp+sizeof.EDITOR_LINE_DATA]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov eax,[esp]
|
2008-12-29 22:08:59 +03:00
|
|
|
lea edi,[esi+eax-sizeof.EDITOR_LINE_DATA]
|
|
|
|
mov ecx,[ebp+EDITOR_LINE_DATA.Size]
|
2007-01-28 02:36:07 +03:00
|
|
|
add esi,ecx
|
|
|
|
mov ecx,[cur_editor.Lines]
|
2008-07-16 08:55:19 +04:00
|
|
|
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
|
2006-10-12 00:40:53 +04:00
|
|
|
sub ecx,esi
|
|
|
|
cld
|
|
|
|
@@: rep movsb
|
|
|
|
.lp3: pop ecx
|
2007-01-28 02:36:07 +03:00
|
|
|
mov esi,[temp_buf]
|
2006-10-12 00:40:53 +04:00
|
|
|
mov edi,ebp
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
inc [cur_editor.Caret.Y]
|
|
|
|
inc [cur_editor.SelStart.Y]
|
|
|
|
inc [cur_editor.Lines.Count]
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [cur_editor.Modified],1
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-03 21:22:05 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_tab ;///// SWITCH TO NEXT TAB //////////////////////////////////
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
cmp [tab_bar.Items.Count],1
|
|
|
|
je .exit
|
|
|
|
xor eax,eax
|
|
|
|
mov ebp,[tab_bar.Items]
|
|
|
|
@@: cmp ebp,[tab_bar.Current.Ptr]
|
|
|
|
je @f
|
|
|
|
inc eax
|
|
|
|
add ebp,sizeof.TABITEM
|
|
|
|
jmp @b
|
|
|
|
@@: add ebp,sizeof.TABITEM
|
|
|
|
inc eax
|
|
|
|
cmp eax,[tab_bar.Items.Count]
|
|
|
|
jb @f
|
|
|
|
mov ebp,[tab_bar.Items]
|
|
|
|
@@: call set_cur_tab
|
2007-01-10 09:03:39 +03:00
|
|
|
call make_tab_visible
|
2007-01-03 21:22:05 +03:00
|
|
|
call align_editor_in_tab
|
|
|
|
call draw_editor
|
|
|
|
call draw_tabctl
|
2007-01-28 02:36:07 +03:00
|
|
|
call update_caption
|
2007-01-03 21:22:05 +03:00
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2006-10-12 00:40:53 +04:00
|
|
|
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.shift_ctrl_tab ;///// SWITCH TO PREVIOUS TAB ////////////////////////
|
2007-01-03 21:22:05 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
cmp [tab_bar.Items.Count],1
|
|
|
|
je .exit
|
|
|
|
xor eax,eax
|
|
|
|
mov ebp,[tab_bar.Items]
|
|
|
|
@@: cmp ebp,[tab_bar.Current.Ptr]
|
|
|
|
je @f
|
|
|
|
inc eax
|
|
|
|
add ebp,sizeof.TABITEM
|
|
|
|
jmp @b
|
|
|
|
@@: add ebp,-sizeof.TABITEM
|
|
|
|
dec eax
|
|
|
|
jge @f
|
|
|
|
imul eax,[tab_bar.Items.Count],sizeof.TABITEM
|
|
|
|
add eax,[tab_bar.Items]
|
|
|
|
lea ebp,[eax-sizeof.TABITEM]
|
|
|
|
@@: call set_cur_tab
|
2007-01-10 09:03:39 +03:00
|
|
|
call make_tab_visible
|
2007-01-03 21:22:05 +03:00
|
|
|
call align_editor_in_tab
|
|
|
|
call draw_editor
|
|
|
|
call draw_tabctl
|
2007-01-28 02:36:07 +03:00
|
|
|
call update_caption
|
2006-10-12 00:40:53 +04:00
|
|
|
.exit:
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-10 09:03:39 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
|
2007-01-10 09:03:39 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-18 04:41:58 +04:00
|
|
|
cmp [cur_editor.Modified],0
|
2007-07-29 06:06:58 +04:00
|
|
|
je .close
|
2007-09-18 04:41:58 +04:00
|
|
|
mov [bot_mode2],2
|
2007-07-29 06:06:58 +04:00
|
|
|
jmp key.ctrl_o.direct
|
|
|
|
.close:
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [do_not_draw],1
|
|
|
|
push [tab_bar.Current.Ptr]
|
|
|
|
cmp [tab_bar.Items.Count],1
|
2007-01-10 09:03:39 +03:00
|
|
|
jne @f
|
2007-07-29 06:06:58 +04:00
|
|
|
;call create_tab
|
|
|
|
jmp key.alt_x.close ; close program
|
2007-01-28 02:36:07 +03:00
|
|
|
@@: pop ebp
|
|
|
|
call delete_tab
|
|
|
|
dec [do_not_draw]
|
|
|
|
call align_editor_in_tab
|
|
|
|
call draw_editor
|
|
|
|
call draw_tabctl
|
|
|
|
call draw_statusbar
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-19 00:14:15 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.shift_f9 ;///// SET DEFAULT TAB /////////////////////////////////////
|
2007-01-19 00:14:15 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
mov eax,[tab_bar.Current.Ptr]
|
|
|
|
cmp eax,[tab_bar.Default.Ptr]
|
|
|
|
jne @f
|
|
|
|
xor eax,eax
|
|
|
|
@@: mov [tab_bar.Default.Ptr],eax
|
|
|
|
mov ebp,[tab_bar.Current.Ptr]
|
|
|
|
call make_tab_visible
|
|
|
|
cmp [tab_bar.Style],2
|
|
|
|
jbe @f
|
|
|
|
call align_editor_in_tab
|
|
|
|
call draw_editor
|
|
|
|
@@: call draw_tabctl
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-28 02:36:07 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.f3 ;///// FIND NEXT MATCH ///////////////////////////////////////////
|
2007-01-28 02:36:07 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
call search
|
|
|
|
jc @f
|
|
|
|
@@: ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-28 02:36:07 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.f9 ;///// COMPILE AND RUN ///////////////////////////////////////////
|
2007-01-28 02:36:07 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
mov bl,1
|
|
|
|
call start_fasm
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-28 02:36:07 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.ctrl_f9 ;///// COMPILE //////////////////////////////////////////////
|
2007-01-28 02:36:07 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
mov bl,0
|
|
|
|
call start_fasm
|
|
|
|
ret
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-01-28 02:36:07 +03:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-02 01:38:00 +04:00
|
|
|
proc key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
|
2007-01-28 02:36:07 +03:00
|
|
|
;-----------------------------------------------------------------------------
|
2007-09-18 04:41:58 +04:00
|
|
|
mov [main_closing],1
|
|
|
|
mov eax,[tab_bar.Items]
|
|
|
|
mov [exit_tab_item],eax
|
|
|
|
mov eax,[tab_bar.Items.Count]
|
|
|
|
mov [exit_tab_num],eax
|
|
|
|
.direct:
|
|
|
|
call try_to_close_tabs
|
|
|
|
or eax,eax
|
2008-12-29 22:08:59 +03:00
|
|
|
jz @f
|
2007-09-18 04:41:58 +04:00
|
|
|
mov [bot_mode2],2
|
|
|
|
jmp key.ctrl_o.direct
|
|
|
|
|
2008-12-29 22:08:59 +03:00
|
|
|
@@: stdcall save_settings
|
2007-01-28 02:36:07 +03:00
|
|
|
|
2008-12-29 22:08:59 +03:00
|
|
|
.close:
|
2007-01-28 02:36:07 +03:00
|
|
|
mov [main_closed],1
|
|
|
|
mcall -1
|
2007-09-02 01:38:00 +04:00
|
|
|
endp
|
2007-09-18 04:41:58 +04:00
|
|
|
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
proc try_to_close_tabs ;///// FIND TABS TO BE SAVED BEFORE CLOSE /////////////
|
|
|
|
;-----------------------------------------------------------------------------
|
|
|
|
push ecx ebp
|
|
|
|
call flush_cur_tab
|
|
|
|
mov ebp,[exit_tab_item] ; [tab_bar.Items]
|
|
|
|
add ebp,-sizeof.TABITEM
|
|
|
|
@@: dec [exit_tab_num]
|
|
|
|
js .ok
|
|
|
|
add ebp,sizeof.TABITEM
|
|
|
|
mov al,[ebp+TABITEM.Editor.Modified]
|
|
|
|
cmp [ebp+TABITEM.Editor.Modified],0
|
|
|
|
je @b
|
|
|
|
mov [exit_tab_item],ebp
|
|
|
|
call set_cur_tab
|
|
|
|
call make_tab_visible
|
|
|
|
xor eax,eax
|
|
|
|
inc eax
|
|
|
|
@@: pop ebp ecx
|
|
|
|
ret
|
|
|
|
.ok: xor eax,eax
|
|
|
|
jmp @b
|
|
|
|
endp
|