diff --git a/programs/develop/tinypad/trunk/data/tp-udata.inc b/programs/develop/tinypad/trunk/data/tp-udata.inc index 8efe9fbf44..587db212b4 100644 --- a/programs/develop/tinypad/trunk/data/tp-udata.inc +++ b/programs/develop/tinypad/trunk/data/tp-udata.inc @@ -96,6 +96,8 @@ just_from_popup db ? bot_mode db ? bot_mode2 db ? +popup_valid_text db ? + align 4 bot_dlg_height dd ? diff --git a/programs/develop/tinypad/trunk/tp-clipboard.asm b/programs/develop/tinypad/trunk/tp-clipboard.asm index 4a1f7981f7..525ca238c4 100644 --- a/programs/develop/tinypad/trunk/tp-clipboard.asm +++ b/programs/develop/tinypad/trunk/tp-clipboard.asm @@ -123,6 +123,55 @@ get_from_clipboard: popad ret ;----------------------------------------------------------------------------- +check_clipboard_for_popup: + pushad + mov [popup_valid_text],0 + mcall 54,0 +; no slots of clipboard ? + test eax,eax + jz .exit +; main list area not found ? + inc eax + test eax,eax + jz .exit + + sub eax,2 + mov ecx,eax + mcall 54,1 +; main list area not found ? + inc eax + test eax,eax + jz .exit +; error ? + sub eax,2 + test eax,eax + jz .exit + + inc eax + mov [clipboard_buf],eax +; check contents of container + mov ebx,[eax+4] +; check for text + test ebx,ebx + jnz .remove_area + + mov ebx,[eax+8] +; check for cp866 + cmp bl,1 + jnz .remove_area + +.yes_valid_text: + mov [popup_valid_text],1 +; remove unnecessary memory area +.remove_area: + xor eax,eax + stdcall mem.ReAlloc,[clipboard_buf],eax + mov [clipboard_buf],eax +;-------------------------------------- +.exit: + popad + ret +;----------------------------------------------------------------------------- convert_clipboard_buf_to_copy_buf: mov edi,[copy_buf] mov ebx,edi diff --git a/programs/develop/tinypad/trunk/tp-popup.asm b/programs/develop/tinypad/trunk/tp-popup.asm index d7fb2bbf53..b14342a21b 100644 --- a/programs/develop/tinypad/trunk/tp-popup.asm +++ b/programs/develop/tinypad/trunk/tp-popup.asm @@ -240,7 +240,8 @@ onshow: .edit: or byte[mm.Edit+2],0x01 - cmp [copy_size],0 + call check_clipboard_for_popup + cmp [popup_valid_text],0 jne @f and byte[mm.Edit+2],0xFE @@: or dword[mm.Edit+0],0x01000101