Bug 29732 (paste-problem) - Please add a way to disable smart copy/paste in some editable areas
Summary: Please add a way to disable smart copy/paste in some editable areas
Status: NEW
Alias: paste-problem
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-24 20:34 PDT by jaroslav.benc
Modified: 2010-06-09 02:56 PDT (History)
3 users (show)

See Also:


Attachments
smart paste problem (33.22 KB, image/png)
2009-09-25 22:55 PDT, jaroslav.benc
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jaroslav.benc 2009-09-24 20:34:17 PDT
- use any document in design mode, textarea or intput field 
- write a word and double click on this word so it's selected
- paste this word and note there is an additional space after the word (sometimes before as well)

This is broken in every webkit based browser
Comment 1 jaroslav.benc 2009-09-24 20:36:17 PDT
- paste the word few times to see the problem
Comment 2 Mark Rowe (bdash) 2009-09-24 22:09:44 PDT
Can you please point at a URL that can be used to reproduce this problem?
Comment 3 jaroslav.benc 2009-09-25 01:43:07 PDT
'Works' with any input/textarea, so you could use this form inside bugzilla to try it. Just double click on an existing word so it's selected, press CTRL+C & CTRL+V so it's pasted. Do it 2 or more times and you'll see a space between this two words. I've been using WinXP, OK with Firefox, broken with all webkit based browsers. 

Thanks

(In reply to comment #2)
> Can you please point at a URL that can be used to reproduce this problem?
Comment 4 Alexey Proskuryakov 2009-09-25 16:39:08 PDT
What exactly are you reporting as broken? Are you saying that spaces shouldn't be inserted at all, or that they are inserted incorrectly?

Inserting spaces is a feature known as "smart copy/paste" - when you double-click to select a word, many text editors ensure that it's surrounded with spaces after copying, because it makes no sense to paste a word right next to another word without any space or punctuation.

For Apple employees only: see also <rdar://problem/3662124>.
Comment 5 jaroslav.benc 2009-09-25 22:55:21 PDT
Created attachment 40163 [details]
smart paste problem
Comment 6 jaroslav.benc 2009-09-25 22:57:21 PDT
I've been working on a browser based IDE where we have something like:  ...left="150" top="90" width="300"... If you try double click on the attribute "width", then CTRL+C and then CTRL+V the result is this:
...left="150" top="90" width ="300"... (space after width)

So it sounds either not too smart or too smart. 

it's quite specific situation, but browsers have been used as platform for different kind of applications so this could be actually pretty common problem for online editors. Please note that Firefox doesn't have this problem. 

Please see attached image for more info. 

Thanks, 
Jaro
Comment 7 Alexey Proskuryakov 2009-09-25 23:55:37 PDT
I agree that for editing source code, smart copy/paste is generally inappropriate. There are likely ways to work around this - you could programmatically re-select the text before copying, making the engine forget that the selection originated from double-clicking. You could consider using onselect, or onbeforecopy/onbeforecut WebKit extensions.

Perhaps a more direct solution that doesn't involve JavaScript could be added, so I'm re-titling the bug to be an enhancement request for such.

We already have a way for applications embedding WebKit to completely disable smart copy and paste (and smart delete, for that matter, and also similar drag and drop behaviors), so it is a policy decision for any browser, and you can contact a browser vendor if you want this policy changed. It's only potential selective behavior that enables web pages to easily make the decision that's in scope for WebKit.
Comment 8 jaroslav.benc 2009-09-26 01:16:13 PDT
I see, thanks for your reply Alex
Jaro
Comment 9 Michel 2010-06-09 02:56:40 PDT
Everything would be nice if smart copy/paste would include a LEFT space (to my point of view). Right spaces always bugs me :
You cannot add a comma,
you cannot add a final period
as it was stated, pasting in code always leads to problems...

Unless you first remove the space manually wich is not the intend of smart copy/paste, I believe.

A left space would only bother you at the very beggining of the sentence.