This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 258742 - Multicaret: Pasting clipboard content at multiple carets does not work
Summary: Multicaret: Pasting clipboard content at multiple carets does not work
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-09 11:36 UTC by markiewb
Modified: 2016-05-07 01:59 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Shows the issue (130.64 KB, image/gif)
2016-04-09 11:36 UTC, markiewb
Details
Issues: Pasting multiple lines (100.82 KB, image/gif)
2016-04-12 22:49 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2016-04-09 11:36:24 UTC
Created attachment 159179 [details]
Shows the issue

Reproduction:
* copy a single word to the clipboard
* Place several carets
* Press CTRL-V to paste

ACTUAL: the text is pasted only at one caret - see attachment-gif
EXPECTED: the text is pasted at every caret


Product Version: NetBeans IDE Dev (Build 201603200001)
Updates: Updates available
Java: 1.8.0_71; Java HotSpot(TM) 64-Bit Server VM 25.71-b15
Runtime: Java(TM) SE Runtime Environment 1.8.0_71-b15
Comment 1 Ralph Ruijs 2016-04-11 09:05:00 UTC
changeset:   7c7e4598a4e4
parent:      296312:0aff84f50cb3
user:        Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date:        Mon Apr 11 11:02:05 2016 +0200
summary:     #258752 #258742 - install TransferHandler
Comment 2 Quality Engineering 2016-04-12 01:47:04 UTC
Integrated into 'main-silver', will be available in build *201604120001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7c7e4598a4e4
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #258752 #258742 - install TransferHandler
Comment 3 markiewb 2016-04-12 22:49:15 UTC
Created attachment 159241 [details]
Issues: Pasting multiple lines
Comment 4 markiewb 2016-04-12 22:58:12 UTC
(In reply to Quality Engineering from comment #2)
> Integrated into 'main-silver', will be available in build *201604120001* on
> http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
> 
> Changeset: http://hg.netbeans.org/main-silver/rev/7c7e4598a4e4
> User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
> Log: #258752 #258742 - install TransferHandler

It works better using Product Version: NetBeans IDE Dev (Build 201604120001). 

But not quite correct, when multiple lines are in the clipboard. See the screencast https://netbeans.org/bugzilla/attachment.cgi?id=159241

EXPECTED:
If you have multiple lines in the clipboard and you paste it to several carets, then every caret gets ONE line of the clipboard! That is the way it works in sublime and in IntellJ idea

The topmost caret get the topmost line of the clipboard. 
The second topmost caret get the second line of the clipboard. 
And so one.

Edge-Cases:
If there are more lines (n+x) in the clipboard than carets (n), then apply only the n lines. After the paste there are still n carets.

If there are less lines (n-x) in the clipboard than carets (n), then apply only the n-x lines. After the paste there are still n carets.
Comment 5 Ralph Ruijs 2016-04-13 08:03:49 UTC
(In reply to markiewb from comment #4)
> (In reply to Quality Engineering from comment #2)
> > Integrated into 'main-silver', will be available in build *201604120001* on
> > http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
> > 
> > Changeset: http://hg.netbeans.org/main-silver/rev/7c7e4598a4e4
> > User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
> > Log: #258752 #258742 - install TransferHandler
> 
> It works better using Product Version: NetBeans IDE Dev (Build
> 201604120001). 
> 
> But not quite correct, when multiple lines are in the clipboard. See the
> screencast https://netbeans.org/bugzilla/attachment.cgi?id=159241
> 
> EXPECTED:
> If you have multiple lines in the clipboard and you paste it to several
> carets, then every caret gets ONE line of the clipboard! That is the way it
> works in sublime and in IntellJ idea
> 
> The topmost caret get the topmost line of the clipboard. 
> The second topmost caret get the second line of the clipboard. 
> And so one.
> 
> Edge-Cases:
> If there are more lines (n+x) in the clipboard than carets (n), then apply
> only the n lines. After the paste there are still n carets.
> 
> If there are less lines (n-x) in the clipboard than carets (n), then apply
> only the n-x lines. After the paste there are still n carets.

Thanks for the screencast, it shows the pasting with multiple carets from rectangular selection is not working correctly.

Pasting multiple lines to multiple carets is working as intended. IMHO Paste action should work similar with one or multiple carets, place the content from the clipboard at the caret.

For example, paste the following lines into the table:

<span>
  Placeholder
</span>


<table>
  <tr>
    <td>|</td>
  </tr>
  <tr>
    <td>|</td>
  </tr>
  <tr>
    <td>|</td>
  </tr>
</table>


There is one exception, cutting text and then pasting should result in the original state. This also works when there are multiple carets and the side effect of this is: when you copy the lines from the example above with three carets, pasting to three carets will not duplicate the lines, but separate them by lines.


If we want to be able to paste content by lines, we could add a separate paste action "Paste by Lines".
Comment 6 Ralph Ruijs 2016-04-22 07:10:50 UTC
changeset:   207d228586ef
user:        Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date:        Fri Apr 22 09:09:18 2016 +0200
summary:     #258742 - Multicaret: Pasting clipboard content at multiple carets does no
t work
Comment 7 Quality Engineering 2016-04-25 19:56:44 UTC
Integrated into 'main-silver', will be available in build *201604251813* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/207d228586ef
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #258742 - Multicaret: Pasting clipboard content at multiple carets does not work
Comment 8 Ralph Ruijs 2016-04-28 17:25:05 UTC
changeset:   cbd8a52d37ba
user:        Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
date:        Thu Apr 28 19:23:03 2016 +0200
summary:     #258742 - new Paste by Lines action
Comment 9 Quality Engineering 2016-04-30 01:59:16 UTC
Integrated into 'main-silver', will be available in build *201604300002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/cbd8a52d37ba
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #258742 - new Paste by Lines action
Comment 10 Quality Engineering 2016-05-07 01:59:29 UTC
Integrated into 'main-silver', will be available in build *201605070002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/39fd951cb1bb
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #258742 - new Paste by Lines action (add missing class)