KetraTerm
API · v0.3.0All versions

addHyperlink

abstract fun addHyperlink(lineIndex: Int, startOffset: Int, endOffset: Int, action: SwingHyperlinkAction, validationStartOffset: Int = 0, validationEndOffset: Int = Int.MAX_VALUE)

Adds a detected hyperlink.

By default the result is valid only while its detector's SwingHyperlinkDetector.context is unchanged: the logical line or the complete visible viewport. A detector may supply an explicit validation range when the result depends on only part of one line. That range must contain the highlight and every character affecting detection or the action, including token delimiters. Include the trailing line separator when the result depends on the end of the line, so appended text invalidates it.

Invalid ranges, including validation ranges that do not contain the highlight, are ignored.

Parameters

lineIndex

logical line index from the detection request.

startOffset

inclusive UTF-16 offset within the line text.

endOffset

exclusive UTF-16 offset within the line text.

action

host-owned action invoked after explicit user activation.

validationStartOffset

inclusive UTF-16 offset of the text that determines this result; defaults to the start of the logical line.

validationEndOffset

exclusive UTF-16 offset of that text, including any required boundary characters. Int.MAX_VALUE retains the detector's default context dependency; explicit ranges use a concrete line offset.