Page 1 of 1

IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Fri Jun 10, 2016 10:38 am
by Tristano
When pasting in the IDE some non-code text, it gets "cleaned up" as if was source code (ie: words like "not", "and", "if", "or", ecc., get capitalized as if they were keywords: "Not", "And", "If", ecc.). Needless to say, many PB keywords match common use English words.

This is troublesome when one wishes to paste some text destined to become a comment, or split into strings, and so on. This is especially true in the latter case: if one needs to paste some text into a string definition, pasting inside quotes is not enough if pasted text contains newline characters -- the IDE will syntax-cleanup all text on newlines. Presently, one is forced to rely on some external editors to manually enlclose all text lines either in quotes or in comments.

Since the IDE currently doesn't assign any actions to Ctrl + Shift + V key-combination, it could be employed to paste clipboard contents as comments, ie: add a leading semicolon and space "; " to the each line of the raw pasted text. Alternatively, when the IDE sees that the cursor is inside double quotes, it could assume user wants to paste a string definition and paste clipboard contents as an escaped string definition, ie: converting newline characters to \n and double quotes to \", ecc. Or paste-as-string could be another pasting mode altogether, via Ctrl + Alt + V, auto-magically enclosing escaped pasted text within ~"". Whatever...

In many applications Ctrl + Shift + V is already the standard for alternative pasting modes, so it should look familiar to most users.

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Fri Jun 10, 2016 3:33 pm
by davido
+1

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Fri Jun 10, 2016 5:09 pm
by kenmo
+1

Some user implementations are here:
http://www.purebasic.fr/english/viewtop ... as+comment

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Sat Jun 11, 2016 12:01 am
by Lunasole
+1. That's all about stupid IDE behavior with any text (auto-formatting is applied just after paste or typing, but should be applied only after user switched to another line, or optionally by demand)

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Sat Jun 11, 2016 12:12 am
by Tenaja
+1

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Sat Jun 11, 2016 11:19 am
by Tristano
kenmo wrote:Some user implementations are here:
http://www.purebasic.fr/english/viewtop ... as+comment
Thanks for the link @kenmo! didn't realize some users' workarounds were already available — but doesn't surprise me either, this should be a common problem to all of us IDE users.

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Sat Jun 11, 2016 2:49 pm
by Shield
Gonna give it a +1 as well. :)

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Fri Nov 24, 2017 6:37 pm
by Sicro
+1

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Sat Nov 25, 2017 11:53 am
by #NULL
+1

Re: IDE : Paste as Comment ( Ctrl + Shift + V )

Posted: Sat Nov 25, 2017 1:16 pm
by blueb
As a side note...

I've been using Michael's code since he posted it on the forum and it works so flawlessly that I was starting to think it was part of the IDE. {grin}

Thanks Michael :D