[editor] IJPL-155997 Increase frequent size change threshold to improve horizontal scrolling during typing

GitOrigin-RevId: 8b2e90c2005fb49d3e99ad518a51378483e90f28
This commit is contained in:
Alexander Trushev
2025-07-16 12:31:36 +00:00
committed by intellij-monorepo-bot
parent 0f7f951888
commit 8aec23faf1
2 changed files with 15 additions and 1 deletions
@@ -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;
@@ -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