mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Apply link matchers in reverse
This enables consumers to have full control.
This commit is contained in:
+2
-2
@@ -78,7 +78,7 @@ export class Linkifier {
|
||||
* this searches the textContent of the rows. You will want to use \s to match
|
||||
* a space ' ' character for example.
|
||||
* @param {LinkHandler} handler The callback when the link is called.
|
||||
* @param {number} matchIndex The index of the link from the regex.match(html)
|
||||
* @param {number} matchIndex The index of the link from the regex.match(text)
|
||||
* call. This defaults to 0 (for regular expressions without capture groups).
|
||||
* @return {number} The ID of the new matcher, this can be used to deregister.
|
||||
*/
|
||||
@@ -118,7 +118,7 @@ export class Linkifier {
|
||||
*/
|
||||
private _linkifyRow(rowIndex: number): void {
|
||||
const text = this._rows[rowIndex].textContent;
|
||||
for (let i = 0; i < this._linkMatchers.length; i++) {
|
||||
for (let i = this._linkMatchers.length - 1; i >= 0; i--) {
|
||||
const matcher = this._linkMatchers[i];
|
||||
const uri = this._findLinkMatch(text, matcher.regex, matcher.matchIndex);
|
||||
if (uri) {
|
||||
|
||||
+1
-1
@@ -1305,7 +1305,7 @@ Terminal.prototype.attachHypertextLinkHandler = function(handler) {
|
||||
* this searches the textContent of the rows. You will want to use \s to match
|
||||
* a space ' ' character for example.
|
||||
* @param {LinkHandler} handler The callback when the link is called.
|
||||
* @param {number} matchIndex The index of the link from the regex.match(html)
|
||||
* @param {number} matchIndex The index of the link from the regex.match(text)
|
||||
* call. This defaults to 0 (for regular expressions without capture groups).
|
||||
* @return {number} The ID of the new matcher, this can be used to deregister.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user