| Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/saveactions/CodeFormatEditFactory.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/saveactions/CodeFormatEditFactory.java b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/saveactions/CodeFormatEditFactory.java
|
| index 26776c69a5a15cbd222d591e3993bd291f4e3822..facfc4682f6f3c75dc2633283bb4dc8e2811bafc 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/saveactions/CodeFormatEditFactory.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/internal/text/editor/saveactions/CodeFormatEditFactory.java
|
| @@ -49,7 +49,8 @@ public class CodeFormatEditFactory {
|
| * @return an edit that removes all trailing whitespace
|
| * @throws CoreException if an error occurs in creating the edit
|
| */
|
| - public static MultiTextEdit removeTrailingWhitespace(IDocument document) throws CoreException {
|
| + public static MultiTextEdit removeTrailingWhitespace(IDocument document, int selectionStart,
|
| + int selectionEnd) throws CoreException {
|
|
|
| MultiTextEdit textEdit = new MultiTextEdit();
|
|
|
| @@ -79,8 +80,13 @@ public class CodeFormatEditFactory {
|
| lineStart,
|
| lineExclusiveEnd - 1,
|
| document);
|
| -
|
| j++;
|
| +
|
| + if (selectionStart != -1 && j == lineStart && selectionStart > lineStart
|
| + && selectionEnd <= lineExclusiveEnd) {
|
| + j = selectionStart;
|
| + }
|
| +
|
| if (j < lineExclusiveEnd) {
|
| DeleteEdit edit = new DeleteEdit(j, lineExclusiveEnd - j);
|
| textEdit.addChild(edit);
|
|
|