Tinypad - fix for crash when "paste" from clipboard in some cases.

git-svn-id: svn://kolibrios.org@4566 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2014-02-09 18:17:39 +00:00
parent f52363903f
commit 9443bf38d2
4 changed files with 25 additions and 18 deletions

View File

@ -108,6 +108,7 @@ exit_tab_num dd ?
temp_buf dd ?
copy_buf dd ?
clipboard_buf dd ?
size_of_moving_area dd ?
label color_tbl dword
.text dd ?

View File

@ -41,7 +41,6 @@ APP_VERSION equ 'SVN (4.0.8)'
TRUE = 1
FALSE = 0
;include 'debug.inc'
;define __DEBUG__ 1
;define __DEBUG_LEVEL__ 1
;include '../../../debug-fdo.inc'

View File

@ -96,14 +96,14 @@ get_from_clipboard:
.yes_valid_text:
call know_number_line_breaks
mov [copy_count],ebx
; correction of erroneous buffer size
mov eax,[clipboard_buf]
sub esi,eax
mov [eax],esi
; multiple by 6
shl ebx,1
lea ebx,[ebx*3]
; calculating a desired size
mov eax,[clipboard_buf]
mov eax,[eax]
sub eax,4*3
@ -249,7 +249,7 @@ know_number_line_breaks:
lodsb
test al,al
jz .end_of_data_1
jz .end_of_data
cmp al,0x0d
je .check_0x0a
@ -281,17 +281,8 @@ know_number_line_breaks:
dec ecx
jnz @b
;--------------------------------------
.end_of_data_1:
cmp [esi-2],byte 0x0d
je .end_of_data
cmp [esi-2],byte 0x0a
je .end_of_data
inc ebx
inc esi
;--------------------------------------
.end_of_data:
inc ebx
add ebx,2
inc esi
ret
;-----------------------------------------------------------------------------

View File

@ -610,7 +610,12 @@ proc key.ctrl_v
add [esp],eax
add esi,eax
mov ecx,[copy_size]
mov edi,[copy_count]
test edi,edi
dec edi
jnz @f
sub ecx,sizeof.EDITOR_LINE_DATA
@@:
mov edi,[cur_editor.Lines]
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
dec edi
@ -621,6 +626,7 @@ proc key.ctrl_v
add ecx,[cur_editor.Caret.X]
neg ecx
lea ecx,[esi+ecx+1]
mov [size_of_moving_area],ecx
std
rep movsb
@ -655,11 +661,22 @@ proc key.ctrl_v
pop ecx
sub ecx,ebx
ja @f
pusha
mov esi,edi
sub edi,sizeof.EDITOR_LINE_DATA
mov ecx,[size_of_moving_area]
cld
rep movsb
popa
jmp .save_cur_editor_values
@@:
add [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],ecx
call .check_columns
mov ecx,eax
rep movsb
.save_cur_editor_values:
mov [cur_editor.Caret.X],eax
mov [cur_editor.SelStart.X],eax
mov eax,[copy_count]
@ -716,7 +733,6 @@ proc key.ctrl_v
@@: pop eax
ret
endp
;-----------------------------------------------------------------------------
proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
;-----------------------------------------------------------------------------