Skip to content

Commit

Permalink
Fix caret out of bound issues
Browse files Browse the repository at this point in the history
  • Loading branch information
romainguy committed May 3, 2024
1 parent 64c3fbc commit ceb593e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ open class CodeTextArea(
fun refreshText() {
val saveCaret = caretPosition
super.setText(fullText.takeIf { explorerState.showLineNumbers } ?: fullText.removeLineLumbers())
caretPosition = saveCaret
caretPosition = minOf(saveCaret, document.length)
}

override fun paintComponent(g: Graphics?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ private fun FrameWindowScope.KotlinExplorer(
} else {
dexTextArea.refreshText()
}

},
{ oat -> updateTextArea(oatTextArea, oat) },
{ statusUpdate -> status = statusUpdate },
Expand Down Expand Up @@ -193,7 +192,9 @@ private fun SourcePanel(sourceTextArea: RSyntaxTextArea, explorerState: Explorer
RTextScrollPane(sourceTextArea)
},
update = {
sourceTextArea.text = explorerState.sourceCode
if (explorerState.sourceCode != sourceTextArea.text) {
sourceTextArea.text = explorerState.sourceCode
}
sourceTextArea.updateStyle(explorerState)
}
)
Expand Down

0 comments on commit ceb593e

Please sign in to comment.