A Programmer's Dream

VS Studio pasting from the browser

Posted by Stephen Wrighton on 25 Jul 2007

I'm working on this little project, and I needed a modal window system. So I did a little searching and stumbled upon Prototype Window. It's released under the same MIT license as the Prototype JS library.

That's all good. But, I'm also using a bit of JSON in this particular application, so I want to make sure that I have the latest Prototype because that's where the JSON functionality is built in at. So, I go to the PrototypeJS.org site, hit the download page and then copy from there the text for the JS file.

I happily go over to VS and paste that text into my JS file and hit the site.

Where everything proceeds to throw up. Over and over again.

After searching all the code that I had written, trying to figure out what was going on, I finally open up my local copy of Prototype.js - the one I had just pasted into, and right there at the top is a nice big old: <pre>.

... <-- that's me smacking my head against the desk

And then I remembered that most hated of VS 'features' the fact that it tries to paste text copied with formatting attributes, with those formatting attributes translated into HTML.

Which means you'll get a bunch of MS Word junk when you paste from MS Word, and a bunch of HTML junk when you paste from a browser.

I can see the usefulness of such a thing, but it should not be the default setting. Or at least it should be configurable as a default setting or not.

I believe it's fixed in VS 2005, as I don't seem to remember having that headache when working on a site in it earlier this year.

Well, that's my story of my own stupidity for the day. Enjoy.

Tweet me @kidananubix if you like this post.