diff --git a/spellchecker/src/com/intellij/spellchecker/SpellCheckerManager.java b/spellchecker/src/com/intellij/spellchecker/SpellCheckerManager.java index 49c5c2a7e07f..741bf343e011 100644 --- a/spellchecker/src/com/intellij/spellchecker/SpellCheckerManager.java +++ b/spellchecker/src/com/intellij/spellchecker/SpellCheckerManager.java @@ -222,18 +222,18 @@ public class SpellCheckerManager implements Disposable { UndoManager.getInstance(project).undoableActionPerformed(new BasicUndoableAction(file) { @Override public void undo() { - dictionary.removeFromDictionary(word); + dictionary.removeFromDictionary(transformed); restartInspections(); } @Override public void redo() { - dictionary.addToDictionary(word); + dictionary.addToDictionary(transformed); restartInspections(); } }); } - dictionary.addToDictionary(word); + dictionary.addToDictionary(transformed); restartInspections(); } } diff --git a/spellchecker/testSrc/com/intellij/spellchecker/inspector/AcceptWordAsCorrectTest.java b/spellchecker/testSrc/com/intellij/spellchecker/inspector/AcceptWordAsCorrectTest.java new file mode 100644 index 000000000000..97d94e658986 --- /dev/null +++ b/spellchecker/testSrc/com/intellij/spellchecker/inspector/AcceptWordAsCorrectTest.java @@ -0,0 +1,24 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.spellchecker.inspector; + +import com.intellij.spellchecker.SpellCheckerManager; +import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; + +@SuppressWarnings("SpellCheckingInspection") +public class AcceptWordAsCorrectTest extends LightPlatformCodeInsightFixtureTestCase { + + private void doTest(String word) { + final SpellCheckerManager manager = SpellCheckerManager.getInstance(myFixture.getProject()); + assertTrue(manager.hasProblem(word)); + manager.acceptWordAsCorrect(word, myFixture.getProject()); + assertFalse(manager.hasProblem(word)); + } + + public void testGeneral(){ + doTest("wooord"); + } + + public void testCamelCase(){ + doTest("Tyyyyypo"); + } +}