Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 266 → Rev 267

/programs/develop/tinypad/trunk/tp-key.asm
46,13 → 46,13
jmp still
@@:
 
mov esi,accel_table
mov esi,accel_table_main
.acc: cmp eax,[esi]
jne @f
test [options],OPTS_SECURESEL
jz .lp1
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
.lp1: mov [s_status],0
call dword[esi+4]
jmp still
74,8 → 74,8
 
test [options],OPTS_SECURESEL
jz .lp2
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
jmp .put
.lp2: call delete_selection
 
85,24 → 85,24
jne @f
mov al,']'
call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x]
dec [cur_editor.Caret.X] ;! [pos.x]
jmp .put
@@: cmp al,'('
jne @f
mov al,')'
call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x]
dec [cur_editor.Caret.X] ;! [pos.x]
jmp .put
@@: cmp al,'{'
jne .put
mov al,'}'
call .lp3
dec [cur_tab.Editor.Caret.X] ;! [pos.x]
dec [cur_editor.Caret.X] ;! [pos.x]
 
.put: pop eax
push still
inc [cur_tab.Editor.SelStart.X] ;! [sel.x]
.lp3: push [cur_tab.Editor.Caret.X] eax ;! [pos.x] eax
inc [cur_editor.SelStart.X] ;! [sel.x]
.lp3: push [cur_editor.Caret.X] eax ;! [pos.x] eax
inc dword[esp+4]
mov eax,1
jmp key.tab.direct
111,14 → 111,14
func key.ctrl_a ;///// SELECT ALL DOCUMENT ///////////////////////////////////
;-----------------------------------------------------------------------------
xor eax,eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines]
dec ecx
mov [cur_tab.Editor.Caret.Y],ecx ;! [pos.y],ecx
mov [cur_editor.Caret.Y],ecx ;! [pos.y],ecx
call get_line_offset
call get_real_length
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_editor.Caret.X],eax ;! [pos.x],eax
call draw_file
ret
endf
147,7 → 147,7
@@: mov al,[tb_opensave.length]
mov [tb_opensave.pos.x],al
mov [tb_opensave.sel.x],0
mov [tb_casesen],1
mov [tb_casesen],0;1
call drawwindow
ret
endf
155,7 → 155,7
;-----------------------------------------------------------------------------
func key.ctrl_s ;///// ENTER SAVE FILENAME ///////////////////////////////////
;-----------------------------------------------------------------------------
cmp [cur_tab.Editor.Modified],0 ;! [modified],0
cmp [cur_editor.Modified],0 ;! [modified],0
je .exit
cmp [f_info.length],0
je key.shift_ctrl_s
170,7 → 170,7
endf
 
;-----------------------------------------------------------------------------
func key.ctrl_n ;///// ENTER SAVE FILENAME ///////////////////////////////////
func key.ctrl_n ;///// CREATE NEW FILE (TAB) /////////////////////////////////
;-----------------------------------------------------------------------------
call create_tab
ret
248,8 → 248,8
;-----------------------------------------------------------------------------
key.shift_ctrl_left: ;///// GO TO PREVIOUS WORD, WITH SELECTION /////////
;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y]
mov edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x]
mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y]
mov edx,[cur_editor.Caret.X] ;! edx,[pos.x]
cld
mov ecx,ebx
call get_line_offset
307,26 → 307,26
jmp .lp2
@@:
inc edx
mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx
mov [cur_tab.Editor.Caret.X],edx ;! [pos.x],edx
mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx
mov [cur_editor.Caret.X],edx ;! [pos.x],edx
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx
mov [cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx
@@: sub ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line]
mov [cur_editor.SelStart.Y],ebx ;! [sel.y],ebx
mov [cur_editor.SelStart.X],edx ;! [sel.x],edx
@@: sub ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line]
jge @f
add [cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx
add [cur_editor.TopLeft.Y],ebx ;! [top_line],ebx
@@: mov eax,edx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[columns.scr]
jl @f
sub eax,[columns.scr]
inc eax
add [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
add [cur_editor.TopLeft.X],eax ;! [left_col],eax
jmp .exit
@@: cmp edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col]
@@: cmp edx,[cur_editor.TopLeft.X] ;! edx,[left_col]
jge .exit
mov [cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx
mov [cur_editor.TopLeft.X],edx ;! [left_col],edx
.exit:
call draw_file
.exit.2:
341,8 → 341,8
;-----------------------------------------------------------------------------
key.shift_ctrl_right: ;///// GO TO NEXT WORD, WITH SELECTION ////////////
;-----------------------------------------------------------------------------
mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y]
mov edx,[cur_tab.Editor.Caret.X] ;! edx,[pos.x]
mov ebx,[cur_editor.Caret.Y] ;! ebx,[pos.y]
mov edx,[cur_editor.Caret.X] ;! edx,[pos.x]
cld
.lp1: mov ecx,ebx
call get_line_offset
363,7 → 363,7
dec ecx
jnz @b
.nx1: inc ebx
cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines]
cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
jge .exit.2
xor edx,edx
jmp .lp1
388,34 → 388,34
dec ecx
jnz @b
.nx2: inc ebx
cmp ebx,[cur_tab.Editor.Lines] ;! ebx,[lines]
cmp ebx,[cur_editor.Lines.Count] ;! ebx,[lines]
jge .exit.2
xor edx,edx
jmp .lp2
@@:
mov [cur_tab.Editor.Caret.Y],ebx ;! [pos.y],ebx
mov [cur_tab.Editor.Caret.X],edx ;! [pos.x],edx
mov [cur_editor.Caret.Y],ebx ;! [pos.y],ebx
mov [cur_editor.Caret.X],edx ;! [pos.x],edx
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],ebx ;! [sel.y],ebx
mov [cur_tab.Editor.SelStart.X],edx ;! [sel.x],edx
@@: sub ebx,[cur_tab.Editor.TopLeft.Y] ;! ebx,[top_line]
mov [cur_editor.SelStart.Y],ebx ;! [sel.y],ebx
mov [cur_editor.SelStart.X],edx ;! [sel.x],edx
@@: sub ebx,[cur_editor.TopLeft.Y] ;! ebx,[top_line]
cmp ebx,[lines.scr]
jl @f
sub ebx,[lines.scr]
inc ebx
add [cur_tab.Editor.TopLeft.Y],ebx ;! [top_line],ebx
add [cur_editor.TopLeft.Y],ebx ;! [top_line],ebx
@@: mov eax,edx
sub eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col]
sub eax,[cur_editor.TopLeft.X] ;! eax,[left_col]
cmp eax,[columns.scr]
jl @f
sub eax,[columns.scr]
inc eax
add [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax
add [cur_editor.TopLeft.X],eax ;! [left_col],eax
jmp .exit
@@: cmp edx,[cur_tab.Editor.TopLeft.X] ;! edx,[left_col]
@@: cmp edx,[cur_editor.TopLeft.X] ;! edx,[left_col]
jge .exit
mov [cur_tab.Editor.TopLeft.X],edx ;! [left_col],edx
mov [cur_editor.TopLeft.X],edx ;! [left_col],edx
.exit:
call draw_file
.exit.2:
428,7 → 428,7
je @f
call key.ctrl_c
call key.del
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
@@: ret
endf
 
537,14 → 537,14
 
call delete_selection
 
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset
pushd [esi] esi
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
call line_add_spaces
mov ecx,[copy_size]
sub ecx,4
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
mov edi,[cur_editor.Lines] ;! AREA_TEMP2
add edi,[edi-4]
dec edi
mov eax,esi
551,7 → 551,7
mov esi,edi
sub esi,ecx
lea ecx,[eax+4]
add ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
add ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
neg ecx
lea ecx,[esi+ecx+1]
std
567,7 → 567,7
mov esi,[copy_buf] ;! AREA_CBUF
lodsd
 
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x]
add eax,ebx
mov [edi-4],ax
sub eax,ebx
590,16 → 590,16
mov ecx,eax
rep movsb
 
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_editor.Caret.X],eax ;! [pos.x],eax
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
mov eax,[copy_count]
dec eax
add [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
add [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
add [cur_tab.Editor.Lines],eax ;! [lines],eax
add [cur_editor.Caret.Y],eax ;! [pos.y],eax
add [cur_editor.SelStart.Y],eax ;! [sel.y],eax
add [cur_editor.Lines.Count],eax ;! [lines],eax
 
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
jmp .exit
 
.single_line:
612,16 → 612,16
and dword[edi-4],not 0x00020000
or dword[edi-4],0x00010000
call .check_columns
add edi,[cur_tab.Editor.Caret.X] ;! edi,[pos.x]
add edi,[cur_editor.Caret.X] ;! edi,[pos.x]
add esp,4
mov ecx,eax
rep movsb
 
add [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
add [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
add [cur_editor.Caret.X],eax ;! [pos.x],eax
add [cur_editor.SelStart.X],eax ;! [sel.x],eax
 
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
 
.exit:
ret
629,9 → 629,9
.check_columns:
push eax
movzx eax,word[edi-4]
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax
mov [cur_editor.Columns.Count],eax ;! [columns],eax
@@: pop eax
ret
; push eax ebx esi
656,11 → 656,11
;-----------------------------------------------------------------------------
func key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset
mov ebx,esi
 
mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines]
mov ecx,[cur_editor.Lines.Count] ;! ecx,[lines]
call get_line_offset
lea edi,[esi+90+4]
lea ecx,[esi+4]
679,12 → 679,12
rep stosb
mov byte[ebx+4],';'
 
inc [cur_tab.Editor.Lines] ;! [lines]
inc [cur_tab.Editor.Caret.Y] ;! [pos.y]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
inc [cur_editor.Lines.Count] ;! [lines]
inc [cur_editor.Caret.Y] ;! [pos.y]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
 
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
 
.exit:
ret
693,18 → 693,18
;-----------------------------------------------------------------------------
func key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
inc eax
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jge .exit
 
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset
mov edi,esi
lodsd
add esi,eax
 
dec [cur_tab.Editor.Lines] ;! [lines]
dec [cur_editor.Lines.Count] ;! [lines]
mov ecx,[temp_buf] ;! AREA_TEMP2
sub ecx,esi
shr ecx,2 ;// fixed (was 4)
711,7 → 711,7
cld
rep movsd
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
 
.exit:
ret
725,11 → 725,11
;-----------------------------------------------------------------------------
key.shift_up: ;///// GO TO PREVIOUS LINE, WITH SELECTION ////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
dec eax
jns @f
xor eax,eax
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
@@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
cmp eax,ecx
jae @f
dec ecx
737,7 → 737,7
xor ecx,ecx
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
753,12 → 753,12
key.shift_down: ;///// GO TO NEXT LINE, WITH SELECTION //////////////////
;-----------------------------------------------------------------------------
 
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
inc eax
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jb @f
dec eax
@@: mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
@@: mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
mov edx,eax
sub edx,ecx
cmp edx,[lines.scr]
766,7 → 766,7
inc ecx
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
781,14 → 781,14
;-----------------------------------------------------------------------------
key.shift_left: ;///// GO TO PREVIOUS CHAR, WITH SELECTION //////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
dec eax
jns @f
inc eax
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
@@: mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
@@: mov [cur_editor.Caret.X],eax ;! [pos.x],eax
call check_inv_all
 
.exit:
803,15 → 803,15
;-----------------------------------------------------------------------------
key.shift_right: ;///// GO TO NEXT CHAR, WITH SELECTION /////////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
inc eax
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe @f
dec eax
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
@@: mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
@@: mov [cur_editor.Caret.X],eax ;! [pos.x],eax
call check_inv_all
 
.exit:
828,8 → 828,8
;-----------------------------------------------------------------------------
mov edx,[lines.scr]
dec edx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
sub eax,edx
jns @f
xor eax,eax
838,7 → 838,7
xor ecx,ecx
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
855,17 → 855,17
;-----------------------------------------------------------------------------
mov edx,[lines.scr]
dec edx
mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
add eax,edx
add ecx,edx
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jb @f
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
dec eax
@@: test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
880,10 → 880,10
;-----------------------------------------------------------------------------
key.shift_home: ;///// GO TO LINE START, WITH SELECTION /////////////////
;-----------------------------------------------------------------------------
mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0
mov [cur_editor.Caret.X],0 ;! [pos.x],0
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.X],0 ;! [sel.x],0
mov [cur_editor.SelStart.X],0 ;! [sel.x],0
@@: call check_inv_all
 
.exit:
898,13 → 898,13
;-----------------------------------------------------------------------------
key.shift_end: ;///// GO TO LINE END, WITH SELECTION ////////////////////
;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset
call get_real_length
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_editor.Caret.X],eax ;! [pos.x],eax
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax
mov [cur_editor.SelStart.X],eax ;! [sel.x],eax
@@: call check_inv_all
 
.exit:
919,11 → 919,11
;-----------------------------------------------------------------------------
key.shift_ctrl_home: ;///// GO TO PAGE START, WITH SELECTION ////////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line]
mov eax,[cur_editor.TopLeft.Y] ;! eax,[top_line]
mov ecx,eax
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
938,16 → 938,16
;-----------------------------------------------------------------------------
key.shift_ctrl_end: ;///// GO TO PAGE END, WITH SELECTION ///////////////
;-----------------------------------------------------------------------------
mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line]
mov ecx,[cur_editor.TopLeft.Y] ;! ecx,[top_line]
mov eax,[lines.scr]
cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp eax,[cur_editor.Lines.Count] ;! eax,[lines]
jle @f
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
@@: add eax,ecx
dec eax
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_init
 
.exit:
963,11 → 963,11
key.shift_ctrl_pgup: ;///// GO TO DOCUMENT START, WITH SELECTION ////////
;-----------------------------------------------------------------------------
xor eax,eax
mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
test byte[shi+2],0x01
jnz @f
mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax
mov [cur_editor.SelStart.Y],eax ;! [sel.y],eax
@@: call check_inv_all.skip_check
 
.exit:
982,16 → 982,16
;-----------------------------------------------------------------------------
key.shift_ctrl_pgdn: ;///// GO TO DOCUMENT END, WITH SELECTION //////////
;-----------------------------------------------------------------------------
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] ; eax = lines in the file
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
mov eax,[cur_editor.Lines.Count] ;! eax,[lines] ; eax = lines in the file
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
sub eax,[lines.scr] ; eax -= lines on the screen
jns @f
xor eax,eax
@@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax
dec [cur_tab.Editor.Caret.Y] ;! [pos.y]
@@: mov [cur_editor.TopLeft.Y],eax ;! [top_line],eax
dec [cur_editor.Caret.Y] ;! [pos.y]
test byte[shi+2],0x01
jnz @f
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
;! push [pos.y]
;! pop [sel.y]
@@: call check_inv_all.skip_check
1006,7 → 1006,7
call delete_selection
jnc .exit.2
 
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
1017,7 → 1017,7
or eax,eax
je .line_up
 
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
cmp ecx,eax
jae .line_up
lea edi,[ebx+ecx]
1028,7 → 1028,7
je .line_up
 
mov edi,ebx
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
add edi,ecx
lea esi,[edi+1]
neg ecx
1038,23 → 1038,23
rep movsb
mov byte[edi],' '
 
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
ret
 
.line_up:
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
dec eax
cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y]
cmp eax,[cur_editor.Caret.Y] ;! eax,[pos.y]
je .exit
mov edi,[temp_buf] ;! AREA_TEMP+4
add edi,4
mov esi,ebx
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
rep movsb
mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
mov ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
mov eax,[temp_buf]
mov [eax],ecx ;! [AREA_TEMP],ecx
cmp cx,[ebp]
1078,12 → 1078,12
 
mov esi,[temp_buf] ;! AREA_TEMP
call get_real_length
cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax
mov [cur_editor.Columns.Count],eax ;! [columns],eax
@@:
push ecx
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
mov edi,[cur_editor.Lines] ;! AREA_TEMP2
add edi,[edi-4]
dec edi
lea esi,[edi+8]
1108,7 → 1108,7
add esi,eax;[esi-8]
movzx eax,word[esi-4]
add esi,eax;[esi-4]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2
add ecx,[ecx-4]
sub ecx,esi
cld
1120,16 → 1120,16
rep movsb
 
.ok.dec.lines:
dec [cur_tab.Editor.Lines] ;! [lines]
mov eax,[cur_tab.Editor.Lines] ;! eax,[lines]
cmp [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
dec [cur_editor.Lines.Count] ;! [lines]
mov eax,[cur_editor.Lines.Count] ;! eax,[lines]
cmp [cur_editor.Caret.Y],eax ;! [pos.y],eax
jb @f
dec eax
mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax
@@: m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
mov [cur_editor.Caret.Y],eax ;! [pos.y],eax
@@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
 
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
.exit.2:
call check_inv_all
 
1152,12 → 1152,12
call delete_selection
jnc key.del.exit.2
 
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
dec eax
js .line_up
 
dec [cur_tab.Editor.Caret.X] ;! [pos.x]
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
dec [cur_editor.Caret.X] ;! [pos.x]
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
1164,11 → 1164,11
 
mov ebx,eax
call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jae @f
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
ret
 
@@: lea edi,[esi+4+ebx]
1182,17 → 1182,17
rep movsb
mov byte[edi],' '
 
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
call check_inv_str
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
ret
 
.line_up:
cmp [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0
cmp [cur_editor.Caret.Y],0 ;! [pos.y],0
jne @f
ret
@@: mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
@@: mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
dec ecx
call get_line_offset
and dword[esi],not 0x00020000
1205,8 → 1205,8
jne @f
dec ecx
jg @b
@@: mov [cur_tab.Editor.Caret.X],ecx ;! [pos.x],ecx
dec [cur_tab.Editor.Caret.Y] ;! [pos.y]
@@: mov [cur_editor.Caret.X],ecx ;! [pos.x],ecx
dec [cur_editor.Caret.Y] ;! [pos.y]
cld
jmp key.del.line_up
endf
1215,7 → 1215,7
func key.tab ;///// TABULATE /////////////////////////////////////////////////
;-----------------------------------------------------------------------------
call delete_selection
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
 
mov ecx,eax
add eax,ATABW
1223,7 → 1223,7
push eax ' '
sub eax,ecx
.direct:
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
1231,15 → 1231,15
xchg eax,ecx
 
call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jae @f
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
@@: movzx edx,word[esi]
sub edx,eax
cmp ecx,edx
jl @f
pushad; esi ecx eax
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2-10+1
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2-10+1
add ecx,[ecx-4]
dec ecx
mov edi,ecx ;! AREA_TEMP2
1268,7 → 1268,7
sub esi,ecx
lea ecx,[esi+1]
sub ecx,ebx
sub ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x]
sub ecx,[cur_editor.Caret.X] ;! ecx,[pos.x]
std
rep movsb
.ok: pop ecx ;*******
1275,19 → 1275,19
pop eax
rep stosb
cld
pop [cur_tab.Editor.Caret.X] ;! [pos.x]
pop [cur_editor.Caret.X] ;! [pos.x]
lea esi,[ebx-4]
call get_real_length
cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
cmp eax,[cur_editor.Caret.X] ;! eax,[pos.x]
jae @f
mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x]
@@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns]
mov eax,[cur_editor.Caret.X] ;! eax,[pos.x]
@@: cmp eax,[cur_editor.Columns.Count] ;! eax,[columns]
jbe @f
mov [cur_tab.Editor.Columns],eax ;! [columns],eax
@@: m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_tab.Editor.SelStart.Y],[cur_tab.Editor.Caret.Y] ;! [sel.y],[pos.y]
mov [cur_editor.Columns.Count],eax ;! [columns],eax
@@: m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y] ;! [sel.y],[pos.y]
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
 
.exit:
ret
1298,10 → 1298,10
;-----------------------------------------------------------------------------
call delete_selection
 
mov ecx,[cur_tab.Editor.Caret.Y] ;! ecx,[pos.y]
mov ecx,[cur_editor.Caret.Y] ;! ecx,[pos.y]
call get_line_offset
 
mov ebx,[cur_tab.Editor.Caret.X] ;! ebx,[pos.x]
mov ebx,[cur_editor.Caret.X] ;! ebx,[pos.x]
cmp bx,[esi]
jb @f
movzx ebx,word[esi]
1362,7 → 1362,7
.lp2: xor eax,eax
@@: mov edx,edi
add edi,4
mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax
mov [cur_editor.Caret.X],eax ;! [pos.x],eax
jecxz @f
push ecx
mov ecx,eax
1384,7 → 1384,7
sub ecx,[temp_buf]
 
push ecx
mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2
mov edi,[cur_editor.Lines] ;! AREA_TEMP2
add edi,[edi-4]
dec edi
lea esi,[edi+4]
1402,7 → 1402,7
lea edi,[esi+eax-4]
movzx ecx,word[ebp]
add esi,ecx;[ebp]
mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2
mov ecx,[cur_editor.Lines] ;! AREA_TEMP2
add ecx,[ecx-4]
sub ecx,esi
cld
1413,14 → 1413,14
cld
rep movsb
 
inc [cur_tab.Editor.Caret.Y] ;! [pos.y]
inc [cur_tab.Editor.SelStart.Y] ;! [sel.y]
inc [cur_tab.Editor.Lines] ;! [lines]
inc [cur_editor.Caret.Y] ;! [pos.y]
inc [cur_editor.SelStart.Y] ;! [sel.y]
inc [cur_editor.Lines.Count] ;! [lines]
 
m2m [cur_tab.Editor.SelStart.X],[cur_tab.Editor.Caret.X] ;! [sel.x],[pos.x]
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X] ;! [sel.x],[pos.x]
 
call check_inv_all
mov [cur_tab.Editor.Modified],1 ;! [modified],1
mov [cur_editor.Modified],1 ;! [modified],1
 
.exit:
ret
1444,6 → 1444,7
jb @f
mov ebp,[tab_bar.Items]
@@: call set_cur_tab
call make_tab_visible
call align_editor_in_tab
call draw_editor
call draw_tabctl
1470,6 → 1471,7
add eax,[tab_bar.Items]
lea ebp,[eax-sizeof.TABITEM]
@@: call set_cur_tab
call make_tab_visible
call align_editor_in_tab
call draw_editor
call draw_tabctl
1476,3 → 1478,14
.exit:
ret
endf
 
;-----------------------------------------------------------------------------
func key.ctrl_f4 ;///// CLOSE CURRENT TAB ////////////////////////////////////
;-----------------------------------------------------------------------------
mov ebp,[tab_bar.Current.Ptr]
call delete_tab
cmp [tab_bar.Items.Count],0
jne @f
call create_tab
@@: ret
endf