forked from KolibriOS/kolibrios
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:
parent
f52363903f
commit
9443bf38d2
@ -108,6 +108,7 @@ exit_tab_num dd ?
|
|||||||
temp_buf dd ?
|
temp_buf dd ?
|
||||||
copy_buf dd ?
|
copy_buf dd ?
|
||||||
clipboard_buf dd ?
|
clipboard_buf dd ?
|
||||||
|
size_of_moving_area dd ?
|
||||||
|
|
||||||
label color_tbl dword
|
label color_tbl dword
|
||||||
.text dd ?
|
.text dd ?
|
||||||
|
@ -41,7 +41,6 @@ APP_VERSION equ 'SVN (4.0.8)'
|
|||||||
TRUE = 1
|
TRUE = 1
|
||||||
FALSE = 0
|
FALSE = 0
|
||||||
|
|
||||||
;include 'debug.inc'
|
|
||||||
;define __DEBUG__ 1
|
;define __DEBUG__ 1
|
||||||
;define __DEBUG_LEVEL__ 1
|
;define __DEBUG_LEVEL__ 1
|
||||||
;include '../../../debug-fdo.inc'
|
;include '../../../debug-fdo.inc'
|
||||||
|
@ -96,14 +96,14 @@ get_from_clipboard:
|
|||||||
.yes_valid_text:
|
.yes_valid_text:
|
||||||
call know_number_line_breaks
|
call know_number_line_breaks
|
||||||
mov [copy_count],ebx
|
mov [copy_count],ebx
|
||||||
|
; correction of erroneous buffer size
|
||||||
mov eax,[clipboard_buf]
|
mov eax,[clipboard_buf]
|
||||||
sub esi,eax
|
sub esi,eax
|
||||||
mov [eax],esi
|
mov [eax],esi
|
||||||
|
; multiple by 6
|
||||||
shl ebx,1
|
shl ebx,1
|
||||||
lea ebx,[ebx*3]
|
lea ebx,[ebx*3]
|
||||||
|
; calculating a desired size
|
||||||
mov eax,[clipboard_buf]
|
mov eax,[clipboard_buf]
|
||||||
mov eax,[eax]
|
mov eax,[eax]
|
||||||
sub eax,4*3
|
sub eax,4*3
|
||||||
@ -249,7 +249,7 @@ know_number_line_breaks:
|
|||||||
lodsb
|
lodsb
|
||||||
|
|
||||||
test al,al
|
test al,al
|
||||||
jz .end_of_data_1
|
jz .end_of_data
|
||||||
|
|
||||||
cmp al,0x0d
|
cmp al,0x0d
|
||||||
je .check_0x0a
|
je .check_0x0a
|
||||||
@ -281,17 +281,8 @@ know_number_line_breaks:
|
|||||||
dec ecx
|
dec ecx
|
||||||
jnz @b
|
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:
|
.end_of_data:
|
||||||
inc ebx
|
add ebx,2
|
||||||
|
inc esi
|
||||||
ret
|
ret
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
@ -610,7 +610,12 @@ proc key.ctrl_v
|
|||||||
add [esp],eax
|
add [esp],eax
|
||||||
add esi,eax
|
add esi,eax
|
||||||
mov ecx,[copy_size]
|
mov ecx,[copy_size]
|
||||||
|
mov edi,[copy_count]
|
||||||
|
test edi,edi
|
||||||
|
dec edi
|
||||||
|
jnz @f
|
||||||
sub ecx,sizeof.EDITOR_LINE_DATA
|
sub ecx,sizeof.EDITOR_LINE_DATA
|
||||||
|
@@:
|
||||||
mov edi,[cur_editor.Lines]
|
mov edi,[cur_editor.Lines]
|
||||||
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
|
add edi,[cur_editor.Lines.Size] ;*** add edi,[edi-4]
|
||||||
dec edi
|
dec edi
|
||||||
@ -621,6 +626,7 @@ proc key.ctrl_v
|
|||||||
add ecx,[cur_editor.Caret.X]
|
add ecx,[cur_editor.Caret.X]
|
||||||
neg ecx
|
neg ecx
|
||||||
lea ecx,[esi+ecx+1]
|
lea ecx,[esi+ecx+1]
|
||||||
|
mov [size_of_moving_area],ecx
|
||||||
std
|
std
|
||||||
rep movsb
|
rep movsb
|
||||||
|
|
||||||
@ -655,11 +661,22 @@ proc key.ctrl_v
|
|||||||
|
|
||||||
pop ecx
|
pop ecx
|
||||||
sub ecx,ebx
|
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
|
add [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],ecx
|
||||||
call .check_columns
|
call .check_columns
|
||||||
mov ecx,eax
|
mov ecx,eax
|
||||||
rep movsb
|
rep movsb
|
||||||
|
.save_cur_editor_values:
|
||||||
mov [cur_editor.Caret.X],eax
|
mov [cur_editor.Caret.X],eax
|
||||||
mov [cur_editor.SelStart.X],eax
|
mov [cur_editor.SelStart.X],eax
|
||||||
mov eax,[copy_count]
|
mov eax,[copy_count]
|
||||||
@ -716,7 +733,6 @@ proc key.ctrl_v
|
|||||||
@@: pop eax
|
@@: pop eax
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
|
proc key.ctrl_d ;///// INSERT SEPARATOR //////////////////////////////////////
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user