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

Bug 444831

Summary: [projection] Selection lost when trying to cut folded text
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: TextAssignee: Markus Keller <markus.kell.r>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.3   
Target Milestone: 4.5 M3   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 185760    
Bug Blocks:    

Description Markus Keller CLA 2014-09-23 08:33:32 EDT
+++ This bug was initially created as a clone of Bug #185760 +++

1. paste this:
------------- %< --------
package p;

import java.text.DateFormat;
import java.util.HashMap;
import java.util.List;

class Bug {}
------------- %< --------
2. enable folding and make sure imports are folded
3. select all
4. Ctrl+X (or Edit > Cut)
==> import folding is expanded, selection becomes empty, and caret is after import section.

ProjectionViewer#exposeModelRange(IRegion) destroys the user's selection. Some callers of that method don't care about that since they set a new selection anyway, but the others need to store and reset the selection manually.

The CUT operation in ProjectionViewer#doOperation(int) should just continue even if exposeModelRange returned true (same behavior as on DELETE and when I type a character, perform Paste, etc.).
Comment 1 Markus Keller CLA 2014-09-23 13:31:07 EDT
Oh, this seems to be yet another dup of bug 75222. However, most users don't care about the missing VerifyEvent and just expect Cut to work.

Fixed with http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=22b991e05e1d86e9fce2ae9c840f0964998296c8

Didn't touch ProjectionViewer#exposeModelRange(IRegion).
Comment 2 Markus Keller CLA 2014-12-08 14:54:22 EST
Verified in I20141207-2000.