Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330455

Summary: [linked mode] Inconsistent caret position after rename in file and rename in workspace
Product: [Eclipse Project] JDT Reporter: Deepak Azad <deepakazad>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Deepak Azad CLA 2010-11-17 09:22:35 EST
3.7 M3 and HEAD (this is not affected by fix for bug 329614)

- place caret after 'a' in 'name' on the line mentioned
- Ctrl+1 > 'Rename in file' -> rename to 'naQQQQme', press enter=> caret after QQQQ
- Undo last change
- again place caret after 'a' in 'name' on the line mentioned
- Ctrl+1 > 'Rename in Workspace' -> rename to 'naQQQQme', press enter=> caret before QQQQ (or at the original location)

The behavior is inconsistent.

    private void foo() {
        int name = 10;  //caret on this line
        name++;
        name--;
        --name;
        ++name;
    }
Comment 1 Dani Megert CLA 2010-11-17 09:28:28 EST
Another one :-(
Comment 2 Markus Keller CLA 2010-11-23 12:01:46 EST
"Rename in file" is fine now. "Rename in workspace" is more difficult, since the live changes you see in the editor are all fake.

Fix would go into RenameLinkedMode#undoAndCreateRenameSupport(String) and #restoreFullSelection(): Before doing the undo, we should store the selection relative to the initial selection, and after all changes are applied, we can try to find the right spot again.
Comment 3 Eclipse Genie CLA 2019-03-27 17:57:37 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Dani Megert CLA 2019-03-28 06:35:41 EDT
Still a problem in 4.11.
Comment 5 Eclipse Genie CLA 2021-03-18 01:11:15 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 6 Eclipse Genie CLA 2023-03-17 16:01:39 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.