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 136162 - Rename variable broken inside 'if' conditional
Summary: Rename variable broken inside 'if' conditional
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Torbjorn Norbye
URL:
Keywords:
Depends on:
Blocks:
 
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
Exception Reporter:


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

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 http://deadlock.netbeans.org/hudson/job/trunk/
Comment 3 Martin Schovanek 2008-06-03 13:03:03 UTC
v.
Comment 4 pgebauer 2008-06-03 22:54:25 UTC
The fix has been ported into the release61_fixes branch:

http://hg.netbeans.org/release61_fixes/a579e6e30351