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 52096

Summary: Double click selection differs in different source types
Product: editor Reporter: randahl <randahl>
Component: -- Other --Assignee: Milutin Kristofic <mkristofic>
Status: REOPENED ---    
Severity: blocker CC: issues, jchalupa, mariusz_m, pkuzel, slmark
Priority: P3    
Version: Dev   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description randahl 2004-12-06 09:51:08 UTC
If you double click the word "acme" in a java
source file on a line like this

import com.acme.IntelligentPresidents;

NetBeans will select the word "acme", however if
you double click the word in an XML file on a line
like this

<import>com.acme.IntelligentPresidents</import>

NetBeans will select all of the FQN.

I for one have many XML files which contain class
names or multi-level property names like
"p1.p2.p3" and just like when editing import
statements it is very often relevant to rewrite a
word between two periods, thus it would be very
helpful if NetBeans would correctly select just
the contents between the two periods.

Yours

Randahl
Comment 1 Jan Chalupa 2004-12-06 10:29:52 UTC
Certainly not a P1. IDE doesn't crash, no data is lost. Please use bug
priorities judiciously.
Comment 2 Miloslav Metelka 2004-12-07 12:34:20 UTC
NB editor infrastructure allows to accept/reject particular characters
such as dot as part of the selected word. I think that it makes sense
either way so it could possibly be made customizable. Passing to xml
module for further evaluation.
Comment 3 _ pkuzel 2005-02-17 21:51:51 UTC
Mila what acceptor do you mean? I can see just IDENTIFIER_ACCEPTOR 
and it's defined by XML specs: NameChar [4]. Simply XML 
identifies != Java identifiers. 
Comment 4 _ pkuzel 2005-02-21 15:08:19 UTC
It cannot be addressed at XML side without breaking IdentifierAcceptor
contract.

I discussed with Mila and propose editor infrastructure enhancement.
It sould treat acceptors in different way. There should be array of
acceptors: e.g. naturalLanguageWord, identifierAcceptor,
naturalLanguageSentence, statementAcceptor, line, paragraph, whole
file... Then on first double click editor chooses shortest region and
shows it, on next click extending to next shortest region, ...

For Java it means (| denotes caret):

   Object o = loo|kup.lookup(Class); // example

1: lookup                                        = word and identifier
2: lookup.lookup(Class);                         = statement
3: Object o = lookup.                            = sentence (strange
                                                   out-side comment)
4: Object o = lookup.lookup(Class); // example   = line

for XML:

  <x|ml.type inherit-"all"/> <!-- example -->

1: xml                                           = word
2: xml.type                                      = identifier
3: <xml.type inherit-"all"/>                     = statement
4: <xml.type inherit-"all"/> <!-- example -->    = line

Randhal does it match your expectation?
Comment 5 Miloslav Metelka 2005-03-14 14:41:03 UTC
I'm wondering if more than three levels of selection isn't too much especially
when being triggered by mouse. IMHO when three-clicking by mouse it should be
clear what each next click will select prior doing so. I would personally stay
with up to three-click:
1.click - position mouse
2.click - select word (depends what 'word' means in each language)
3.click - select line

Regarding exteding of the selection depending on syntactic elements there
already is SelectCodeElementAction implemented for java. It could be added for
other mime-types as well.
Comment 6 slmark 2010-11-05 09:42:44 UTC
Hi All.
I faced with the same problem using Smarty & PHP
Double click on e.g. S_MY_STRING in PHP trigger selection of the whole string, while in Smarty only substring before/after underscore is selected, e.g. clickin on R letter will select only STRING. S_MY_ will be not selected.

Thank,
Slava.
Comment 7 Martin Balin 2016-07-07 07:31:44 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 8 mariusz_m 2017-05-25 08:56:36 UTC
(In reply to Martin Balin from comment #7)
> This old bug may not be relevant anymore. If you can still reproduce it in
> 8.2 development builds please reopen this issue.
> 
> Thanks for your cooperation,
> NetBeans IDE 8.2 Release Boss

This default notepad-like selection behavior in PROGRAMMERS editor where underscores are common identifier element becomes annoying after so many years the issue was opened. 

Great, inteligent behavior in C++, primitive in Bash/Cmake/Text/(others).
I understand the expected double-click handling should be different for certain languages, but if not specified explicitly, support at least these MY_LOCAL_NAME form. Intelligent selection of text in single/doble quotes also will be appreciated :)