Page 1 of 1

hmmm - bug or not?

Posted: Wed Jan 23, 2019 9:57 pm
by kpeters58
Only tested with editor - other gadgets are probably affected as well.

If you set an editor gadget's font to bold and paste some non-bolded text into it, the text does not get converted to bold, but stays normal or italic (or whatever it was).

Opinions?

Re: hmmm - bug or not?

Posted: Wed Jan 23, 2019 11:06 pm
by Josh
The text you insert has the formatting of the text you copied. A normal behavior for the EditorGadget.

Re: hmmm - bug or not?

Posted: Thu Jan 24, 2019 3:46 am
by RobertSF
It's a behavior I see in Microsoft products. It can be annoying, but I can see why the behavior is as it is.

It's annoying when, for example, you try to copy something from a web page into a Word document. Now your Word document is full of crap, javascript, css, or whatever was formatting the text you copied. In Word, what you do is Paste Special, Text Only. If I'm working in an application that doesn't have that feature, like Outlook, I paste what I copied from the web page into Notepad. That strips all the crap out of it, and then I can copy and paste that into wherever.

But the behavior makes sense. Formatting belongs to the text it formats, I guess.

Re: hmmm - bug or not?

Posted: Thu Jan 24, 2019 4:01 am
by gurj
I seem to remember that there are APIs that can set gadget to use text or RTF formats...

Re: hmmm - bug or not?

Posted: Thu Jan 24, 2019 9:42 am
by Shardik
For Windows RASHAD has already demonstrated here how to paste RTF text or plain text into the EditorGadget.

Re: hmmm - bug or not?

Posted: Thu Jan 24, 2019 3:40 pm
by gurj
thanks Shardik! for lnk.

Re: hmmm - bug or not?

Posted: Thu Jan 24, 2019 3:58 pm
by skywalk
This is a feature. To paste without formatting, use [Ctrl+Shift+V].
And/or code that into your app's.

Re: hmmm - bug or not?

Posted: Thu Jan 24, 2019 4:24 pm
by gurj
on my PC, WinXP x86
[Ctrl+Shift+V]=[Ctrl+V].

Re: hmmm - bug or not?

Posted: Fri Jan 25, 2019 3:04 pm
by blueb
I've used this method in my IDE 'Tools' menu for a couple of years, and it works well on Win 10 x64 machine.

viewtopic.php?p=484177#p484177

Re: hmmm - bug or not?

Posted: Fri Jan 25, 2019 3:26 pm
by Marc56us
kpeters58 wrote:If you set an editor gadget's font to bold and paste some non-bolded text into it, the text does not get converted to bold, but stays normal or italic (or whatever it was).
Adds a button (Paste) or personal keyboard shortcut and uses SetGadgetText(#Gadget, GetClipboardText()) instead of CTRL+V The original (pasted) format will be deleted and will take the format defined by the gadget. This also removes all RTF formatting.

or remove format after paste

Code: Select all

Procedure Drop_Format()
    SetClipboardText(GetGadgetText(#Gadget))
    SetGadgetText(#Gadget, GetClipboardText())
    ClearClipboard()
EndProcedure
The text will be replaced and will have the format originally defined by the gadget.

:wink: