Skip to content

Commit

Permalink
Restore correct selection when region changed at end of selection
Browse files Browse the repository at this point in the history
Fixes #1002314
  • Loading branch information
kiritsuku committed Oct 22, 2014
1 parent 7115fbd commit 91bf06d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,17 @@ class TextSelectionTest {
|class S
|""".stripMargin after Seq("")

@Test
def remove_with_selection_case_3_at_end_of_selection() = """|
|class X {
| ^def f = 0[ ]^
|}
|""".stripMargin becomes """|
|class X {
| ^def f = 0^
|}
|""".stripMargin after Seq("")

@Test
def remove_with_selection_case_4() = """|
|class X {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ object TextEditUtils {
if (selStart < rStart && selEnd < rEnd)
(adjustOffset(0), selLen-(selEnd-rStart))
// case 3: ^ [ ] ^
else if (selStart < rStart && selEnd > rEnd) {
else if (selStart < rStart && selEnd >= rEnd) {
val sub = overlappingEdit match {
case e: ReplaceEdit => e.length-e.getText().length
case e => e.length
Expand Down

0 comments on commit 91bf06d

Please sign in to comment.