fixed IDEA-111701 Emacs: pressing Ctrl+k several times should add lines to muti-line buffer

(regression for IDEA-18764, broken in IDEA-111275)

moveToLogicalPosition and moveToVisualPosition in CaretModel sometimes doesn't actually move caret and used to perform softwrap adjustment on document changes
This commit is contained in:
Ekaterina Tuzova
2013-12-09 13:30:03 +04:00
parent 9207b87b99
commit edc5e4ea38
2 changed files with 15 additions and 2 deletions
@@ -152,7 +152,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
if (myReportCaretMoves) {
LogMessageEx.error(LOG, "Unexpected caret move request");
}
if (!myEditor.isStickySelection()) {
if (!myEditor.isStickySelection() && !pos.equals(myVisibleCaret)) {
CopyPasteManager.getInstance().stopKillRings();
}
@@ -441,7 +441,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
if (myReportCaretMoves) {
LogMessageEx.error(LOG, "Unexpected caret move request");
}
if (!myEditor.isStickySelection()) {
if (!myEditor.isStickySelection() && !pos.equals(myLogicalCaret)) {
CopyPasteManager.getInstance().stopKillRings();
}
@@ -108,4 +108,17 @@ public class KillToWordEndActionTest extends LightPlatformCodeInsightTestCase {
Object string = contents.getTransferData(DataFlavor.stringFlavor);
assertEquals(" second", string);
}
public void testSubsequentKills() throws Exception {
String text = "<caret>first second third";
configureFromFileText(getTestName(false) + ".txt", text);
killToWordEnd();
killToWordEnd();
checkResultByText(" third");
Transferable contents = CopyPasteManager.getInstance().getContents();
assertTrue(contents instanceof KillRingTransferable);
Object string = contents.getTransferData(DataFlavor.stringFlavor);
assertEquals("first second", string);
}
}