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);
// set options for autocompletion
if ($(element).data('allow-auto-completion')) {
editor.setOptions({
@ -520,19 +519,22 @@ configureEditors: function () {
augmentStacktraceInOutput: function () {
if (this.tracepositions_regex) {
var element = $('#output>pre');
var text = element.text();
$('#output>pre').each($.proxy(function(index, element) {
element = $(element)
const text = element.text();
element.on("click", "a", this.jumpToSourceLine.bind(this));
var matches;
let matches;
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) {
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 () {
if ($('#editor').data('rfc-interventions') || $('#editor').data('break-interventions')) { // split in break or rfc intervention
window.onblur = function() { window.blurred = true; };
window.onfocus = function() { window.blurred = false; };
window.onblur = function () {
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 tid;
@ -707,7 +713,9 @@ configureEditors: function () {
}
tid = setInterval(function () {
if ( window.blurred ) { return; }
if (window.blurred) {
return;
}
timeUntilIntervention -= delta;
if (timeUntilIntervention <= 0) {
clearInterval(tid);
@ -758,7 +766,8 @@ configureEditors: function () {
},
dataType: 'json',
type: 'POST',
url: save_search_url});
url: save_search_url
});
})
$('#sidebar-search-collapsed').on('click', this.handleSideBarToggle.bind(this));