tinypad: 4GB line length limit; settings in INI file; bugfixes

git-svn-id: svn://kolibrios.org@987 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Mihail Semenyako (mike.dld) 2008-12-29 19:08:59 +00:00
parent d2029b5462
commit 7e149d6d99
14 changed files with 469 additions and 329 deletions

View File

@ -3,22 +3,38 @@ vscrl_capt dd -1
hscrl_capt dd -1
body_capt dd -1
ins_mode db 1
s_status dd 0
sz app_fasm ,'/RD/1/DEVELOP/FASM',0
sz app_board ,'/RD/1/BOARD',0
sz app_tinypad ,'/RD/1/TINYPAD',0
sz app_docpak ,'/RD/1/DOCPAK',0
sz app_fasm ,'/rd/1/develop/fasm',0
sz app_board ,'/rd/1/board',0
sz app_tinypad ,'/rd/1/tinypad',0
sz app_docpak ,'/rd/1/docpak',0
sz sysfuncs_param,'g',0
include 'tp-tables.inc'
include 'tp-locale.inc'
macro editor_lines [str, flags]
{
common
local size
forward
virtual at 0
db str
size = $
end virtual
dd size
dw flags
db str
common
dd 0
}
;// options dialog data [
label optsdlg_editor at $-EDITOR.Bounds
; rb PATHL ; FilePath db PATHL dup(?)
; dd 0 ; FileName dd ?
dd ?,?,?,? ; Bounds RECT
dd @f ; Lines dd ?
dd ? ; Lines.Size dd ?
@ -35,25 +51,16 @@ label optsdlg_editor at $-EDITOR.Bounds
db 0 ; Modified db ?
@@:
dd 0x00000000+1
db ' '
dd 0x00010000+9
db ' org 100h'
dd 0x00000000+1
db ' '
dd 0x00000000+20
db ' mov ah,09h ; write'
dd 0x00000000+12
db ' mov dx,text'
dd 0x00000000+8
db ' int 21h'
dd 0x00030000+8
db ' int 20h'
dd 0x00000000+1
db ' '
dd 0x00000000+21
db ' text db "Hello!",24h'
dd 0
editor_lines \
' ', 0, \
' org 100h', EDITOR_LINE_FLAG_MOFIFIED, \
' ', 0, \
' mov ah,09h ; write', 0, \
' mov dx,text', 0, \
' int 21h', 0, \
' int 20h', EDITOR_LINE_FLAG_MOFIFIED + EDITOR_LINE_FLAG_SAVED, \
' ', 0, \
' text db "Hello!",24h', 0
optsdlg_editor_parts: ; left,top,right,bottom,type
db 0, 12, 13, 29, 22
@ -77,10 +84,33 @@ optsdlg_editor_parts: ; left,top,right,bottom,type
;// ]
sz symbols_ex,';?.%"',"'"
sz symbols ,'#&*\:/<>|{}()[]=+-, '
sz symbols,'#&*\:/<>|{}()[]=+-, '
sz ini_sec_window ,'Window',0
sz ini_window_top ,'Top',0
sz ini_window_left ,'Left',0
sz ini_window_right ,'Right',0
sz ini_window_bottom,'Bottom',0
; INI file section/key names
sz ini_sec_window,INI_SEC_PREFIX,'window',0
sz ini_window_top,'top',0
sz ini_window_left,'left',0
sz ini_window_width,'width',0
sz ini_window_height,'height',0
sz ini_sec_colors,INI_SEC_PREFIX,'colors',0
sz ini_colors_text,'text',0
sz ini_colors_back,'back',0
sz ini_colors_text_sel,'text_sel',0
sz ini_colors_back_sel,'back_sel',0
sz ini_colors_symbol,'symbol',0
sz ini_colors_number,'number',0
sz ini_colors_string,'string',0
sz ini_colors_comment,'comment',0
sz ini_colors_line_moded,'line_moded',0
sz ini_colors_line_saved,'line_saved',0
sz ini_sec_options,INI_SEC_PREFIX,'options',0
sz ini_options_tabs_pos,'tabs_pos',0
sz ini_options_secure_sel,'secure_sel',0
sz ini_options_auto_braces,'auto_braces',0
sz ini_options_auto_indent,'auto_indent',0
sz ini_options_smart_tab,'smart_tab',0
sz ini_options_optim_save,'optim_save',0
sz ini_options_line_nums,'line_nums',0

View File

@ -1,6 +1,4 @@
self_path rb PATHL
app_start:
dd ?,?
.params dd ?
@ -106,3 +104,29 @@ exit_tab_num dd ?
temp_buf dd ?
copy_buf dd ?
label color_tbl dword
.text dd ?
.back dd ?
.text.sel dd ?
.back.sel dd ?
.symbol dd ?
.number dd ?
.string dd ?
.comment dd ?
.line.moded dd ?
.line.saved dd ?
tabs_pos db ?
secure_sel db ?
auto_braces db ?
auto_indent db ?
smart_tab db ?
optim_save db ?
line_nums db ?
mainwnd_pos:
.x dd ?
.y dd ?
.w dd ?
.h dd ?

View File

@ -15,8 +15,6 @@ proc dll.Load, import_table:dword
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
or eax,eax
jz .fail
stdcall dll.Init,[eax+4]
pop esi
add esi,8
@ -60,8 +58,10 @@ endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
.next: xor eax,eax
test edx,edx
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
@ -88,5 +88,6 @@ proc strcmp, str1:dword,str2:dword
ret
endp
s_libdir db '/rd/1/lib/'
s_libdir.fname rb 32
s_libdir:
db '/sys/lib/'
.fname rb 32

View File

@ -1,25 +1,35 @@
;-----------------------------------------------------------------------------
; Copyright (c) 2006-2007, mike.dld
;-----------------------------------------------------------------------------
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
; DEALINGS IN THE SOFTWARE.
;-----------------------------------------------------------------------------
;;================================================================================================;;
;;//// libio.inc //// (c) mike.dld, 2007-2008 ////////////////////////////////////////////////////;;
;;================================================================================================;;
;; ;;
;; This file is part of Common development libraries (Libs-Dev). ;;
;; ;;
;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;;
;; General Public License as published by the Free Software Foundation, either version 3 of the ;;
;; License, or (at your option) any later version. ;;
;; ;;
;; Libs-Dev is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;;
;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;
;; General Public License for more details. ;;
;; ;;
;; You should have received a copy of the GNU General Public License along with Libs-Dev. If not, ;;
;; see <http://www.gnu.org/licenses/>. ;;
;; ;;
;;================================================================================================;;
O_BINARY = 00000000b
O_READ = 00000001b
O_WRITE = 00000010b
O_CREATE = 00000100b
O_SHARE = 00001000b
O_TEXT = 00010000b
SEEK_SET = 0
SEEK_CUR = 1
SEEK_END = 2
struct DateTime
struct FileDateTime
union
time dd ?
struct
@ -58,22 +68,32 @@ ends
struct FileInfoA
Attributes dd ?
Flags dd ?
DateCreate DateTime
DateAccess DateTime
DateModify DateTime
FileSize dd ?
FileSizeHigh dd ?
FileName rb 264
DateCreate FileDateTime
DateAccess FileDateTime
DateModify FileDateTime
union
FileSize dq ?
struct
FileSizeLow dd ?
FileSizeHigh dd ?
ends
ends
FileName rb 252
ends
struct FileInfoW
Attributes dd ?
Flags dd ?
DateCreate DateTime
DateAccess DateTime
DateModify DateTime
FileSize dd ?
FileSizeHigh dd ?
DateCreate FileDateTime
DateAccess FileDateTime
DateModify FileDateTime
union
FileSize dq ?
struct
FileSizeLow dd ?
FileSizeHigh dd ?
ends
ends
FileName rw 260
ends
@ -89,3 +109,4 @@ FA_SYSTEM = 00000100b
FA_LABEL = 00001000b
FA_FOLDER = 00010000b
FA_ARCHIVED = 00100000b
FA_ANY = 00111111b

View File

@ -9,6 +9,10 @@ HISTORY:
- line is redrawn after lining up a single char and then deleting it
(pressing Del twice) [#1]
- update tab/window title and highlighting mode after file save
- allocate 1024 bytes in case file not found (avoid crash)
changes:
- max line length changed back to 4GB, each line overhead is 6 bytes now
- settings are stored in INI file (using libini), allowing binary to be compressed
new features:
- prompt to save modified file before closing (+fixes)
- button to close current tab (+fixes)
@ -53,7 +57,7 @@ HISTORY:
- function 70 instead of 58 for files loading/saving
- clientarea-relative drawing (less code)
- every line's dword is now splitted into 2 words;
low word - line block length, so max line length is 65535 now
low word - line block length, so max line length is 64KB now
high word - various flags. for now, only 2 of 16 bits are used:
if bit #0 is set, line was modified since file open
if bit #1 is set, line was saved after last modification

View File

@ -32,7 +32,7 @@ include 'tinypad.inc'
;purge mov,add,sub ;  SPEED
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,self_path
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,ini_path
APP_VERSION equ 'SVN (4.0.5)'
@ -44,6 +44,8 @@ FALSE = 0
;define __DEBUG_LEVEL__ 1
;include 'debug-fdo.inc'
; compiled-in options
ASEPC = '-' ; separator character (char)
ATOPH = 19 ; menu bar height (pixels)
SCRLW = 16 ; scrollbar widht/height (pixels)
@ -56,59 +58,18 @@ LCHGW = 3 ; changed/saved marker width (pixels)
STATH = 16 ; status bar height (pixels)
TBARH = 18 ; tab bar height (pixels)
;-----------------------------------------------------------------------------
section @OPTIONS ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
label color_tbl dword
.text: RGB( 0, 0, 0)
.back: RGB(255,255,255)
.text.sel: RGB(255,255,255)
.back.sel: RGB( 10, 36,106)
.symbol: RGB( 48, 48,240)
.number: RGB( 0,144, 0)
.string: RGB(176, 0, 0)
.comment: RGB(128,128,128)
.line.moded: RGB(255,238, 98)
.line.saved: RGB(108,226,108)
ins_mode db 1
tab_pos db 2
options db OPTS_AUTOINDENT+OPTS_OPTIMSAVE+OPTS_SMARTTAB
mainwnd_pos:
.x dd 250
.y dd 75
.w dd 6*80+6+SCRLW+5 ;- 220
.h dd 402 ;- 220
INI_SEC_PREFIX equ ''
;-----------------------------------------------------------------------------
section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
; fninit
; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_left,50
; mov [mainwnd_pos.x],eax
; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_top,50
; mov [mainwnd_pos.y],eax
; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_right,350
; sub eax,[mainwnd_pos.x]
; mov [mainwnd_pos.w],eax
; stdcall ini.get_int,finfo_ini,ini_sec_window,ini_window_bottom,450
; sub eax,[mainwnd_pos.y]
; mov [mainwnd_pos.h],eax
cld
mov edi,@UDATA
mov ecx,@PARAMS-@UDATA
mov al,0
rep stosb
mov al,[tab_pos]
mov [tab_bar.Style],al
mcall 68,11
or eax,eax
jz key.alt_x.close
@ -117,6 +78,15 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
or eax,eax
jnz key.alt_x.close
mov edi,ini_path
xor al,al
mov ecx,PATHL
repne scasb
mov dword[edi-1],'.ini'
mov byte[edi+3],0
stdcall load_settings
stdcall mem.Alloc,65536
mov [temp_buf],eax
@ -208,6 +178,10 @@ section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@@:
mov [s_status],0
dec [do_not_draw]
mov al,[tabs_pos]
mov [tab_bar.Style],al
mcall 66,1,1
mcall 40,00100111b
red:
@ -296,6 +270,100 @@ proc get_event ctx ;//////////////////////////////////////////////////////////
ret
endp
;-----------------------------------------------------------------------------
proc load_settings ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
pushad
invoke ini.get_int,ini_path,ini_sec_options,ini_options_tabs_pos,2
mov [tabs_pos],al
invoke ini.get_int,ini_path,ini_sec_options,ini_options_secure_sel,0
mov [secure_sel],al
invoke ini.get_int,ini_path,ini_sec_options,ini_options_auto_braces,0
mov [auto_braces],al
invoke ini.get_int,ini_path,ini_sec_options,ini_options_auto_indent,1
mov [auto_indent],al
invoke ini.get_int,ini_path,ini_sec_options,ini_options_smart_tab,1
mov [smart_tab],al
invoke ini.get_int,ini_path,ini_sec_options,ini_options_optim_save,1
mov [optim_save],al
invoke ini.get_int,ini_path,ini_sec_options,ini_options_line_nums,0
mov [line_nums],al
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_text,0x00000000
mov [color_tbl.text],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_back,0x00ffffff
mov [color_tbl.back],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_text_sel,0x00ffffff
mov [color_tbl.text.sel],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_back_sel,0x000a246a
mov [color_tbl.back.sel],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_symbol,0x003030f0
mov [color_tbl.symbol],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_number,0x00009000
mov [color_tbl.number],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_string,0x00b00000
mov [color_tbl.string],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_comment,0x00808080
mov [color_tbl.comment],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_line_moded,0x00ffee62
mov [color_tbl.line.moded],eax
invoke ini.get_color,ini_path,ini_sec_colors,ini_colors_line_saved,0x006ce26c
mov [color_tbl.line.saved],eax
invoke ini.get_int,ini_path,ini_sec_window,ini_window_left,250
mov [mainwnd_pos.x],eax
invoke ini.get_int,ini_path,ini_sec_window,ini_window_top,75
mov [mainwnd_pos.y],eax
invoke ini.get_int,ini_path,ini_sec_window,ini_window_width,6*80+6+SCRLW+5
mov [mainwnd_pos.w],eax
invoke ini.get_int,ini_path,ini_sec_window,ini_window_height,402
mov [mainwnd_pos.h],eax
popad
ret
endp
;-----------------------------------------------------------------------------
proc save_settings ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
pushad
movzx eax,[tabs_pos]
invoke ini.set_int,ini_path,ini_sec_options,ini_options_tabs_pos,eax
movzx eax,[secure_sel]
invoke ini.set_int,ini_path,ini_sec_options,ini_options_secure_sel,eax
movzx eax,[auto_braces]
invoke ini.set_int,ini_path,ini_sec_options,ini_options_auto_braces,eax
movzx eax,[auto_indent]
invoke ini.set_int,ini_path,ini_sec_options,ini_options_auto_indent,eax
movzx eax,[smart_tab]
invoke ini.set_int,ini_path,ini_sec_options,ini_options_smart_tab,eax
movzx eax,[optim_save]
invoke ini.set_int,ini_path,ini_sec_options,ini_options_optim_save,eax
movzx eax,[line_nums]
invoke ini.set_int,ini_path,ini_sec_options,ini_options_line_nums,eax
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_text,[color_tbl.text]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_back,[color_tbl.back]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_text_sel,[color_tbl.text.sel]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_back_sel,[color_tbl.back.sel]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_symbol,[color_tbl.symbol]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_number,[color_tbl.number]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_string,[color_tbl.string]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_comment,[color_tbl.comment]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_line_moded,[color_tbl.line.moded]
invoke ini.set_color,ini_path,ini_sec_colors,ini_colors_line_saved,[color_tbl.line.saved]
invoke ini.set_int,ini_path,ini_sec_window,ini_window_left,[mainwnd_pos.x]
invoke ini.set_int,ini_path,ini_sec_window,ini_window_top,[mainwnd_pos.y]
invoke ini.set_int,ini_path,ini_sec_window,ini_window_width,[mainwnd_pos.w]
invoke ini.set_int,ini_path,ini_sec_window,ini_window_height,[mainwnd_pos.h]
popad
ret
endp
;-----------------------------------------------------------------------------
proc start_fasm ;/////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
@ -408,22 +476,19 @@ set_opt:
ret
.line_numbers:
mov al,OPTS_LINENUMS
jmp .main
xor [line_nums],1
ret
.optimal_fill:
mov al,OPTS_OPTIMSAVE
jmp .main
xor [optim_save],1
ret
.auto_indents:
mov al,OPTS_AUTOINDENT
jmp .main
xor [auto_indent],1
ret
.auto_braces:
mov al,OPTS_AUTOBRACES
jmp .main
xor [auto_braces],1
ret
.secure_sel:
mov al,OPTS_SECURESEL
.main:
xor [options],al
xor [secure_sel],1
ret
;-----------------------------------------------------------------------------
@ -456,8 +521,6 @@ include 'data/tp-idata.inc'
;-----------------------------------------------------------------------------
section @IMPORT ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;-----------------------------------------------------------------------------
;align 16
;@IMPORT:
library \
libini,'libini.obj',\
@ -465,10 +528,12 @@ library \
libgfx,'libgfx.obj'
import libini, \
ini.get_str,'ini.get_str',\
ini.set_str,'ini.set_str',\
ini.get_int,'ini.get_int',\
ini.set_int,'ini.set_int'
ini.get_str ,'ini.get_str',\
ini.set_str ,'ini.set_str',\
ini.get_int ,'ini.get_int',\
ini.set_int ,'ini.set_int',\
ini.get_color,'ini.get_color',\
ini.set_color,'ini.set_color'
import libio, \
file.find_first,'file.find_first',\
@ -520,6 +585,8 @@ p_info process_information
p_info2 process_information
sc system_colors
ini_path rb PATHL
rb 1024*4
MAIN_STACK:
rb 1024*4

View File

@ -48,6 +48,14 @@ struct EDITOR
db ?
ends
struct EDITOR_LINE_DATA
Size dd ?
Flags dw ?
ends
EDITOR_LINE_FLAG_MOFIFIED = 0x0001
EDITOR_LINE_FLAG_SAVED = 0x0002
struct TABITEM
Editor EDITOR
ends
@ -201,15 +209,6 @@ macro menubar_res _name,[_lang,_title,_popup,_onshow]
end if
}
;// OPTIONS
OPTS_SECURESEL = 00000001b
OPTS_AUTOBRACES = 00000010b
OPTS_AUTOINDENT = 00000100b
OPTS_SMARTTAB = 00001000b
OPTS_OPTIMSAVE = 00010000b
OPTS_LINENUMS = 00100000b
;// MOUSE EVENTS
MEV_LDOWN = 1

View File

@ -70,8 +70,8 @@ endp
;-----------------------------------------------------------------------------
proc get_real_length ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
movzx eax,word[esi]
@@: cmp byte[esi+eax+4-1],' '
mov eax,[esi+EDITOR_LINE_DATA.Size]
@@: cmp byte[esi+eax+sizeof.EDITOR_LINE_DATA-1],' '
jne @f
dec eax
jnz @b
@ -90,8 +90,8 @@ proc get_line_offset ;////////////////////////////////////////////////////////
mov esi,[cur_editor.Lines]
@@: dec ecx
js .exit
movzx eax,word[esi]
lea esi,[esi+eax+4]
mov eax,[esi+EDITOR_LINE_DATA.Size]
lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA]
jmp @b
.exit:
pop ecx eax
@ -358,22 +358,22 @@ proc line_add_spaces ;////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
xor eax,eax
pushad
movzx edx,word[esi]
mov edx,[esi+EDITOR_LINE_DATA.Size]
cmp ecx,edx
jbe .exit
sub ecx,edx
lea eax,[ecx+4]
lea eax,[ecx+sizeof.EDITOR_LINE_DATA]
call editor_realloc_lines
mov [esp+4*7],eax
add esi,eax
push ecx
mov edi,[cur_editor.Lines]
add edi,[edi-4]
add edi,[cur_editor.Lines.Size] ; !!! CHECK THIS!!! add edi,[edi-4]
dec edi
mov eax,esi
mov esi,edi
sub esi,ecx
lea ecx,[eax+4]
lea ecx,[eax+sizeof.EDITOR_LINE_DATA]
add ecx,edx
push ecx
neg ecx
@ -381,7 +381,7 @@ proc line_add_spaces ;////////////////////////////////////////////////////////
std
rep movsb
pop edi ecx
add [eax],cx
add [eax+EDITOR_LINE_DATA.Size],ecx
mov al,' '
cld
rep stosb
@ -403,25 +403,25 @@ proc delete_selection ;///////////////////////////////////////////////////////
cmp ecx,[sel.end.y]
je .single_line
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
mov ecx,[sel.begin.x]
call line_add_spaces
add esi,eax
lea edi,[esi+4]
lea edi,[esi+sizeof.EDITOR_LINE_DATA]
mov ecx,[sel.end.y]
call get_line_offset
call get_real_length
cmp eax,[sel.end.x]
jbe @f
mov eax,[sel.end.x]
@@: movzx ecx,word[esi]
@@: mov ecx,[esi+EDITOR_LINE_DATA.Size]
sub ecx,eax
mov ebx,[sel.begin.x]
add ebx,ecx
mov [edi-4],bx
mov [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],ebx
add edi,[sel.begin.x]
lea esi,[esi+eax+4]
lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA]
mov ecx,[cur_editor.Lines]
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
sub ecx,esi
@ -434,8 +434,8 @@ proc delete_selection ;///////////////////////////////////////////////////////
.single_line:
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
call get_real_length
cmp eax,[sel.begin.x]
jbe .exit
@ -444,8 +444,8 @@ proc delete_selection ;///////////////////////////////////////////////////////
jbe @f
mov ecx,eax
@@: sub ecx,[sel.begin.x]
sub [esi],cx
lea edi,[esi+4]
sub [esi+EDITOR_LINE_DATA.Size],ecx
lea edi,[esi+sizeof.EDITOR_LINE_DATA]
add edi,[sel.begin.x]
lea esi,[edi+ecx]
mov ecx,[cur_editor.Lines]
@ -464,8 +464,8 @@ proc delete_selection ;///////////////////////////////////////////////////////
mov ecx,[cur_editor.Lines.Count]
call get_line_offset
movzx eax,word[esi]
lea esi,[esi+eax+4]
mov eax,[esi+EDITOR_LINE_DATA.Size]
lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA]
mov eax,[cur_editor.Lines]
add eax,[cur_editor.Lines.Size] ;*** add eax,[eax-4]
sub esi,eax

View File

@ -350,8 +350,9 @@ optsdlg_handler:
jmp .draw_color.2
.draw_editor:
push dword[options] [tab_bar.Current.Ptr]
mov [options],0
;push dword[options] [tab_bar.Current.Ptr]
push [tab_bar.Current.Ptr]
;mov [options],0
mov ebp,optsdlg_editor
call set_cur_tab
@ -366,8 +367,9 @@ optsdlg_handler:
call draw_editor
call .xchg_colors
pop ebp eax
mov [options],al
;pop ebp eax
pop ebp
;mov [options],al
call set_cur_tab
ret
@ -383,7 +385,7 @@ optsdlg_handler:
dec ecx
mcall 8,,,0x40000000+21001
mov esi,[cl_3d_normal]
mov al,[tab_pos]
mov al,[tabs_pos]
TPOSH = 6
TPOSW = 10
@ -687,16 +689,18 @@ botdlg.button:
mov [bot_mode],al
mov [bot_dlg_height],eax
call optsdlg_handler.xchg_colors
mov al,[tab_pos]
mov al,[tabs_pos]
mov [tab_bar.Style],al
stdcall save_settings
call drawwindow
ret
tabpos_round db 4,3,1,2
btn.bot.tabpos:
movzx eax,[tab_pos]
movzx eax,[tabs_pos]
mov al,[tabpos_round+eax-1]
mov [tab_pos],al
mov [tabs_pos],al
@@: call optsdlg_handler.draw_tabpos
ret

View File

@ -16,7 +16,7 @@ proc draw_editor ;///// DRAW EDITOR //////////////////////////////////////////
call draw_framerect
mov [cur_editor.Gutter.Visible],0
test [options],OPTS_LINENUMS
test [line_nums],1
jnz @f
xor eax,eax
jmp .lp1
@ -574,14 +574,12 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
.lp6:
mcall 13
lodsd
pushad
mov edx,[color_tbl.back]
test eax,0x00010000
test [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
jz @f
mov edx,[color_tbl.line.moded]
test eax,0x00020000
test [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_SAVED
jz @f
mov edx,[color_tbl.line.saved]
@@: mov ebx,[left_ofs]
@ -593,8 +591,9 @@ proc draw_editor_text ;///// DRAW EDITOR TEXT ////////////////////////////////
popad
xor ecx,ecx
and eax,0x0000FFFF
mov eax,[esi+EDITOR_LINE_DATA.Size]
mov [cur_line_len],eax
add esi,sizeof.EDITOR_LINE_DATA
or eax,eax
ja .next_block

View File

@ -17,8 +17,8 @@ proc save_file ;//////////////////////////////////////////////////////////////
mov ecx,[cur_editor.Lines.Count]
@@: call get_real_length
add ebx,eax
movzx eax,word[esi]
lea esi,[esi+eax+4]
mov eax,[esi+EDITOR_LINE_DATA.Size]
lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA]
loop @b
mov eax,[cur_editor.Lines.Count]
shl eax,1
@ -30,7 +30,7 @@ proc save_file ;//////////////////////////////////////////////////////////////
.new_string:
call save_string
cmp dword[esi],0
cmp dword[esi+EDITOR_LINE_DATA.Size],0
jne .new_string
pop eax
sub edi,eax
@ -64,11 +64,11 @@ endp
;-----------------------------------------------------------------------------
proc save_string ;////////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
movzx ecx,word[esi]
test dword[esi],0x00010000
mov ecx,[esi+EDITOR_LINE_DATA.Size]
test [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
jz @f
or dword[esi],0x00020000
@@: add esi,4
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_SAVED
@@: add esi,sizeof.EDITOR_LINE_DATA
@@: cmp byte[esi+ecx-1],' '
jne @f
@ -81,7 +81,7 @@ proc save_string ;////////////////////////////////////////////////////////////
.next_char:
mov al,[esi+ebx]
inc ebx
test [options],OPTS_OPTIMSAVE
test [optim_save],1
jz .put
test ah,00000001b
jnz .char
@ -127,8 +127,7 @@ proc save_string ;////////////////////////////////////////////////////////////
.endcopy:
mov eax,0x0A0D
stosw
movzx eax,word[esi-4]
add esi,eax;[esi-4]
add esi,[esi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size]
ret
endp
@ -174,7 +173,10 @@ proc load_file ;//////////////////////////////////////////////////////////////
mcall 70,f_info70
mov [f_info70+0],0
mov eax,dword[file_info.Size]
mov [f_info70+12],eax
or eax, eax
jnz @f
mov eax, 1024
@@: mov [f_info70+12],eax
stdcall mem.Alloc,eax
mov [f_info70+16],eax
mcall 70,f_info70
@ -233,7 +235,7 @@ proc load_from_memory ;///////////////////////////////////////////////////////
call get_lines_in_file
mov [ebp+EDITOR.Lines.Count],eax
lea edx,[ebx+ecx]
imul ebx,eax,14
imul ebx,eax,16
add ebx,edx
mov [ebp+EDITOR.Lines.Size],ebx
stdcall mem.ReAlloc,[ebp+EDITOR.Lines],ebx
@ -245,7 +247,7 @@ proc load_from_memory ;///////////////////////////////////////////////////////
.next_line:
mov ebx,edi
add edi,4
add edi,sizeof.EDITOR_LINE_DATA
.next_char:
or edx,edx
jle .exit
@ -266,10 +268,10 @@ proc load_from_memory ;///////////////////////////////////////////////////////
mov ecx,10
mov al,' '
rep stosb
lea eax,[edi-4]
lea eax,[edi-sizeof.EDITOR_LINE_DATA]
sub eax,ebx
mov [ebx],eax
mov dword[ebx+eax+4],0
mov [ebx+EDITOR_LINE_DATA.Size],eax
mov [ebx+eax+sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],0
sub eax,10
jnz @f
inc eax
@ -286,16 +288,16 @@ proc load_from_memory ;///////////////////////////////////////////////////////
.LF: mov ecx,10
mov al,' '
rep stosb
lea eax,[edi-4]
lea eax,[edi-sizeof.EDITOR_LINE_DATA]
sub eax,ebx
mov [ebx],eax
mov [ebx+EDITOR_LINE_DATA.Size],eax
add eax,-10
cmp eax,[ebp+EDITOR.Columns.Count]
jbe .next_line
mov [ebp+EDITOR.Columns.Count],eax
jmp .next_line
.TB: lea eax,[edi-4]
.TB: lea eax,[edi-sizeof.EDITOR_LINE_DATA]
sub eax,ebx
mov ecx,eax
add ecx,ATABW

View File

@ -78,7 +78,7 @@ key:
mov esi,accel_table_main
.acc: cmp eax,[esi]
jne @f
test [options],OPTS_SECURESEL
test [secure_sel],1
jz .lp1
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
@ -102,14 +102,14 @@ key:
movzx eax,[eax+key1]
push eax
test [options],OPTS_SECURESEL
test [secure_sel],1
jz .lp2
m2m [cur_editor.SelStart.X],[cur_editor.Caret.X]
m2m [cur_editor.SelStart.Y],[cur_editor.Caret.Y]
jmp .put
.lp2: call delete_selection
test [options],OPTS_AUTOBRACES
test [auto_braces],1
jz .put
cmp al,'['
jne @f
@ -274,12 +274,12 @@ proc key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
cld
mov ecx,ebx
call get_line_offset
.lp1: cmp dx,[esi]
.lp1: cmp edx,[esi+EDITOR_LINE_DATA.Size]
jle @f
movzx edx,word[esi]
mov edx,[esi+EDITOR_LINE_DATA.Size]
@@: dec edx
jl .nx1
add esi,4
add esi,sizeof.EDITOR_LINE_DATA
add esi,edx
mov ecx,edx
@@: push ecx
@ -297,18 +297,18 @@ proc key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
js .exit.2
mov ecx,ebx
call get_line_offset
movzx edx,word[esi]
mov edx,[esi+EDITOR_LINE_DATA.Size]
dec edx
jmp .lp1
@@:
mov ecx,ebx
call get_line_offset
.lp2: cmp dx,[esi]
.lp2: cmp edx,[esi+EDITOR_LINE_DATA.Size]
jle @f
movzx edx,word[esi]
mov edx,[esi+EDITOR_LINE_DATA.Size]
@@: or edx,edx
jl .nx2
add esi,4
add esi,sizeof.EDITOR_LINE_DATA
add esi,edx
@@: mov edi,symbols_ex
mov ecx,symbols_ex.size+symbols.size
@ -323,7 +323,7 @@ proc key.ctrl_left ;///// GO TO PREVIOUS WORD ////////////////////////////////
js .exit.2
mov ecx,ebx
call get_line_offset
movzx edx,word[esi]
mov edx,[esi+EDITOR_LINE_DATA.Size]
dec edx
jmp .lp2
@@:
@ -367,10 +367,10 @@ proc key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
cld
.lp1: mov ecx,ebx
call get_line_offset
movzx ecx,word[esi]
mov ecx,[esi+EDITOR_LINE_DATA.Size]
cmp edx,ecx
jge .nx1
add esi,4
add esi,sizeof.EDITOR_LINE_DATA
add esi,edx
sub ecx,edx
@@: push ecx
@ -392,10 +392,10 @@ proc key.ctrl_right ;///// GO TO NEXT WORD ///////////////////////////////////
.lp2: mov ecx,ebx
call get_line_offset
movzx ecx,word[esi]
mov ecx,[esi+EDITOR_LINE_DATA.Size]
cmp edx,ecx
jge .nx2
add esi,4
add esi,sizeof.EDITOR_LINE_DATA
add esi,edx
sub ecx,edx
@@: push ecx
@ -477,8 +477,9 @@ proc key.ctrl_c
jge @f
xor eax,eax
@@: add esi,[sel.begin.x]
add esi,4
stosd
add esi,sizeof.EDITOR_LINE_DATA
mov [edi+EDITOR_LINE_DATA.Size],eax
add edi,sizeof.EDITOR_LINE_DATA
mov ecx,eax
jecxz @f
rep movsb
@ -494,13 +495,14 @@ proc key.ctrl_c
rep movsb
mov ecx,[sel.end.y]
@@: call get_line_offset
movzx eax,word[esi]
add esi,4
mov eax,[esi+EDITOR_LINE_DATA.Size]
add esi,sizeof.EDITOR_LINE_DATA
cmp eax,[sel.end.x]
jle @f
mov eax,[sel.end.x]
@@: mov ebx,edi
stosd
mov [edi+EDITOR_LINE_DATA.Size],eax
add edi,sizeof.EDITOR_LINE_DATA
mov ecx,eax
jecxz @f
rep movsb
@ -524,19 +526,20 @@ proc key.ctrl_c
mov eax,[sel.end.x]
sub eax,[sel.begin.x]
mov edi,[copy_buf]
stosd
mov [edi+EDITOR_LINE_DATA.Size],eax
add edi,sizeof.EDITOR_LINE_DATA
mov ecx,[sel.begin.y]
call get_line_offset
mov ebx,[sel.begin.x]
mov ecx,[sel.end.x]
cmp ebx,[esi]
cmp ebx,[esi+EDITOR_LINE_DATA.Size]
jge .add_spaces
cmp ecx,[esi]
cmp ecx,[esi+EDITOR_LINE_DATA.Size]
jle .lp1
mov ecx,[esi]
mov ecx,[esi+EDITOR_LINE_DATA.Size]
.lp1: sub ecx,[sel.begin.x]
sub eax,ecx
lea esi,[esi+ebx+4]
lea esi,[esi+ebx+sizeof.EDITOR_LINE_DATA]
rep movsb
.add_spaces:
@ -565,20 +568,20 @@ proc key.ctrl_v
mov ecx,[cur_editor.Caret.Y]
call get_line_offset
pushd [esi] esi
pushd [esi+EDITOR_LINE_DATA.Size] esi
mov ecx,[cur_editor.Caret.X]
call line_add_spaces
add [esp],eax
add esi,eax
mov ecx,[copy_size]
sub ecx,4
sub ecx,sizeof.EDITOR_LINE_DATA
mov edi,[cur_editor.Lines]
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
dec edi
mov eax,esi
mov esi,edi
sub esi,ecx
lea ecx,[eax+4]
lea ecx,[eax+sizeof.EDITOR_LINE_DATA]
add ecx,[cur_editor.Caret.X]
neg ecx
lea ecx,[esi+ecx+1]
@ -591,30 +594,32 @@ proc key.ctrl_v
cld
pop edi
add edi,4
add edi,sizeof.EDITOR_LINE_DATA
mov esi,[copy_buf]
lodsd
mov eax,[esi+EDITOR_LINE_DATA.Size]
add esi,sizeof.EDITOR_LINE_DATA
mov ebx,[cur_editor.Caret.X]
add eax,ebx
mov [edi-4],ax
mov byte[edi-4+2],0x0001
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
sub eax,ebx
call .check_columns
add edi,ebx
@@: push ecx
mov ecx,eax
rep movsb
lodsd
and eax,0x0000FFFF
stosd
mov byte[edi-4+2],0x0001
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
pop ecx
loop @b
pop ecx
sub ecx,ebx
add [edi-4],cx
add [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],ecx
call .check_columns
mov ecx,eax
rep movsb
@ -633,12 +638,13 @@ proc key.ctrl_v
.single_line:
cld
pop edi
add edi,4
add edi,sizeof.EDITOR_LINE_DATA
mov esi,[copy_buf]
lodsd
add [edi-4],ax
and dword[edi-4],not 0x00020000
or dword[edi-4],0x00010000
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
call .check_columns
add edi,[cur_editor.Caret.X]
add esp,4
@ -655,7 +661,7 @@ proc key.ctrl_v
.check_columns:
push eax
movzx eax,word[edi-4]
mov eax,[edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size]
cmp eax,[cur_editor.Columns.Count]
jbe @f
mov [cur_editor.Columns.Count],eax
@ -666,7 +672,7 @@ endp
;-----------------------------------------------------------------------------
proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
;-----------------------------------------------------------------------------
mov eax,94
mov eax,90+sizeof.EDITOR_LINE_DATA
call editor_realloc_lines
mov ecx,[cur_editor.Caret.Y]
@ -675,14 +681,14 @@ proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
mov ecx,[cur_editor.Lines.Count]
call get_line_offset
lea edi,[esi+90+4]
lea ecx,[esi+4]
lea edi,[esi+90+sizeof.EDITOR_LINE_DATA]
lea ecx,[esi+sizeof.EDITOR_LINE_DATA]
sub ecx,ebx
std
rep movsb
lea edi,[ebx+5]
mov word[ebx],90
lea edi,[ebx+sizeof.EDITOR_LINE_DATA+1]
mov [ebx+EDITOR_LINE_DATA.Size],90
mov al,ASEPC
mov ecx,79
cld
@ -690,7 +696,7 @@ proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
mov al,' '
mov ecx,10
rep stosb
mov byte[ebx+4],';'
mov byte[ebx+sizeof.EDITOR_LINE_DATA],';'
inc [cur_editor.Lines.Count]
inc [cur_editor.Caret.Y]
@ -713,9 +719,8 @@ proc key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
mov ecx,[cur_editor.Caret.Y]
call get_line_offset
mov edi,esi
lodsd
and eax,0x0000FFFF
add esi,eax
mov eax,[esi+EDITOR_LINE_DATA.Size]
lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA]
push eax
dec [cur_editor.Lines.Count]
@ -727,7 +732,7 @@ proc key.ctrl_y ;///// DELETE CURRENT LINE ///////////////////////////////////
rep movsd
pop eax
add eax,4
add eax,sizeof.EDITOR_LINE_DATA
neg eax
call editor_realloc_lines
@ -1033,9 +1038,9 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
mov ecx,[cur_editor.Caret.Y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
lea ebx,[esi+4]
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]
mov ebp,esi
call get_real_length
@ -1047,7 +1052,7 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
jae .line_up
lea edi,[ebx+ecx]
neg ecx
movzx eax,word[ebp]
mov eax,[ebp+EDITOR_LINE_DATA.Size]
add ecx,eax;[ebp]
repe scasb
je .line_up
@ -1057,7 +1062,7 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
add edi,ecx
lea esi,[edi+1]
neg ecx
movzx eax,word[ebp]
mov eax,[ebp+EDITOR_LINE_DATA.Size]
add ecx,eax;[ebp]
dec ecx
rep movsb
@ -1074,27 +1079,27 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
cmp eax,[cur_editor.Caret.Y]
je .exit
mov edi,[temp_buf]
add edi,4
add edi,sizeof.EDITOR_LINE_DATA
mov esi,ebx
mov ecx,[cur_editor.Caret.X]
rep movsb
mov ecx,[cur_editor.Caret.X]
mov eax,[temp_buf]
mov [eax],ecx
cmp cx,[ebp]
mov [eax+EDITOR_LINE_DATA.Size],ecx
cmp ecx,[ebp+EDITOR_LINE_DATA.Size]
jbe @f
movzx eax,word[ebp]
mov eax,[ebp+EDITOR_LINE_DATA.Size]
sub ecx,eax
sub edi,ecx
mov al,' '
rep stosb
@@: lea esi,[ebx+4]
movzx eax,word[ebp]
@@: lea esi,[ebx+sizeof.EDITOR_LINE_DATA]
mov eax,[ebp+EDITOR_LINE_DATA.Size]
add esi,eax
movzx ecx,word[esi-4]
mov ecx,[esi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size]
mov eax,[temp_buf]
add [eax],ecx
or dword[eax],0x00010000
add [eax+EDITOR_LINE_DATA.Size],ecx
or [eax+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
rep movsb
mov ecx,edi
@ -1110,14 +1115,13 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
mov edi,[cur_editor.Lines]
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
dec edi
lea esi,[edi+8]
lea esi,[edi+sizeof.EDITOR_LINE_DATA*2] ; !!! CHECK THIS !!!
sub esi,ecx
movzx eax,word[ebp]
mov eax,[ebp+EDITOR_LINE_DATA.Size]
add esi,eax
movzx eax,word[ebp]
movzx eax,word[ebp+eax+4]
mov eax,[ebp+eax+sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size]
add esi,eax
lea ecx,[esi-4]
lea ecx,[esi-sizeof.EDITOR_LINE_DATA]
sub ecx,ebp
std
cmp esi,edi
@ -1125,10 +1129,10 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
jz .lp1
mov edi,ebp
add edi,[esp]
lea esi,[ebp+8]
movzx eax,word[esi-8]
lea esi,[ebp+sizeof.EDITOR_LINE_DATA*2] ; !!! CHECK THIS !!!
mov eax,[esi-sizeof.EDITOR_LINE_DATA*2+EDITOR_LINE_DATA.Size] ; !!! CHECK THIS !!!
add esi,eax
movzx eax,word[esi-4]
mov eax,[esi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size] ; !!! CHECK THIS !!!
add esi,eax
mov ecx,[cur_editor.Lines]
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
@ -1153,8 +1157,8 @@ proc key.del ;///// DELETE NEXT CHAR OR SELECTION ////////////////////////////
mov ecx,[cur_editor.Lines.Count]
call get_line_offset
movzx eax,word[esi]
lea esi,[esi+eax+4]
mov eax,[esi+EDITOR_LINE_DATA.Size]
lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA]
mov eax,[cur_editor.Lines]
add eax,[cur_editor.Lines.Size] ;*** add eax,[eax-4]
sub esi,eax
@ -1191,8 +1195,8 @@ proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
dec [cur_editor.Caret.X]
mov ecx,[cur_editor.Caret.Y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
mov ebx,eax
call get_real_length
@ -1202,10 +1206,10 @@ proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
mov [cur_editor.Modified],1
ret
@@: lea edi,[esi+4+ebx]
@@: lea edi,[esi+sizeof.EDITOR_LINE_DATA+ebx]
mov ecx,ebx
neg ecx
movzx eax,word[esi]
mov eax,[esi+EDITOR_LINE_DATA.Size]
add ecx,eax
dec ecx
lea esi,[edi+1]
@ -1225,12 +1229,12 @@ proc key.bkspace ;///// DELETE PREVIOUS CHAR OR SELECTION ////////////////////
@@: mov ecx,[cur_editor.Caret.Y]
dec ecx
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
mov ebp,esi
lea ebx,[esi+4]
movzx ecx,word[ebp]
lea ebx,[esi+sizeof.EDITOR_LINE_DATA]
mov ecx,[ebp+EDITOR_LINE_DATA.Size]
@@: cmp byte[ebx+ecx-1],' '
jne @f
dec ecx
@ -1258,8 +1262,8 @@ proc key.tab ;///// TABULATE /////////////////////////////////////////////////
pop eax
mov ecx,[cur_editor.Caret.Y]
call get_line_offset
and dword[esi],not 0x00020000
or dword[esi],0x00010000
and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED
or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
xchg eax,ecx
@ -1267,7 +1271,7 @@ proc key.tab ;///// TABULATE /////////////////////////////////////////////////
cmp eax,[cur_editor.Caret.X]
jae @f
mov eax,[cur_editor.Caret.X]
@@: movzx edx,word[esi]
@@: mov edx,[esi+EDITOR_LINE_DATA.Size]
sub edx,eax
cmp ecx,edx
jl @f
@ -1282,8 +1286,8 @@ proc key.tab ;///// TABULATE /////////////////////////////////////////////////
dec ecx
mov edi,ecx
add ecx,-10+1
movzx eax,word[esi]
lea eax,[esi+eax+4]
mov eax,[esi+EDITOR_LINE_DATA.Size]
lea eax,[esi+eax+sizeof.EDITOR_LINE_DATA]
sub ecx,eax
lea esi,[edi-10]
std
@ -1292,11 +1296,11 @@ proc key.tab ;///// TABULATE /////////////////////////////////////////////////
mov al,' '
rep stosb
popad
add word[esi],10
add [esi+EDITOR_LINE_DATA.Size],10
jmp @b
@@: lea ebx,[esi+4]
@@: lea ebx,[esi+sizeof.EDITOR_LINE_DATA]
push ecx
movzx edi,word[esi]
mov edi,[esi+EDITOR_LINE_DATA.Size]
lea edi,[ebx+edi-1]
mov esi,edi
sub esi,ecx
@ -1310,7 +1314,7 @@ proc key.tab ;///// TABULATE /////////////////////////////////////////////////
rep stosb
cld
pop [cur_editor.Caret.X]
lea esi,[ebx-4]
lea esi,[ebx-sizeof.EDITOR_LINE_DATA]
call get_real_length
cmp eax,[cur_editor.Caret.X]
jae @f
@ -1338,9 +1342,9 @@ proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
call get_line_offset
mov ebx,[cur_editor.Caret.X]
cmp bx,[esi]
cmp ebx,[esi+EDITOR_LINE_DATA.Size]
jb @f
movzx ebx,word[esi]
mov ebx,[esi+EDITOR_LINE_DATA.Size]
dec ebx
jns @f
xor ebx,ebx
@ -1352,24 +1356,25 @@ proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
lea ecx,[ebx+1]
@@: dec ecx
jz @f
cmp byte[esi+ecx+4-1],' '
cmp byte[esi+ecx+sizeof.EDITOR_LINE_DATA-1],' '
je @b
@@: lea eax,[ecx+10]
or eax,0x00010000
stosd
mov [edi+EDITOR_LINE_DATA.Size],eax
mov [edi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
add edi,sizeof.EDITOR_LINE_DATA
jecxz @f
push esi
add esi,4
add esi,sizeof.EDITOR_LINE_DATA
rep movsb
pop esi
@@: mov al,' '
mov ecx,10
rep stosb
movzx ecx,word[esi]
mov ecx,[esi+EDITOR_LINE_DATA.Size]
sub ecx,ebx
add esi,ebx
add esi,4
add esi,sizeof.EDITOR_LINE_DATA
inc ecx
@@: dec ecx
jz @f
@ -1380,24 +1385,24 @@ proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
jne .lp1
inc esi
loop @b
.lp1: test [options],OPTS_AUTOINDENT
.lp1: test [auto_indent],1
jz .lp2
push edi ecx
movzx ecx,word[ebp]
lea edi,[ebp+4]
mov ecx,[ebp+EDITOR_LINE_DATA.Size]
lea edi,[ebp+sizeof.EDITOR_LINE_DATA]
mov al,' '
repe scasb
mov eax,ecx
pop ecx edi
je .lp2
neg eax
movzx edx,word[ebp]
mov edx,[ebp+EDITOR_LINE_DATA.Size]
add eax,edx;[ebp]
dec eax
jmp @f
.lp2: xor eax,eax
@@: mov edx,edi
add edi,4
add edi,sizeof.EDITOR_LINE_DATA
mov [cur_editor.Caret.X],eax
jecxz @f
push ecx
@ -1411,10 +1416,10 @@ proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
mov al,' '
rep stosb
lea eax,[edi-4]
lea eax,[edi-sizeof.EDITOR_LINE_DATA]
sub eax,edx
or eax,0x00010000
mov [edx],eax
mov [edx+EDITOR_LINE_DATA.Size],eax
mov [edx+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED
mov ecx,edi
sub ecx,[temp_buf]
@ -1423,20 +1428,20 @@ proc key.return ;///// CARRIAGE RETURN ///////////////////////////////////////
mov edi,[cur_editor.Lines]
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
dec edi
lea esi,[edi+4]
lea esi,[edi+sizeof.EDITOR_LINE_DATA]
sub esi,ecx
movzx ecx,word[ebp]
mov ecx,[ebp+EDITOR_LINE_DATA.Size]
add esi,ecx
lea ecx,[esi-4]
lea ecx,[esi-sizeof.EDITOR_LINE_DATA]
sub ecx,ebp
std
cmp esi,edi
jb @f
je .lp3
lea esi,[ebp+4]
lea esi,[ebp+sizeof.EDITOR_LINE_DATA]
mov eax,[esp]
lea edi,[esi+eax-4]
movzx ecx,word[ebp]
lea edi,[esi+eax-sizeof.EDITOR_LINE_DATA]
mov ecx,[ebp+EDITOR_LINE_DATA.Size]
add esi,ecx
mov ecx,[cur_editor.Lines]
add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4]
@ -1593,29 +1598,13 @@ proc key.alt_x ;///// EXIT PROGRAM ///////////////////////////////////////////
.direct:
call try_to_close_tabs
or eax,eax
jz .close
jz @f
mov [bot_mode2],2
jmp key.ctrl_o.direct
@@: stdcall save_settings
.close:
mov esi,self_path
mov byte[esi+PATHL-1],0
mov edi,f_info.path
cld
@@: lodsb
stosb
or al,al
jnz @b
mov [f_info70+0],2
mov [f_info70+4],0
mov [f_info70+8],0
mov [f_info70+12],TINYPAD_END
mov [f_info70+16],0
mov byte[f_info70+20],0
mov [f_info70+21],f_info.path
mcall 70,f_info70
mov [main_closed],1
mcall -1
endp

View File

@ -260,23 +260,23 @@ onshow:
;mov word[mm.Options+0],0
mov byte[mm.Options+5],0
or byte[mm.Options+2],0x02
test [options],OPTS_SECURESEL
test [secure_sel],1
jnz @f
and byte[mm.Options+2],0xFD
@@: or byte[mm.Options+3],0x02
test [options],OPTS_AUTOBRACES
test [auto_braces],1
jnz @f
and byte[mm.Options+3],0xFD
@@: or byte[mm.Options+4],0x02
test [options],OPTS_AUTOINDENT
test [auto_indent],1
jnz @f
and byte[mm.Options+4],0xFD
@@: or byte[mm.Options+6],0x02
test [options],OPTS_OPTIMSAVE
test [optim_save],1
jnz @f
and byte[mm.Options+6],0xFD
@@: or byte[mm.Options+8],0x02
test [options],OPTS_LINENUMS
test [line_nums],1
jnz @f
and byte[mm.Options+8],0xFD
@@: ret

View File

@ -101,9 +101,9 @@ proc create_tab ;///// ADD TAB TO THE END ////////////////////////////////////
mov [cur_editor.SelStart.X],eax
mov [cur_editor.SelStart.Y],eax
mov edi,[cur_editor.Lines]
add edi,4
add edi,sizeof.EDITOR_LINE_DATA
mov ecx,10
mov [edi-4],ecx
mov [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],ecx
mov [edi+10],eax
mov al,' '
cld