Factor logic into registry, make matches cell-based and document

This commit is contained in:
Jeff Principe
2018-07-08 11:30:54 -07:00
parent 5e3ebbde5e
commit 63b3a6f323
11 changed files with 647 additions and 295 deletions
+20 -2
View File
@@ -473,8 +473,26 @@ declare module 'xterm' {
/**
* (EXPERIMENTAL) Registers a character joiner, allowing custom sequences of
* characters to be rendered as a single unit. This is useful in particular
* for rendering ligatures. NOTE: character joiners are only used by the
* canvas renderer.
* for rendering ligatures and graphemes, among other things.
*
* Each registered character joiner is called with a string of text
* representing a portion of a line in the terminal that can be rendered as
* a single unit. The joiner must return a sorted array, where each entry is
* itself an array of length two, containing the start (inclusive) and end
* (exclusive) index of a substring of the input that should be rendered as
* a single unit. When multiple joiners are provided, the results of each
* are collected. If there are any overlapping substrings between them, they
* are combined into one larger unit that is drawn together.
*
* All character joiners that are registered get called every time a line is
* rendered in the terminal, so it is essential for the handler function to
* run as quickly as possible to avoid slowdowns when rendering. Similarly,
* joiners should strive to return the smallest possible substrings to
* render together, since they aren't drawn as optimally as individual
* characters.
*
* NOTE: character joiners are only used by the canvas renderer.
*
* @param handler The function that determines character joins. It is called
* with a string of text that is eligible for joining and returns an array
* where each entry is an array containing the start (inclusive) and end