Skip to content

Commit

Permalink
Bug fixed AnsiEditorKit, which would insert text at index 0 in some s…
Browse files Browse the repository at this point in the history
…cenario instead of at the end of the document (appending).
  • Loading branch information
flemming-n-larsen committed Jan 12, 2025
1 parent 6e73ab3 commit f199184
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class AnsiEditorKit(

var text = ansiText.substring(0, codeStart)
if (text.isNotEmpty()) {
doc.insertString(0, text, attributes) // no ansi codes found
doc.insertString(doc.length, text, attributes) // no ansi codes found
}

ansiEscCodeRegex.findAll(ansiText, codeStart).forEach { m ->
Expand All @@ -95,6 +95,8 @@ class AnsiEditorKit(
if (text.isNotEmpty()) {
doc.insertString(doc.length, text, attributes)
}

println("${doc.length} $text")
}
}
}

0 comments on commit f199184

Please sign in to comment.