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 169079 - [68cat] "Select Word" action selects non-words
Summary: [68cat] "Select Word" action selects non-words
Status: REOPENED
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-23 23:16 UTC by matthies
Modified: 2016-07-18 20:21 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2009-07-23 23:16:42 UTC
Example: In "foo.bar", when the caret is at the beginning of "bar" (= behind the dot), then Select Word selects the dot 
instead of the word "bar". This seems to happen for any sequence of non-word and non-whitespace characters that precede 
a word.
Comment 1 Vitezslav Stejskal 2009-07-24 08:49:33 UTC
Well, I'm not sure why 'Select word' action does what it does. But there is also 'Select identifier' actions
(Alt+Shift+J by default) which might be more suitable for what you need.
Comment 2 matthies 2009-07-24 14:23:50 UTC
Thanks for suggesting Select Identifier. I didn't think it would work in plain text files and on non-identifier words, 
but apparently it does, so it seems to be a good workaround. Maybe Select Identifier and Select Word should be the 
same, the difference (if any) seems rather subtle.
Comment 3 David Strupl 2012-10-25 13:39:13 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 4 David Strupl 2012-10-26 13:10:43 UTC
Milutin, can you please have a look at this? Thanks.
Comment 5 Milutin Kristofic 2012-10-26 14:44:18 UTC
Select word action is by default used only for double-click. It is wrapper for BeginWordAction and selectEndWordAction. 

I am not sure what should be changed?

1, not showing select word action in keymap? It has not a shortcut by default.
2, change behavior of double-click? in case of 'test-|test' where | is caret, it should not select '-' but second 'test'?
Comment 6 David Strupl 2012-10-29 09:09:29 UTC
I think option 1. is good - is it an easy change? If so please do it. Thanks.
Comment 7 Miloslav Metelka 2012-10-29 10:08:38 UTC
IMHO the current state is ok - you want to select words by double-clicking it and not only identifiers but block of separators as well. If you want select just identifier there's Alt+Shift+J (select identifier) action.
We should probably compare with other IDEs too what's their approach to this.
Comment 8 matthies 2012-10-29 10:50:40 UTC
The current state is confusing because:
- Two slightly different word-selection variants are provided in the keymap
- The one called "Select Word" does not always select a word when the caret is on a word boundary, unlike most other text editors
- The one called "Select Identifier" actually selects any word, not just identifiers
- When other text editors have an action called "Select Word", its behavior usually corresponds to the behavior of NetBeans' "Select Identifier", not to the behavior of NetBeans' "Select Word"

One problem is that (presuambly) a double-click first maps to a character position, and the behavior of the action then can only depend on this character position. Therefore clicking in the middle of a character necessarily does the same as a keyboard action where the caret is visually _between_ characters (if not in overstrike mode). If the distinction would me more granular than just "character position", then having just a single action would maybe suffice. But that's probably too subtle/difficult to implement.

Therefore I would suggest to rename "Select Identifier" to "Select Word", and either not show the original "Select Word" in the keymap, or to rename it to e.g. "Select Previous Word" (reflecting that it does not select the next word when the caret is at the beginning of a word).
Comment 9 Martin Balin 2016-07-07 07:30:36 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 10 matthies 2016-07-18 20:21:44 UTC
Still reproducable in current dev build.