Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public StyleRange[] getStyleRanges() {
StyledText textWidget= sourceViewer.getTextWidget();
int widgetLineNumber = getWidgetLineNumber();

if (widgetLineNumber > textWidget.getLineCount()) {
if (widgetLineNumber >= textWidget.getLineCount()) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public void controlMoved(ControlEvent e) {
private boolean areStickyLinesOutDated(StyledText textWidget) {
if (stickyLines.size() > 0) {
int lastStickyLineNumber = stickyLines.get(stickyLines.size() - 1).getLineNumber();
return lastStickyLineNumber > textWidget.getLineCount();
return lastStickyLineNumber >= textWidget.getLineCount();
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ public void testGetStyleRangesIgnoresOutOfBoundLines() {
textWidget.setText("line1\nline2\nline3");

StickyLine stickyLineOutOfBound = new StickyLine(10, sourceViewer);
StyleRange[] styleRanges = stickyLineOutOfBound.getStyleRanges();
assertNull(stickyLineOutOfBound.getStyleRanges());

assertNull(styleRanges);
stickyLineOutOfBound = new StickyLine(3, sourceViewer);
assertNull(stickyLineOutOfBound.getStyleRanges());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void testLayoutStickyLinesCanvasOnResize() {
public void testDontLayoutOutDatedStickyLinesOnResize() {
sourceViewer.getTextWidget().setBounds(0, 0, 200, 200);

List<IStickyLine> stickyLines = List.of(new StickyLineStub("line 10", 10));
List<IStickyLine> stickyLines = List.of(new StickyLineStub("line 1", 1));
stickyScrollingControl.setStickyLines(stickyLines);

Canvas stickyControlCanvas = getStickyControlCanvas(shell);
Expand Down Expand Up @@ -329,6 +329,7 @@ public void testHorizontalScrollingIsDispatched() {
@Test
public void testLimitStickyLinesToTextWidgetHeight() {
sourceViewer.getTextWidget().setBounds(0, 0, 200, 200);
sourceViewer.getTextWidget().setText("line1\nline2");
List<IStickyLine> stickyLines = List.of(new StickyLineStub("line 2", 1));
stickyScrollingControl.setStickyLines(stickyLines);

Expand Down
Loading