diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorSizeAdjustmentStrategy.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorSizeAdjustmentStrategy.java index 368118a38ab7..91119eec0a4c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorSizeAdjustmentStrategy.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorSizeAdjustmentStrategy.java @@ -2,6 +2,7 @@ package com.intellij.openapi.editor.impl; import com.intellij.openapi.editor.ex.util.EditorUtil; +import com.intellij.openapi.util.registry.Registry; import com.intellij.util.SingleEdtTaskScheduler; import it.unimi.dsi.fastutil.longs.LongArrayList; import it.unimi.dsi.fastutil.longs.LongList; @@ -34,7 +35,7 @@ final class EditorSizeAdjustmentStrategy { /** * The minimum number of preferred size changes per target amount of time that is considered to be frequent. */ - private static final int FREQUENT_SIZE_CHANGES_NUMBER = 10; + private static final int FREQUENT_SIZE_CHANGES_NUMBER = getFrequentSizeChangesNumber(); /** * Default number of columns to reserve during frequent typing at the end of the longest document line. @@ -112,6 +113,16 @@ final class EditorSizeAdjustmentStrategy { alarm.cancelAndRequest(1000, new UpdateSizeTask(editor)); } + /** + * It is a hot fix for IJPL-155997 (editor does not scroll horizontally while typing). + * Since it is a pretty annoying bug that you cannot see chars you just typed the freq value is increased to {@code 200}. + * The old value is {@code 10}. + * A proper fix should be implemented in the future. + */ + private static int getFrequentSizeChangesNumber() { + return Registry.intValue("editor.viewport.width.update.frequency", 200); + } + private final class UpdateSizeTask implements Runnable { private final EditorImpl myEditor; diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index adec8337ad0c..2f058c6d19b5 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -1564,6 +1564,9 @@ error.stripe.enabled.description=Shows error stripes in the project view. error.stripe.gap=1 error.stripe.gap.description=Minimal space between error stripe. +editor.viewport.width.update.frequency=200 +editor.viewport.width.update.frequency.description=The minimum number of preferred size changes per target amount of time that is considered to be frequent. + unsound.capture.conversion.java.spec.change=false unsound.capture.conversion.java.spec.change.description=Capture in method reference return type is unsound and the spec would be changed, see https://bugs.openjdk.org/browse/JDK-8170887