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 223743 - Renaming a variable - wrong behavior
Summary: Renaming a variable - wrong behavior
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Egor Ushakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-12 21:07 UTC by crimcat
Modified: 2013-05-24 02:45 UTC (History)
0 users

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 crimcat 2012-12-12 21:07:19 UTC
Example code:
---------------
int
function_test(int param) {
    int z = param * (param - 10);
    param = z * z;
    return param;
}
---------------
1) Let' select param identifier, in return statement. Press Ctrl-R for renaming. After the blue highlights appeared on all 'param' identifiers move the cursor right before the first letter - 'p'. Press 'Backspace' to move the identifier close to the 'return' keyword. Only this 'param' identifier is moved, others stay in their places. Then press 'Space' to fix wrong backspace editing operation. Result - all 'param' identifiers in the function are preceded with ' ' (space).
2) Position the cursor inside the 'param' identifier, press 'Space'. It's allowed to insert 'space' character inside the identifier. Then press 'Enter' to finish code refactoring. The result: space character is inserted into all 'param' identifiers within the function. This is wrong behavior, because any refactoring should lead to syntactically correct code.
Comment 1 Egor Ushakov 2013-05-23 13:46:39 UTC
I've fixed the problem when you backspace-delete from the beginning of the identifier, now it is impossible:
http://hg.netbeans.org/cnd-main/rev/b44aa91d3612
The rest will not be fixed for now, currently we do not do any validation of the name entered, you can enter spaces, semicolons, etc. The same way you can name any variable with space inside and it will not compile.
Comment 2 Quality Engineering 2013-05-24 02:45:10 UTC
Integrated into 'main-golden', will be available in build *201305232300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b44aa91d3612
User: Egor Ushakov <gorrus@netbeans.org>
Log: fixed #223743 - Renaming a variable - wrong behavior