import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.util.ModificationTracker;
+import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
public void addToHistory(final String statement) {
final int maxHistorySize = getMaxHistorySize();
synchronized (myHistory) {
- removeFromHistory(statement);
- if (myHistory.size() >= maxHistorySize) {
- myHistory.removeLast();
+ myHistoryCursor = -1;
+ if (!StringUtil.isEmptyOrSpaces(statement)) {
+ removeFromHistory(statement);
+ if (myHistory.size() >= maxHistorySize) {
+ myHistory.removeLast();
+ }
+ myHistory.addFirst(statement);
}
- myHistory.addFirst(statement);
}
}
public void removeFromHistory(final String statement) {
synchronized (myHistory) {
myModificationTracker++;
- myHistoryCursor = -1;
+
myHistory.remove(statement);
}
}