mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Force a refresh after register/deregister link matcher
This commit is contained in:
+4
-1
@@ -98,14 +98,17 @@ export class Linkifier {
|
||||
/**
|
||||
* Deregisters a link matcher if it has been registered.
|
||||
* @param {number} matcherId The link matcher's ID (returned after register)
|
||||
* @return {boolean} Whether a link matcher was found and deregistered.
|
||||
*/
|
||||
public deregisterLinkMatcher(matcherId: number): void {
|
||||
public deregisterLinkMatcher(matcherId: number): boolean {
|
||||
// ID 0 is the hypertext link matcher which cannot be deregistered
|
||||
for (let i = 1; i < this._linkMatchers.length; i++) {
|
||||
if (this._linkMatchers[i].id === matcherId) {
|
||||
this._linkMatchers.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-2
@@ -1309,7 +1309,9 @@ Terminal.prototype.attachHypertextLinkHandler = function(handler) {
|
||||
*/
|
||||
Terminal.prototype.registerLinkMatcher = function(regex, handler, matchIndex) {
|
||||
if (this.linkifier) {
|
||||
return this.linkifier.registerLinkMatcher(regex, handler, matchIndex);
|
||||
var matcherId = this.linkifier.registerLinkMatcher(regex, handler, matchIndex);
|
||||
this.refresh(0, this.rows - 1);
|
||||
return matcherId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1319,7 +1321,9 @@ Terminal.prototype.registerLinkMatcher = function(regex, handler, matchIndex) {
|
||||
*/
|
||||
Terminal.prototype.deregisterLinkMatcher = function(matcherId) {
|
||||
if (this.linkifier) {
|
||||
this.linkifier.deregisterLinkMatcher(matcherId);
|
||||
if (this.linkifier.deregisterLinkMatcher(matcherId)) {
|
||||
this.refresh(0, this.rows - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user