augmentStacktraceInOutput no longer duplicates results

This commit is contained in:
Sebastian Serth
2020-05-04 23:14:36 +02:00
parent cb3eece863
commit 7154bafb7e

View File

@ -246,7 +246,6 @@ configureEditors: function () {
editor.setTheme(this.THEME); editor.setTheme(this.THEME);
// set options for autocompletion // set options for autocompletion
if ($(element).data('allow-auto-completion')) { if ($(element).data('allow-auto-completion')) {
editor.setOptions({ editor.setOptions({
@ -520,19 +519,22 @@ configureEditors: function () {
augmentStacktraceInOutput: function () { augmentStacktraceInOutput: function () {
if (this.tracepositions_regex) { if (this.tracepositions_regex) {
var element = $('#output>pre'); $('#output>pre').each($.proxy(function(index, element) {
var text = element.text(); element = $(element)
const text = element.text();
element.on("click", "a", this.jumpToSourceLine.bind(this)); element.on("click", "a", this.jumpToSourceLine.bind(this));
var matches; let matches;
while (matches = this.tracepositions_regex.exec(text)) { while (matches = this.tracepositions_regex.exec(text)) {
var frame = $('div.frame[data-filename="' + matches[1] + '"]') const frame = $('div.frame[data-filename="' + matches[1] + '"]')
if (frame.length > 0) { if (frame.length > 0) {
element.html(text.replace(matches[0], "<a href='#' data-file='" + matches[1] + "' data-line='" + matches[2] + "'>" + matches[0] + "</a>")); element.html(text.replace(new RegExp(matches[0], 'g'), "<a href='#' data-file='" + matches[1] + "' data-line='" + matches[2] + "'>" + matches[0] + "</a>"));
} }
} }
}, this));
} }
}, },
@ -677,8 +679,12 @@ configureEditors: function () {
initializeInterventionTimer: function () { initializeInterventionTimer: function () {
if ($('#editor').data('rfc-interventions') || $('#editor').data('break-interventions')) { // split in break or rfc intervention if ($('#editor').data('rfc-interventions') || $('#editor').data('break-interventions')) { // split in break or rfc intervention
window.onblur = function() { window.blurred = true; }; window.onblur = function () {
window.onfocus = function() { window.blurred = false; }; window.blurred = true;
};
window.onfocus = function () {
window.blurred = false;
};
var delta = 100; // time in ms to wait for window event before time gets stopped var delta = 100; // time in ms to wait for window event before time gets stopped
var tid; var tid;
@ -707,7 +713,9 @@ configureEditors: function () {
} }
tid = setInterval(function () { tid = setInterval(function () {
if ( window.blurred ) { return; } if (window.blurred) {
return;
}
timeUntilIntervention -= delta; timeUntilIntervention -= delta;
if (timeUntilIntervention <= 0) { if (timeUntilIntervention <= 0) {
clearInterval(tid); clearInterval(tid);
@ -758,7 +766,8 @@ configureEditors: function () {
}, },
dataType: 'json', dataType: 'json',
type: 'POST', type: 'POST',
url: save_search_url}); url: save_search_url
});
}) })
$('#sidebar-search-collapsed').on('click', this.handleSideBarToggle.bind(this)); $('#sidebar-search-collapsed').on('click', this.handleSideBarToggle.bind(this));