Skip to content

Commit

Permalink
Merge pull request #203 from ru5k/fix_scroll_for_large_files
Browse files Browse the repository at this point in the history
Fix Int overflow when calculating viewport area position in large files
  • Loading branch information
vektah authored Mar 28, 2018
2 parents 6067408 + e4993f0 commit c50cabe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/net/vektah/codeglance/GlancePanel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,9 @@ class GlancePanel(private val project: Project, fileEditor: FileEditor, private
}

val visibleArea = editor.scrollingModel.visibleArea
val start = scrollstate.documentHeight * visibleArea.y / editor.contentComponent.height
val end = scrollstate.documentHeight * visibleArea.height / editor.contentComponent.height
val factor = scrollstate.documentHeight.toDouble() / editor.contentComponent.height

scrollstate.setViewportArea(start, end)
scrollstate.setViewportArea((factor * visibleArea.y).toInt(), (factor * visibleArea.height).toInt())
scrollstate.setVisibleHeight(height)

if (currentFoldCount != lastFoldCount) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<change-notes><![CDATA[
<h3>1.5.3</h3>
<ul>
<li>Bugfix: Viewport position now calculates correctly for large files</li>
<li>Bugfix: Render style and alignment now save correctly</li>
<li>Bugfix: Queue full</li>
</ul>
Expand Down

0 comments on commit c50cabe

Please sign in to comment.