@@ -4265,12 +4265,20 @@ public int getOrientation () {
42654265 */
42664266int getPartialBottomIndex () {
42674267 if (isFixedLineHeight ()) {
4268- int lineHeight = renderer .getLineHeight ();
4269- int partialLineCount = Compatibility .ceil (clientAreaHeight , lineHeight );
4270- return Math .max (0 , Math .min (content .getLineCount (), topIndex + partialLineCount ) - 1 );
4268+ return getPartialBottomIndexFixedLineHeight ();
42714269 }
42724270 return getLineIndex (clientAreaHeight - bottomMargin );
42734271}
4272+ /**
4273+ * Returns the index of the last partially visible line assuming a fixed line height.
4274+ *
4275+ * @return index of the last partially visible line.
4276+ */
4277+ private int getPartialBottomIndexFixedLineHeight () {
4278+ int lineHeight = renderer .getLineHeight ();
4279+ int partialLineCount = Compatibility .ceil (clientAreaHeight , lineHeight );
4280+ return Math .max (0 , Math .min (content .getLineCount (), topIndex + partialLineCount ) - 1 );
4281+ }
42744282/**
42754283 * Returns the index of the first partially visible line.
42764284 *
@@ -9315,7 +9323,8 @@ public void setLineVerticalIndent(int lineIndex, int verticalLineIndent) {
93159323 }
93169324 int initialTopPixel = getTopPixel ();
93179325 int initialTopIndex = getPartialTopIndex ();
9318- int initialBottomIndex = getPartialBottomIndex ();
9326+ // use getPartialBottomIndexFixedLineHeight to include more additional lines to fix scrolling issue eclipse-platform/eclipse.platform.swt#2512
9327+ int initialBottomIndex = getPartialBottomIndexFixedLineHeight ();
93199328 int verticalIndentDiff = verticalLineIndent - previousVerticalIndent ;
93209329 renderer .setLineVerticalIndent (lineIndex , verticalLineIndent );
93219330 this .hasVerticalIndent = verticalLineIndent != 0 || renderer .hasVerticalIndent ();
@@ -9332,8 +9341,8 @@ public void setLineVerticalIndent(int lineIndex, int verticalLineIndent) {
93329341 }
93339342 } else {
93349343 resetCache (lineIndex , 1 );
9335- if ((initialTopIndex == 0 ) && (initialBottomIndex == (content .getLineCount () - 1 ))) { // not scrollable editor
9336- setCaretLocations ();
9344+ if ((initialTopIndex == 0 ) && (initialBottomIndex == (content .getLineCount () - 1 ))) { // not scrollable editor
9345+ setCaretLocations ();
93379346 redrawLines (lineIndex , getBottomIndex () - lineIndex + 1 , true );
93389347 } else if (getFirstCaretLine () >= initialTopIndex && getFirstCaretLine () <= initialBottomIndex ) { // caret line with caret mustn't move
93399348 if (getFirstCaretLine () < lineIndex ) {
0 commit comments