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

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Tristano
Enthusiast
Enthusiast
Posts: 190
Joined: Thu Nov 26, 2015 6:52 pm
Location: Italy
Contact:

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

Post 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.
The PureBASIC Archives: FOSS Resources:
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

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

Post by davido »

+1
DE AA EB
User avatar
kenmo
Addict
Addict
Posts: 1967
Joined: Tue Dec 23, 2003 3:54 am

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

Post by kenmo »

+1

Some user implementations are here:
http://www.purebasic.fr/english/viewtop ... as+comment
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

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

Post 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)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
Tenaja
Addict
Addict
Posts: 1948
Joined: Tue Nov 09, 2010 10:15 pm

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

Post by Tenaja »

+1
User avatar
Tristano
Enthusiast
Enthusiast
Posts: 190
Joined: Thu Nov 26, 2015 6:52 pm
Location: Italy
Contact:

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

Post 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.
The PureBASIC Archives: FOSS Resources:
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

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

Post by Shield »

Gonna give it a +1 as well. :)
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 538
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

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

Post by Sicro »

+1
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

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

Post by #NULL »

+1
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

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

Post 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
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Post Reply