dup line IDEA-57026
authorAlexey Kudravtsev <cdr@intellij.com>
Tue, 3 Aug 2010 08:22:12 +0000 (12:22 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Tue, 3 Aug 2010 08:35:09 +0000 (12:35 +0400)
platform/platform-impl/src/com/intellij/openapi/editor/actions/DuplicateAction.java

index bc1d90c8e724a2fc9b3804bee8e107e8de549a6a..6d9cd2083c405c7c95a42c32bbf7ad06a8c49af7 100644 (file)
@@ -61,6 +61,9 @@ public class DuplicateAction extends EditorAction {
       VisualPosition caret = editor.getCaretModel().getVisualPosition();
       LogicalPosition lineStart = editor.visualToLogicalPosition(new VisualPosition(caret.line, 0));
       LogicalPosition nextLineStart = editor.visualToLogicalPosition(new VisualPosition(caret.line + 1, 0));
+      if (nextLineStart.line == lineStart.line) {
+        nextLineStart = new LogicalPosition(lineStart.line+1, 0);
+      }
 
       int start = editor.logicalPositionToOffset(lineStart);
       int end = editor.logicalPositionToOffset(nextLineStart);
@@ -86,4 +89,4 @@ public class DuplicateAction extends EditorAction {
       presentation.setText(EditorBundle.message("action.duplicate.line"), true);
     }
   }
-}
\ No newline at end of file
+}