Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 136162 - Rename variable broken inside 'if' conditional
Rename variable broken inside 'if' conditional
Product: javascript
Classification: Unclassified
Component: Editor
All All
: P2 (vote)
: 6.x
Assigned To: Torbjorn Norbye
Depends on:
  Show dependency treegraph
Reported: 2008-05-30 13:24 UTC by zdro
Modified: 2009-02-27 14:26 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

simple code showing wrong selection in 'if' during 'rename' (21.62 KB, image/jpeg)
2008-05-30 13:26 UTC, zdro

Note You need to log in before you can comment on or make changes to this bug.
Description zdro 2008-05-30 13:24:50 UTC
There are two styles of 'rename' functionality, one that uses a refactor popup and another that simply highlights the
text/variable being renamed and all instances are changed as you type.  This defect is for the latter.

When an instance of the variable I'm renaming is in an 'if' conditional, and a space precedes it, the selection of that
instance is off by a character.  The space before the word is included in the selection being changed, while the last
character of the name is not.  

This is a big problem because this then causes the variable to not be renamed properly (the last character is
duplicated), which can then lead to subtle problems with the code and hours of wasted time debugging.

Attachment to follow.
Comment 1 zdro 2008-05-30 13:26:00 UTC
Created attachment 62166 [details]
simple code showing wrong selection in 'if' during 'rename'
Comment 2 Torbjorn Norbye 2008-05-30 17:12:13 UTC
Thank you! The problem had to do with spaces inside the left parenthesis of an if conditional expression. I've fixed the
problem and have added unit tests for this scenario.

Changeset: a7a08e5b21b8

The fix will appear in build #2104 or later from
Comment 3 Martin Schovanek 2008-06-03 13:03:03 UTC
Comment 4 pgebauer 2008-06-03 22:54:25 UTC
The fix has been ported into the release61_fixes branch:

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo