Closed Bug 73373 Opened 23 years ago Closed 19 years ago

Multiple Selection of Text with CTRL

Categories

(Core :: DOM: Selection, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Future

People

(Reporter: thedannunn, Unassigned)

References

(Depends on 2 open bugs, )

Details

Attachments

(2 files, 1 obsolete file)

Office XP introduces a new feature to text selection, and I feel we should
"innovate" it before it's eventually added to IE and mozilla converts notice
Mozilla's lack of support for the feature. Well, we can step ahead of the curb
now. This new feature of text selection is called "Multiple Selection",
something that's been in file windows and spreadsheet programs for ages, but is
making its round in plain old text.

In Office XP, select some text. Hold CTRL, select text from a different area. It
works just the same as if you were to do it in an Explorer window, but with
text. If Mozilla implements "Print Selected" (I assume there's a bug on that, I
didn't check), this could be really handy. The URL included is a screen shot of
Office XP's multiple selecting abilities.
I want this feature, like, 8 times a day.

(btw, print selected is already implemented).
Changing the OS to all.  This would be useful on all platforms (possibly with
varying keybindings...)
OS: Windows 2000 → All
Hardware: PC → All
What would this feature be used for?

Btw, Mozilla currently uses ctrl+click in a table cell to select the entire 
cell, and allows any combination of cells to be selected.  Ctrl+shift+click or 
ctrl+drag selects a rectangle of cells within a table.
This + Print Selection = Good Thing.

For example, say you're doing some research, come upon a huge article, and want
to print only a portion of it. Right now, select what portion you want to print,
print it, and if there's another selection, select that next, print it again, etc.

Or, say you were at Google, found a good page of results. Well, select what
results you want, hold CTRL, select more results you want, then Paste or Print.
If selecting cells is implemented, this couldn't be too far off anyhow (although
selecting cells' keymap would change if this was implemented).

Besides, if every other Windows app implements it (Windows XP common controls?
Who knows), Mozilla will need to eventually, anyway.
I'm still not convinced that this would be useful for normal text.  Currently, 
if I want to print several parts of an article, I paste each piece into a 
notepad window.  Using notepad gives me a chance to put an appropriate amount 
of whitespace between each part of the selection, something I probably wouldn't 
be able to do using multiple selections with "print selection".

Btw see also bug 36848, "Should only be one text selection per window".
I'm very convinced this would be useful for normal text.  How is `open your 
favorite editor and select, copy and paste each bit at a time' easier than 
discontiguous selection via a modifier?  I find myself trying to use control to 
do this quite often when I want to copy bits and pieces of an article or some 
such (a behavior I learned from the Explorer GUI), only to be surprised when it 
doesn't work.
> How is `open your favorite editor and select, copy and paste each bit at a 
> time' easier than discontiguous selection via a modifier?

If you screw up while setting up multiple selections, you have to start over.  
In this case, screwing up could be as easy as accidentally left-clicking.  If 
you screw up while pasting each selection into notepad, you can Ctrl+Z the last 
action in the editor, or start over with one part of the selection.  (That 
problem doesn't mean it's always faster to move several blocks of text one at a 
time, but it could make this new feature less useful than it would be 
otherwise.)

How will spacing be handled, and will it be easy to distinguish between a real 
paragraph break and a selection break in the printed/pasted text?
Personally, i just use composer and delete what i don't want. but...
> How will spacing be handled, and will it be easy to distinguish between a real 
paragraph break and a selection break in the printed/pasted text?


That I don't know. I suppose we should wait for Office XP to set the precident
before we go and do something our own way.
Composer should probably have this feature (at least on Windows) some day.
Reassign to anthonyd.
Assignee: mjudge → anthonyd
Target Milestone: --- → Future
The problem with copying each piece into a notepad/emacs/word window is that you
can easily lose markup.  Sometimes this doesn't matter all that much.  Other
times (MathML is the one I'm thinking off) once you've lost markup the content
is gibberish....

Using composer is a decent alternative I guess....
I have to agree with jesse ruderman on this one.  Orignally mjudge had multiple 
selection implemented, but a lot of people complained because there are a lot 
discrepancies with how other things worked (bold, italics, copy, 
paste(especially!), print).

marking as remind.

Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → REMIND
*** Bug 86131 has been marked as a duplicate of this bug. ***
reopening bug; resolve remind shouldn't really be used
Status: RESOLVED → REOPENED
Resolution: REMIND → ---
Assignee: anthonyd → mjudge
Status: REOPENED → NEW
QA Contact: blakeross → tpreston
-->module owner
This bug should be WONTFIX if we don't intend to implement it.
*** Bug 113196 has been marked as a duplicate of this bug. ***
Should work on anything that can be selected including URL bar text.

What would be necessary to fix this bug - i.e. how would an implementor go about
this? How much work would be required?
Blocks: 32627
*** Bug 127054 has been marked as a duplicate of this bug. ***
*** Bug 191469 has been marked as a duplicate of this bug. ***
*** Bug 238162 has been marked as a duplicate of this bug. ***
Sorry to address this bug again after it has been stagnant for so long but
judging from the number of dupes, people seem to want this feature.  I just
wanted to add my vote into the mix with a little something to back it up. 
First, this feature has been in Windows file managers for many years.  Second,
it first came to text editing with Office XP a few years ago and was popular
enough to be carried over to the next version as well so it seems people are
getting quite accustomed to this behavior and are surprised not to see it elsewhere.

The reason I would like to see this implimented is that I (and many others) copy
the content of many web pages to a text reader.  When I copy the text, there are
often areas of inline content that get copied as well that are not supposed to
be read inline (text ads, related content/links, etc.).  These could be easily
avoided if Mozilla would allow selection up to the content in question and allow
it to resume after.  This would allow the copying of only the relevant content
and make the reading make much more sense.

BTW, I don't think this bug blocks bug 32627 so should someone who knows better
address that?
Well, the code is all there. 
To get multiple selection with CTRL, all there has to be changed is this:

  rv = frameselection->HandleClick(content, startOffset , endOffset,
me->isShift, PR_FALSE, beginFrameContent);
PR_FALSE has to be changed into me->isControl
at line 1496 in layout/html/base/src/nsFrame.cpp

This works very well, but not for multiple selections on the same line, see bug 
220157.

view selection source uses only the first selection.
search web for/cut/copy uses the text from all the selections.
CTRL selection inside tables won't work. That is already used for selecting tables.

I think the most useful this could be is for Composer. 
Suppose you want different parts of text in the document to become bold.
With CTRL selection you'll have a neat way to do this.
But Composer doesn't handle multiple selections very well yet. It only uses the
first one.
Subsequently the midas commands also only use the first selection.
Attached patch patch (obsolete) — Splinter Review
Well, bug 220157 seems to be fixed now.
I've just tried this patch and it works without any real problems (there are
some parts of Mozilla that don't really support multiple selection, like "View
selection Source" and the midas command and possibly more).
Also, it doesn't interfere with the table-cell selection, which seems to have a
higher precedence.
But I don't know if other platforms are using other keybindings for this (isMeta
for the Mac?).
I don't really know that sort of thing either... ccing Simon in case he does,
for Mac.

Also ccing aaron and some other people.
MS Word on Mac uses the Command key to do multiple selections, so isMeta sounds
right.

We need to make sure that we get all the selected text with copy, drag and drop,
and via the command for getting the selected text.
Wow, glad to see this taken care of after all this time waiting and hoping, but
now that I have moved upward and onward to become a diehard Firefox user, I just
wanted to make sure this would be included in 1.1 as I assume that it would
since they are building from the same trunk now.

Anyone able to shed some light on that just to put my mind at rest?  If it is,
then I TRULY cannot wait for 1.1 (yeah, I can't wait anyway, but this will be
THE reason to upgrade for me).

Oh, and while I'm here, I assume it will fix thunderbird as well?  Just
wondering, thanks!
Attached patch patch2Splinter Review
So like this, I guess? I can't check it for the Mac.
Cut, copy, drag and drop, undo, redo seems to work fine (at least here in
Windows), in websites and in textareas.
But it doesn't work fine for "View Selection Source". Also, it doesn't work for
execCommands. It only takes the first selection for those.
Attachment #175439 - Attachment is obsolete: true
Some questions on the patch:
1) Does the patch work for "print selection"? (This is extremely important)
2) For "View Selection Source", what doesn't work? (For instance, does it only
show source the first group of selected text, or not open at all, etc)
3) Have you tested it on the suite (mozilla  and mailnews), along with on
Firefox and Thunderbird?
4) Have you tested it on Linux (if not, can you find people to test it for you)?
5) What are execCommands?
Assignee: mjudge → selection
QA Contact: tpreston
Attached patch patch3Splinter Review
> 1) Does the patch work for "print selection"? (This is extremely important)
No, but this patch should take care of that (I had severe trouble with printing
selections, but that is unrelated to this patch). The printing of multiple
selections seems to work fine (at least to me).
> 2) For "View Selection Source", what doesn't work? (For instance, does it
only
> show source the first group of selected text, or not open at all, etc)
It only shows/uses the first range of the selection. A minor issue, imho.
> 3) Have you tested it on the suite (mozilla  and mailnews), along with on
> Firefox and Thunderbird?
> 4) Have you tested it on Linux (if not, can you find people to test it for
you)?
No, only Firefox windows build, but I see no reason why it shouldn't work in
those programs. But any testing on it would be welcome, though. I'm more
worried about the Mac part.
> 5) What are execCommands?
Commands for designMode/midas (do a Google search on "mozilla
midas/designmode").
Martijn, are you going to request reviews?
Well, drag and drop of multiple selections inside textareas and designmode
iframes doesn't work well, I've just found out. I'll submit a bug report about
this later.
Depends on: 285786
Depends on: 285797
Comment on attachment 176271 [details] [diff] [review]
patch3

Ok, I've submitted the two bugs, which possibly are too serious to consider
this patch.
I've set them to block this bug. I leave the decision to you.
I don't know if this patch works for the mac.
Attachment #176271 - Flags: review?(roc)
Martijn (comment 34) -- please mention the two bugs you have filed.  I'm
guessing they are bug 285786 and bug 285797.
Yes, that's correct. I've set those bugs blocking this bug.
Comment on attachment 176271 [details] [diff] [review]
patch3

it sounds like we don't crash. I think we should turn this on.
Attachment #176271 - Flags: superreview+
Attachment #176271 - Flags: review?(roc)
Attachment #176271 - Flags: review+
Martjin, since this doesn't fix anything urgent, it might be best to check this
in at the start of 1.9.
So if anyone is bored, the patch can be checked in.
Status: NEW → RESOLVED
Closed: 23 years ago19 years ago
Resolution: --- → FIXED
Thanks for checking in, Robert.
This interferes with table selection, which is also CTRL-click (Sorry, I should
have told this earlier).
(and CTRL-click table selection has also a weird issue, namely bug 210197)
Depends on: 306641
Well, I filed bug 306641 for that.
No longer depends on: 306641
Depends on: 337401
This doesn't work as I would expect: Double click to select a word, hold down ctrl, then double click another word.  This deselects the first word. Both words should be selected.

The same should be true for triple-clicking multiple paragraphs.
Joey, could you file a new bug on that (and mention the bug number here)?
I'm not sure what Joey is referring to is a new bug.  The original goal of this bug never was resolved as far as I can tell.  Multiple selection using the CTRL button has never been enabled on any build that I have ever used.  Anyone else get it to work?
Christopher, it's fixed on trunk builds, this wasn't landed on the 1.8 branch, which means it isn't in Firefox2.0 builds.
Here you can download the latest trunk build:
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/
(note that you can get some problems when you use a branch profile with a trunk build)
Depends on: 415707
(In reply to comment #43)
> This doesn't work as I would expect: Double click to select a word, hold down
> ctrl, then double click another word.  This deselects the first word. Both
> words should be selected.
> 
> The same should be true for triple-clicking multiple paragraphs.
> 

This ended up being filed as bug 415707 (now blocking this bug).
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: