Page Info Links tab vbox allows multiple selections, but (ctrl-c) only copies current link

RESOLVED DUPLICATE of bug 188049

Status

SeaMonkey
Page Info
RESOLVED DUPLICATE of bug 188049
15 years ago
13 years ago

People

(Reporter: Greg Knittl, Assigned: db48x)

Tracking

Trunk
x86
Windows 98

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5a) Gecko/20030610
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5a) Gecko/20030610

No matter how many links you highlight in the links tab by using the shift and
control keys, ctrl-c only copies the current link in the view box. 
 


Reproducible: Always

Steps to Reproduce:
1.browse any page with links
2.open page info and go to the links tab
3.select multiple links
4.ctrl-c and paste somewhere
Actual Results:  
just copies the link that is currently selected

Expected Results:  
should copy all selected links

doCopy in pageinfo.js is responsible for this behaviour. Note use of
elem.currentIndex.
current:
function doCopy(event)
{
  if (!gClipboardHelper) 
    return;

  var elem = event.originalTarget;
  if (elem && "treeBoxObject" in elem)
    elem.treeBoxObject.view.performActionOnRow("copy", elem.currentIndex);

  var text = elem.getAttribute("copybuffer");
  if (text) 
    gClipboardHelper.copyString(text);
}
suggested solution:
function doCopy(event)
{
  
  if (!gClipboardHelper) 
    return;

  var elem = event.originalTarget;
  if (elem && "treeBoxObject" in elem) {
    // elem.treeBoxObject.view.performActionOnRow("copy", elem.currentIndex);
  
    // http://www.xulplanet.com/references/xpcomref/nsITreeSelection.html
    // http://www.xulplanet.com/tutorials/xultu/seltree.html
    var start = new Object();
    var end = new Object();
    var numRanges = elem.treeBoxObject.view.selection.getRangeCount();
    var text = "";

    for (var t=0; t<numRanges; t++){
      elem.treeBoxObject.view.selection.getRangeAt(t,start,end);
      for (var v=start.value; v<=end.value; v++){
        elem.treeBoxObject.view.performActionOnRow("copy", v);
        var text = text + elem.getAttribute("copybuffer") +"\n";
      }
    }
  }

  // var text = elem.getAttribute("copybuffer");
  // leave clipboard alone if nothing is selected
  // not clear if this is more or less confusing than nulling it out...
  if (text) {
    gClipboardHelper.copyString(text);
    }
}
Note that this suggestion changes the current behaviour when just one item is
selected in that it appends \n to the returned single line. I'm not hung up on
this - it was just more work to subtract the last \n and I personally prefer the
trailing \n as it creates a new line for further pastes.
(Reporter)

Comment 1

15 years ago

*** This bug has been marked as a duplicate of 188049 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → DUPLICATE
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.