From d005bf3ece67956b260f84c281a626669e92299f Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Sat, 23 Mar 2019 15:26:28 +0100 Subject: [PATCH 01/21] Improve pane interlinking c.f: #1313 --- static/explorer.css | 4 -- static/panes/compiler.js | 64 ++++++++++++++++++----------- static/panes/editor.js | 71 +++++++++++++++++--------------- static/panes/ir-view.js | 73 ++++++++++++++++++++++++++++++++- static/themes/dark-theme.css | 4 ++ static/themes/default-theme.css | 4 ++ 6 files changed, 159 insertions(+), 61 deletions(-) diff --git a/static/explorer.css b/static/explorer.css index 935e09f96..326d0e04a 100644 --- a/static/explorer.css +++ b/static/explorer.css @@ -239,10 +239,6 @@ pre.content.wrap { left: 3px; } -.linked-code-decoration-inline { - font-weight: 600; -} - .modal-content .well { border: 1px solid; border-radius: 3px; diff --git a/static/panes/compiler.js b/static/panes/compiler.js index 492e9d073..771b1aaf6 100644 --- a/static/panes/compiler.js +++ b/static/panes/compiler.js @@ -165,10 +165,6 @@ function Compiler(hub, container, state) { }); } -Compiler.prototype.clearEditorsLinkedLines = function () { - this.eventHub.emit('editorSetDecoration', this.sourceEditorId, -1, false); -}; - Compiler.prototype.getGroupsInUse = function () { return _.chain(this.getCurrentLangCompilers()) .map() @@ -1120,6 +1116,7 @@ Compiler.prototype.initListeners = function () { this.eventHub.on('resendCompilation', this.onResendCompilation, this); this.eventHub.on('findCompilers', this.sendCompiler, this); this.eventHub.on('compilerSetDecorations', this.onCompilerSetDecorations, this); + this.eventHub.on('panesLinkLine', this.onPanesLinkLine, this); this.eventHub.on('settingsChange', this.onSettingsChange, this); this.eventHub.on('requestCompilation', this.onRequestCompilation, this); @@ -1172,23 +1169,6 @@ Compiler.prototype.initCallbacks = function () { this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 250); this.outputEditor.onMouseMove(_.bind(function (e) { this.mouseMoveThrottledFunction(e); - if (this.linkedFadeTimeoutId !== -1) { - clearTimeout(this.linkedFadeTimeoutId); - this.linkedFadeTimeoutId = -1; - } - }, this)); - - this.outputEditor.onMouseLeave(_.bind(function () { - this.linkedFadeTimeoutId = setTimeout(_.bind(function () { - this.clearEditorsLinkedLines(); - this.linkedFadeTimeoutId = -1; - }, this), 5000); - }, this)); - - this.outputEditor.onMouseUp(_.bind(function () { - if (this.getEffectiveFilters().binary) { - this.setBinaryMargin(); - } }, this)); this.outputEditor.onContextMenu(_.bind(function () { @@ -1345,6 +1325,42 @@ Compiler.prototype.updateDecorations = function () { this.prevDecorations, _.flatten(_.values(this.decorations))); }; +Compiler.prototype.clearLinkedLines = function () { + this.decorations.linkedCode = []; + this.updateDecorations(); +}; + +Compiler.prototype.onPanesLinkLine = function (compilerId, lineNumber, revealLine, sender) { + if (Number(compilerId) === this.id) { + var lineNums = []; + _.each(this.assembly, function (asmLine, i) { + if (asmLine.source && asmLine.source.file === null && asmLine.source.line === lineNumber) { + lineNums.push(i + 1); + } + }); + if (revealLine && lineNums[0]) this.outputEditor.revealLineInCenter(lineNums[0]); + var inlineClass = sender !== this ? 'linked-code-decoration-inline' : ''; + this.decorations.linkedCode = _.map(lineNums, function (line) { + return { + range: new monaco.Range(line, 1, line, 1), + options: { + isWholeLine: true, + linesDecorationsClassName: 'linked-code-decoration-margin', + inlineClassName: inlineClass + } + }; + }); + if (this.linkedFadeTimeoutId !== -1) { + clearTimeout(this.linkedFadeTimeoutId); + } + this.linkedFadeTimeoutId = setTimeout(_.bind(function () { + this.clearLinkedLines(); + this.linkedFadeTimeoutId = -1; + }, this), 5000); + this.updateDecorations(); + } +}; + Compiler.prototype.onCompilerSetDecorations = function (id, lineNums, revealLine) { if (Number(id) === this.id) { if (revealLine && lineNums[0]) this.outputEditor.revealLineInCenter(lineNums[0]); @@ -1457,11 +1473,13 @@ function getAsmInfo(opcode) { Compiler.prototype.onMouseMove = function (e) { if (e === null || e.target === null || e.target.position === null) return; if (this.settings.hoverShowSource === true && this.assembly) { + this.clearLinkedLines(); var hoverAsm = this.assembly[e.target.position.lineNumber - 1]; if (hoverAsm) { // We check that we actually have something to show at this point! - this.eventHub.emit('editorSetDecoration', this.sourceEditorId, hoverAsm.source && !hoverAsm.source.file ? - hoverAsm.source.line : -1, false); + var sourceLine = hoverAsm.source && !hoverAsm.source.file ? hoverAsm.source.line : -1; + this.eventHub.emit('editorLinkLine', this.sourceEditorId, sourceLine, false); + this.eventHub.emit('panesLinkLine', this.id, sourceLine, false, this); } } var currentWord = this.outputEditor.getModel().getWordAtPosition(e.target.position); diff --git a/static/panes/editor.js b/static/panes/editor.js index e7f922be8..73473a44f 100644 --- a/static/panes/editor.js +++ b/static/panes/editor.js @@ -240,6 +240,7 @@ Editor.prototype.initCallbacks = function () { this.eventHub.on('compileResult', this.onCompileResponse, this); this.eventHub.on('selectLine', this.onSelectLine, this); this.eventHub.on('editorSetDecoration', this.onEditorSetDecoration, this); + this.eventHub.on('editorLinkLine', this.onEditorLinkLine, this); this.eventHub.on('settingsChange', this.onSettingsChange, this); this.eventHub.on('conformanceViewOpen', this.onConformanceViewOpen, this); this.eventHub.on('conformanceViewClose', this.onConformanceViewClose, this); @@ -251,31 +252,21 @@ Editor.prototype.initCallbacks = function () { this.updateState(); }, this)); - this.editor.onMouseLeave(_.bind(function () { - this.fadeTimeoutId = setTimeout(_.bind(function () { - this.clearCompilerLinkedLines(); - this.fadeTimeoutId = -1; - }, this), 5000); - }, this)); - - this.mouseMoveThrottledFunction = _.throttle(_.bind(function (e) { - if (e !== null && e.target !== null && this.settings.hoverShowSource && e.target.position !== null) { - this.tryCompilerLinkLine(e.target.position.lineNumber, false); - } - }, this), 250); + this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 250); this.editor.onMouseMove(_.bind(function (e) { this.mouseMoveThrottledFunction(e); - // This can't be throttled or we can clear a timeout where we're already outside - if (this.fadeTimeoutId !== -1) { - clearTimeout(this.fadeTimeoutId); - this.fadeTimeoutId = -1; - } }, this)); this.eventHub.on('initialised', this.maybeEmitChange, this); }; +Editor.prototype.onMouseMove = function (e) { + if (e !== null && e.target !== null && this.settings.hoverShowSource && e.target.position !== null) { + this.tryPanesLinkLine(e.target.position.lineNumber, false); + } +}; + Editor.prototype.initButtons = function (state) { this.fontScale = new FontScale(this.domRoot, state, this.editor); this.languageBtn = this.domRoot.find('.change-language'); @@ -378,21 +369,14 @@ Editor.prototype.changeLanguage = function (newLang) { this.selectize.setValue(newLang); }; -Editor.prototype.clearCompilerLinkedLines = function () { - _.each(this.asmByCompiler, _.bind(function (asms, compilerId) { - this.eventHub.emit('compilerSetDecorations', compilerId, -1, false); - }, this)); +Editor.prototype.clearLinkedLine = function () { + this.decorations.linkedCode = []; + this.updateDecorations(); }; -Editor.prototype.tryCompilerLinkLine = function (thisLineNumber, reveal) { +Editor.prototype.tryPanesLinkLine = function (thisLineNumber, reveal) { _.each(this.asmByCompiler, _.bind(function (asms, compilerId) { - var targetLines = []; - _.each(asms, function (asmLine, i) { - if (asmLine.source && asmLine.source.file === null && asmLine.source.line === thisLineNumber) { - targetLines.push(i + 1); - } - }); - this.eventHub.emit('compilerSetDecorations', compilerId, targetLines, reveal); + this.eventHub.emit('panesLinkLine', compilerId, thisLineNumber, reveal); }, this)); }; @@ -463,7 +447,7 @@ Editor.prototype.initEditorActions = function () { contextMenuGroupId: 'navigation', contextMenuOrder: 1.5, run: _.bind(function (ed) { - this.tryCompilerLinkLine(ed.getPosition().lineNumber, true); + this.tryPanesLinkLine(ed.getPosition().lineNumber, true); }, this) }); }; @@ -714,10 +698,33 @@ Editor.prototype.onSelectLine = function (id, lineNum) { } }; +Editor.prototype.onEditorLinkLine = function (editorId, lineNum, reveal) { + if (Number(editorId) === this.id) { + if (reveal && lineNum) this.editor.revealLineInCenter(lineNum); + this.decorations.linkedCode = lineNum === -1 || !lineNum ? [] : [{ + range: new monaco.Range(lineNum, 1, lineNum, 1), + options: { + isWholeLine: true, + linesDecorationsClassName: 'linked-code-decoration-margin', + inlineClassName: 'linked-code-decoration-inline' + } + }]; + + if (this.fadeTimeoutId !== -1) { + clearTimeout(this.fadeTimeoutId); + } + this.fadeTimeoutId = setTimeout(_.bind(function () { + this.clearLinkedLine(); + this.fadeTimeoutId = -1; + }, this), 5000); + + this.updateDecorations(); + } +}; + Editor.prototype.onEditorSetDecoration = function (id, lineNum, reveal) { if (Number(id) === this.id) { - if (reveal && lineNum) - this.editor.revealLineInCenter(lineNum); + if (reveal && lineNum) this.editor.revealLineInCenter(lineNum); this.decorations.linkedCode = lineNum === -1 || !lineNum ? [] : [{ range: new monaco.Range(lineNum, 1, lineNum, 1), options: { diff --git a/static/panes/ir-view.js b/static/panes/ir-view.js index 001671243..b07af406f 100644 --- a/static/panes/ir-view.js +++ b/static/panes/ir-view.js @@ -36,7 +36,10 @@ function Ir(hub, container, state) { this.eventHub = hub.createEventHub(); this.domRoot = container.getElement(); this.domRoot.html($('#ir').html()); - this._currentDecorations = []; + + this.decorations = {}; + this.prevDecorations = []; + this.irEditor = monaco.editor.create(this.domRoot.find(".monaco-placeholder")[0], { fontFamily: 'Consolas, "Liberation Mono", Courier, monospace', value: "", @@ -57,6 +60,8 @@ function Ir(hub, container, state) { this._compilerName = state.compilerName; this._editorid = state.editorid; + this.settings = {}; + this.colours = []; this.irCode = []; this.lastColours = []; @@ -84,6 +89,12 @@ Ir.prototype.initButtons = function (state) { }; Ir.prototype.initCallbacks = function () { + this.linkedFadeTimeoutId = -1; + this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 250); + this.irEditor.onMouseMove(_.bind(function (e) { + this.mouseMoveThrottledFunction(e); + }, this)); + this.fontScale.on('change', _.bind(this.updateState, this)); this.container.on('destroy', this.close, this); @@ -91,6 +102,7 @@ Ir.prototype.initCallbacks = function () { this.eventHub.on('compileResult', this.onCompileResponse, this); this.eventHub.on('compiler', this.onCompiler, this); this.eventHub.on('colours', this.onColours, this); + this.eventHub.on('panesLinkLine', this.onPanesLinkLine, this); this.eventHub.on('compilerClose', this.onCompilerClose, this); this.eventHub.on('settingsChange', this.onSettingsChange, this); this.eventHub.emit('irViewOpened', this._compilerid); @@ -196,14 +208,71 @@ Ir.prototype.onCompilerClose = function (id) { }; Ir.prototype.onSettingsChange = function (newSettings) { + this.settings = newSettings; this.irEditor.updateOptions({ contextmenu: newSettings.useCustomContextMenu, minimap: { enabled: newSettings.showMinimap - } + }, + fontFamily: newSettings.editorsFFont }); }; +Ir.prototype.onMouseMove = function (e) { + if (e === null || e.target === null || e.target.position === null) return; + if (this.settings.hoverShowSource === true && this.irCode) { + this.clearLinkedLines(); + var hoverCode = this.irCode[e.target.position.lineNumber - 1]; + if (hoverCode) { + // We check that we actually have something to show at this point! + var sourceLine = hoverCode.source && !hoverCode.source.file ? hoverCode.source.line : -1; + this.eventHub.emit('editorLinkLine', this._editorid, sourceLine, false); + this.eventHub.emit('panesLinkLine', this._compilerid, sourceLine, false, this); + } + } +}; + +Ir.prototype.updateDecorations = function () { + this.prevDecorations = this.irEditor.deltaDecorations( + this.prevDecorations, _.flatten(_.values(this.decorations))); +}; + +Ir.prototype.clearLinkedLines = function () { + this.decorations.linkedCode = []; + this.updateDecorations(); +}; + +Ir.prototype.onPanesLinkLine = function (compilerId, lineNumber, revealLine, sender) { + if (Number(compilerId) === this._compilerid) { + var lineNums = []; + _.each(this.irCode, function (irLine, i) { + if (irLine.source && irLine.source.file === null && irLine.source.line === lineNumber) { + lineNums.push(i + 1); + } + }); + if (revealLine && lineNums[0]) this.irEditor.revealLineInCenter(lineNums[0]); + var inlineClass = sender !== this ? 'linked-code-decoration-inline' : ''; + this.decorations.linkedCode = _.map(lineNums, function (line) { + return { + range: new monaco.Range(line, 1, line, 1), + options: { + isWholeLine: true, + linesDecorationsClassName: 'linked-code-decoration-margin', + inlineClassName: inlineClass + } + }; + }); + if (this.linkedFadeTimeoutId !== -1) { + clearTimeout(this.linkedFadeTimeoutId); + } + this.linkedFadeTimeoutId = setTimeout(_.bind(function () { + this.clearLinkedLines(); + this.linkedFadeTimeoutId = -1; + }, this), 5000); + this.updateDecorations(); + } +}; + Ir.prototype.close = function () { this.eventHub.unsubscribe(); this.eventHub.emit("irViewClosed", this._compilerid); diff --git a/static/themes/dark-theme.css b/static/themes/dark-theme.css index ca36dd9ee..b5e9ee012 100644 --- a/static/themes/dark-theme.css +++ b/static/themes/dark-theme.css @@ -79,6 +79,10 @@ a.navbar-brand img.logo.normal { background-color: #333 !important; } +.linked-code-decoration-inline { + background: #121212 !important; +} + .linked-code-decoration-margin { background: #433b4b !important; } diff --git a/static/themes/default-theme.css b/static/themes/default-theme.css index 658996b10..e92091b15 100644 --- a/static/themes/default-theme.css +++ b/static/themes/default-theme.css @@ -73,6 +73,10 @@ a.navbar-brand img.logo.normal { background: lightblue; } +.linked-code-decoration-inline { + background: lightblue; +} + .font-option { background: white; } From bcbd590f2991605113ed6ffaa9c08c409d6113a7 Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Sun, 24 Mar 2019 19:28:55 +0100 Subject: [PATCH 02/21] Send unique pane name instead of this reference --- static/panes/compiler.js | 19 +++++++++++++++---- static/panes/editor.js | 6 +++++- static/panes/ir-view.js | 12 +++++++----- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/static/panes/compiler.js b/static/panes/compiler.js index 771b1aaf6..7db1fa482 100644 --- a/static/panes/compiler.js +++ b/static/panes/compiler.js @@ -1297,11 +1297,22 @@ Compiler.prototype.getCompilerName = function () { return this.compiler ? this.compiler.name : 'No compiler set'; }; + +Compiler.prototype.getLanguageName = function () { + var lang = options.languages[this.currentLangId]; + return lang ? lang.name : '?'; +}; + +Compiler.prototype.getPaneName = function () { + var langName = this.getLanguageName(); + var compName = this.getCompilerName(); + return compName + ' (Editor #' + this.sourceEditorId + ', Compiler #' + this.id + ') ' + langName; +}; + Compiler.prototype.updateCompilerName = function () { - var name = options.languages[this.currentLangId].name; var compilerName = this.getCompilerName(); var compilerVersion = this.compiler ? this.compiler.version : ''; - this.container.setTitle(compilerName + ' (Editor #' + this.sourceEditorId + ', Compiler #' + this.id + ') ' + name); + this.container.setTitle(this.getPaneName()); this.shortCompilerName.text(compilerName); this.setCompilerVersionPopover(compilerVersion); }; @@ -1339,7 +1350,7 @@ Compiler.prototype.onPanesLinkLine = function (compilerId, lineNumber, revealLin } }); if (revealLine && lineNums[0]) this.outputEditor.revealLineInCenter(lineNums[0]); - var inlineClass = sender !== this ? 'linked-code-decoration-inline' : ''; + var inlineClass = sender !== this.getPaneName() ? 'linked-code-decoration-inline' : ''; this.decorations.linkedCode = _.map(lineNums, function (line) { return { range: new monaco.Range(line, 1, line, 1), @@ -1479,7 +1490,7 @@ Compiler.prototype.onMouseMove = function (e) { // We check that we actually have something to show at this point! var sourceLine = hoverAsm.source && !hoverAsm.source.file ? hoverAsm.source.line : -1; this.eventHub.emit('editorLinkLine', this.sourceEditorId, sourceLine, false); - this.eventHub.emit('panesLinkLine', this.id, sourceLine, false, this); + this.eventHub.emit('panesLinkLine', this.id, sourceLine, false, this.getPaneName()); } } var currentWord = this.outputEditor.getModel().getWordAtPosition(e.target.position); diff --git a/static/panes/editor.js b/static/panes/editor.js index 73473a44f..ecc651e61 100644 --- a/static/panes/editor.js +++ b/static/panes/editor.js @@ -797,8 +797,12 @@ Editor.prototype.onLanguageChange = function (newLangId) { } }; +Editor.prototype.getPaneName = function () { + return this.currentLanguage.name + " source #" + this.id; +}; + Editor.prototype.updateTitle = function () { - this.container.setTitle(this.currentLanguage.name + " source #" + this.id); + this.container.setTitle(this.getPaneName()); }; // Called every time we change language, so we get the relevant code diff --git a/static/panes/ir-view.js b/static/panes/ir-view.js index b07af406f..b1c8df354 100644 --- a/static/panes/ir-view.js +++ b/static/panes/ir-view.js @@ -135,10 +135,12 @@ Ir.prototype.onCompileResponse = function (id, compiler, result) { this.onColours(this._compilerid, this.lastColours, this.lastColourScheme); }; +Ir.prototype.getPaneName = function () { + return this._compilerName + " IR Viewer (Editor #" + this._editorid + ", Compiler #" + this._compilerid + ")"; +}; + Ir.prototype.setTitle = function () { - this.container.setTitle( - this._compilerName + " IR Viewer (Editor #" + this._editorid + ", Compiler #" + this._compilerid + ")" - ); + this.container.setTitle(this.getPaneName()); }; Ir.prototype.showIrResults = function (irCode) { @@ -227,7 +229,7 @@ Ir.prototype.onMouseMove = function (e) { // We check that we actually have something to show at this point! var sourceLine = hoverCode.source && !hoverCode.source.file ? hoverCode.source.line : -1; this.eventHub.emit('editorLinkLine', this._editorid, sourceLine, false); - this.eventHub.emit('panesLinkLine', this._compilerid, sourceLine, false, this); + this.eventHub.emit('panesLinkLine', this._compilerid, sourceLine, false, this.getPaneName()); } } }; @@ -251,7 +253,7 @@ Ir.prototype.onPanesLinkLine = function (compilerId, lineNumber, revealLine, sen } }); if (revealLine && lineNums[0]) this.irEditor.revealLineInCenter(lineNums[0]); - var inlineClass = sender !== this ? 'linked-code-decoration-inline' : ''; + var inlineClass = sender !== this.getPaneName() ? 'linked-code-decoration-inline' : ''; this.decorations.linkedCode = _.map(lineNums, function (line) { return { range: new monaco.Range(line, 1, line, 1), From 1dae8cc71fdc26cd95087bee95aeab351dabdc46 Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Wed, 27 Mar 2019 21:21:03 +0100 Subject: [PATCH 03/21] Further work towards a better code linking colours --- static/colour.js | 34 ++++++++++++++++----------------- static/panes/compiler.js | 4 ++-- static/panes/editor.js | 4 ++-- static/panes/ir-view.js | 14 +++++++------- static/themes/default-theme.css | 4 ++++ 5 files changed, 32 insertions(+), 28 deletions(-) diff --git a/static/colour.js b/static/colour.js index 2733413e7..bed22cb16 100644 --- a/static/colour.js +++ b/static/colour.js @@ -1,25 +1,25 @@ // Copyright (c) 2016, Matt Godbolt // All rights reserved. -// -// Redistribution and use in source and binary forms, with or without +// +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, +// +// * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. "use strict"; diff --git a/static/panes/compiler.js b/static/panes/compiler.js index 7db1fa482..bc35c58e9 100644 --- a/static/panes/compiler.js +++ b/static/panes/compiler.js @@ -1350,14 +1350,14 @@ Compiler.prototype.onPanesLinkLine = function (compilerId, lineNumber, revealLin } }); if (revealLine && lineNums[0]) this.outputEditor.revealLineInCenter(lineNums[0]); - var inlineClass = sender !== this.getPaneName() ? 'linked-code-decoration-inline' : ''; + var lineClass = sender !== this.getPaneName() ? 'linked-code-decoration-line' : ''; this.decorations.linkedCode = _.map(lineNums, function (line) { return { range: new monaco.Range(line, 1, line, 1), options: { isWholeLine: true, linesDecorationsClassName: 'linked-code-decoration-margin', - inlineClassName: inlineClass + className: lineClass } }; }); diff --git a/static/panes/editor.js b/static/panes/editor.js index ecc651e61..69329dabb 100644 --- a/static/panes/editor.js +++ b/static/panes/editor.js @@ -441,7 +441,7 @@ Editor.prototype.initEditorActions = function () { this.editor.addAction({ id: 'viewasm', - label: 'Scroll to assembly', + label: 'Reveal linked code', keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10], keybindingContext: null, contextMenuGroupId: 'navigation', @@ -706,7 +706,7 @@ Editor.prototype.onEditorLinkLine = function (editorId, lineNum, reveal) { options: { isWholeLine: true, linesDecorationsClassName: 'linked-code-decoration-margin', - inlineClassName: 'linked-code-decoration-inline' + className: 'linked-code-decoration-line' } }]; diff --git a/static/panes/ir-view.js b/static/panes/ir-view.js index b1c8df354..859e04096 100644 --- a/static/panes/ir-view.js +++ b/static/panes/ir-view.js @@ -125,9 +125,8 @@ Ir.prototype.onCompileResponse = function (id, compiler, result) { if (this._compilerid !== id) return; if (result.hasIrOutput) { this.showIrResults(result.irOutput); - } - else if (compiler.supportsIrView) { - this.showIrResults([{text:""}]); + } else if (compiler.supportsIrView) { + this.showIrResults([{text: ""}]); } // Why call this explicitly instead of just listening to the "colours" event? @@ -227,7 +226,7 @@ Ir.prototype.onMouseMove = function (e) { var hoverCode = this.irCode[e.target.position.lineNumber - 1]; if (hoverCode) { // We check that we actually have something to show at this point! - var sourceLine = hoverCode.source && !hoverCode.source.file ? hoverCode.source.line : -1; + var sourceLine = hoverCode.source && !hoverCode.source.file ? hoverCode.source.line : -1; this.eventHub.emit('editorLinkLine', this._editorid, sourceLine, false); this.eventHub.emit('panesLinkLine', this._compilerid, sourceLine, false, this.getPaneName()); } @@ -249,18 +248,19 @@ Ir.prototype.onPanesLinkLine = function (compilerId, lineNumber, revealLine, sen var lineNums = []; _.each(this.irCode, function (irLine, i) { if (irLine.source && irLine.source.file === null && irLine.source.line === lineNumber) { - lineNums.push(i + 1); + var line = i + 1; + lineNums.push(line); } }); if (revealLine && lineNums[0]) this.irEditor.revealLineInCenter(lineNums[0]); - var inlineClass = sender !== this.getPaneName() ? 'linked-code-decoration-inline' : ''; + var lineClass = sender !== this.getPaneName() ? 'linked-code-decoration-line' : ''; this.decorations.linkedCode = _.map(lineNums, function (line) { return { range: new monaco.Range(line, 1, line, 1), options: { isWholeLine: true, linesDecorationsClassName: 'linked-code-decoration-margin', - inlineClassName: inlineClass + className: lineClass } }; }); diff --git a/static/themes/default-theme.css b/static/themes/default-theme.css index e92091b15..f43547145 100644 --- a/static/themes/default-theme.css +++ b/static/themes/default-theme.css @@ -77,6 +77,10 @@ a.navbar-brand img.logo.normal { background: lightblue; } +.linked-code-decoration-line { + background: lightblue !important; +} + .font-option { background: white; } From 3343a68e7f461e176a5d9ecc245f361110c087c3 Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Mon, 1 Apr 2019 10:43:12 +0200 Subject: [PATCH 04/21] Upgrade compiler output code link --- static/explorer.css | 5 +++++ static/panes/compiler.js | 2 +- static/panes/editor.js | 12 +++++++++++- static/panes/ir-view.js | 2 +- static/panes/output.js | 10 ++++++---- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/static/explorer.css b/static/explorer.css index 326d0e04a..3aaa7b012 100644 --- a/static/explorer.css +++ b/static/explorer.css @@ -239,6 +239,11 @@ pre.content.wrap { left: 3px; } +.linked-code-decoration-column { + font-weight: 600; + color: pink; +} + .modal-content .well { border: 1px solid; border-radius: 3px; diff --git a/static/panes/compiler.js b/static/panes/compiler.js index bc35c58e9..cc06147a9 100644 --- a/static/panes/compiler.js +++ b/static/panes/compiler.js @@ -1489,7 +1489,7 @@ Compiler.prototype.onMouseMove = function (e) { if (hoverAsm) { // We check that we actually have something to show at this point! var sourceLine = hoverAsm.source && !hoverAsm.source.file ? hoverAsm.source.line : -1; - this.eventHub.emit('editorLinkLine', this.sourceEditorId, sourceLine, false); + this.eventHub.emit('editorLinkLine', this.sourceEditorId, sourceLine, -1, false); this.eventHub.emit('panesLinkLine', this.id, sourceLine, false, this.getPaneName()); } } diff --git a/static/panes/editor.js b/static/panes/editor.js index 69329dabb..5f8767cec 100644 --- a/static/panes/editor.js +++ b/static/panes/editor.js @@ -698,7 +698,7 @@ Editor.prototype.onSelectLine = function (id, lineNum) { } }; -Editor.prototype.onEditorLinkLine = function (editorId, lineNum, reveal) { +Editor.prototype.onEditorLinkLine = function (editorId, lineNum, columnNum, reveal) { if (Number(editorId) === this.id) { if (reveal && lineNum) this.editor.revealLineInCenter(lineNum); this.decorations.linkedCode = lineNum === -1 || !lineNum ? [] : [{ @@ -710,6 +710,16 @@ Editor.prototype.onEditorLinkLine = function (editorId, lineNum, reveal) { } }]; + if (lineNum > 0 && columnNum !== -1) { + this.decorations.linkedCode.push({ + range: new monaco.Range(lineNum, columnNum, lineNum, columnNum + 1), + options: { + isWholeLine: false, + inlineClassName: 'linked-code-decoration-column' + } + }); + } + if (this.fadeTimeoutId !== -1) { clearTimeout(this.fadeTimeoutId); } diff --git a/static/panes/ir-view.js b/static/panes/ir-view.js index 859e04096..73c7eb27c 100644 --- a/static/panes/ir-view.js +++ b/static/panes/ir-view.js @@ -227,7 +227,7 @@ Ir.prototype.onMouseMove = function (e) { if (hoverCode) { // We check that we actually have something to show at this point! var sourceLine = hoverCode.source && !hoverCode.source.file ? hoverCode.source.line : -1; - this.eventHub.emit('editorLinkLine', this._editorid, sourceLine, false); + this.eventHub.emit('editorLinkLine', this._editorid, sourceLine, -1, false); this.eventHub.emit('panesLinkLine', this._compilerid, sourceLine, false, this.getPaneName()); } } diff --git a/static/panes/output.js b/static/panes/output.js index a0eaf71f9..039a614e6 100644 --- a/static/panes/output.js +++ b/static/panes/output.js @@ -121,7 +121,9 @@ Output.prototype.onCompileResult = function (id, compiler, result) { this.contentRoot.empty(); _.each((result.stdout || []).concat(result.stderr || []), function (obj) { - this.add(this.normalAnsiToHtml.toHtml(obj.text), obj.tag ? obj.tag.line : obj.line); + var lineNumber = obj.tag ? obj.tag.line : obj.line; + var columnNumber = obj.tag ? obj.tag.column : -1; + this.add(this.normalAnsiToHtml.toHtml(obj.text), lineNumber, columnNumber); }, this); this.add("Compiler returned: " + result.code); @@ -151,7 +153,7 @@ Output.prototype.programOutput = function (msg, color) { elem.css("color", color); }; -Output.prototype.add = function (msg, lineNum) { +Output.prototype.add = function (msg, lineNum, column) { var elem = $('

').appendTo(this.contentRoot); if (lineNum) { elem.html( @@ -159,14 +161,14 @@ Output.prototype.add = function (msg, lineNum) { .prop('href', 'javascript:;') .html(msg) .click(_.bind(function (e) { - this.eventHub.emit('editorSetDecoration', this.editorId, lineNum, true); + this.eventHub.emit('editorLinkLine', this.editorId, lineNum, column, true); // do not bring user to the top of index.html // http://stackoverflow.com/questions/3252730 e.preventDefault(); return false; }, this)) .on('mouseover', _.bind(function () { - this.eventHub.emit('editorSetDecoration', this.editorId, lineNum, false); + this.eventHub.emit('editorLinkLine', this.editorId, lineNum, column, false); }, this)) ); } else { From 8c6f4da5b7f19a469d510ae195332fe19f5cc15a Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Sun, 7 Apr 2019 15:00:35 +0200 Subject: [PATCH 05/21] Add "Scroll to source" action to irview --- static/panes/compiler.js | 7 ++----- static/panes/ir-view.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/static/panes/compiler.js b/static/panes/compiler.js index cc06147a9..70ed9c23a 100644 --- a/static/panes/compiler.js +++ b/static/panes/compiler.js @@ -361,12 +361,9 @@ Compiler.prototype.initEditorActions = function () { run: _.bind(function (ed) { var desiredLine = ed.getPosition().lineNumber - 1; var source = this.assembly[desiredLine].source; - if (source.file === null) { + if (source !== null && source.file === null) { // a null file means it was the user's source - this.eventHub.emit('editorSetDecoration', this.sourceEditorId, source.line, true); - } else { - // TODO: some indication this asm statement came from elsewhere - this.eventHub.emit('editorSetDecoration', this.sourceEditorId, -1, false); + this.eventHub.emit('editorLinkLine', this.sourceEditorId, source.line, -1, true); } }, this) }); diff --git a/static/panes/ir-view.js b/static/panes/ir-view.js index 73c7eb27c..6daaaa287 100644 --- a/static/panes/ir-view.js +++ b/static/panes/ir-view.js @@ -69,6 +69,7 @@ function Ir(hub, container, state) { this.initButtons(state); this.initCallbacks(); + this.initEditorActions(); if (state && state.irOutput) { this.showIrResults(state.irOutput); @@ -82,6 +83,25 @@ function Ir(hub, container, state) { }); } +Ir.prototype.initEditorActions = function () { + this.irEditor.addAction({ + id: 'viewsource', + label: 'Scroll to source', + keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.F10], + keybindingContext: null, + contextMenuGroupId: 'navigation', + contextMenuOrder: 1.5, + run: _.bind(function (ed) { + var desiredLine = ed.getPosition().lineNumber - 1; + var source = this.irCode[desiredLine].source; + if (source !== null && source.file === null) { + // a null file means it was the user's source + this.eventHub.emit('editorLinkLine', this._editorid, source.line, -1, true); + } + }, this) + }); +}; + Ir.prototype.initButtons = function (state) { this.fontScale = new FontScale(this.domRoot, state, this.irEditor); From 98a51793f4802d3376a4945a95e2723b2ce7dc21 Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Sun, 7 Apr 2019 15:41:28 +0200 Subject: [PATCH 06/21] Fix color blending issue --- static/colour.js | 2 +- static/colours.css | 82 ++++++++++++++++++++++----------------------- static/explorer.css | 1 - 3 files changed, 42 insertions(+), 43 deletions(-) diff --git a/static/colour.js b/static/colour.js index bed22cb16..d71cf6bb8 100644 --- a/static/colour.js +++ b/static/colour.js @@ -45,7 +45,7 @@ function applyColours(editor, colours, schemeName, prevDecorations) { range: new monaco.Range(line, 1, line, 1), options: { isWholeLine: true, - className: scheme.name + "-" + (ordinal % scheme.count) + className: "line-linkage " + scheme.name + "-" + (ordinal % scheme.count) } }; }); diff --git a/static/colours.css b/static/colours.css index 9c616a5de..e505914e9 100644 --- a/static/colours.css +++ b/static/colours.css @@ -3,169 +3,169 @@ */ /* rainbow is 12 Set3 */ .rainbow-0 { - background: rgba(141, 211, 199, 0.35) !important; + background: rgba(141, 211, 199, 0.35); } .rainbow-1 { - background: rgba(255, 255, 179, 0.35) !important; + background: rgba(255, 255, 179, 0.35); } .rainbow-2 { - background: rgba(190, 186, 218, 0.35) !important; + background: rgba(190, 186, 218, 0.35); } .rainbow-3 { - background: rgba(251, 128, 114, 0.35) !important; + background: rgba(251, 128, 114, 0.35); } .rainbow-4 { - background: rgba(128, 177, 211, 0.35) !important; + background: rgba(128, 177, 211, 0.35); } .rainbow-5 { - background: rgba(253, 180, 98, 0.35) !important; + background: rgba(253, 180, 98, 0.35); } .rainbow-6 { - background: rgba(179, 222, 105, 0.35) !important; + background: rgba(179, 222, 105, 0.35); } .rainbow-7 { - background: rgba(252, 205, 229, 0.35) !important; + background: rgba(252, 205, 229, 0.35); } .rainbow-8 { - background: rgba(217, 217, 217, 0.35) !important; + background: rgba(217, 217, 217, 0.35); } .rainbow-9 { - background: rgba(188, 128, 189, 0.35) !important; + background: rgba(188, 128, 189, 0.35); } .rainbow-10 { - background: rgba(204, 234, 197, 0.35) !important; + background: rgba(204, 234, 197, 0.35); } .rainbow-11 { - background: rgba(255, 237, 111, 0.35) !important; + background: rgba(255, 237, 111, 0.35); } /* rainbow2 is 12 Paired */ .rainbow2-0 { - background: rgba(166, 206, 227, 0.35) !important; + background: rgba(166, 206, 227, 0.35); } .rainbow2-1 { - background: rgba(31, 120, 180, 0.35) !important; + background: rgba(31, 120, 180, 0.35); } .rainbow2-2 { - background: rgba(178, 223, 138, 0.35) !important; + background: rgba(178, 223, 138, 0.35); } .rainbow2-3 { - background: rgba(51, 160, 44, 0.35) !important; + background: rgba(51, 160, 44, 0.35); } .rainbow2-4 { - background: rgba(251, 154, 153, 0.35) !important; + background: rgba(251, 154, 153, 0.35); } .rainbow2-5 { - background: rgba(227, 26, 28, 0.35) !important; + background: rgba(227, 26, 28, 0.35); } .rainbow2-6 { - background: rgba(253, 191, 111, 0.35) !important; + background: rgba(253, 191, 111, 0.35); } .rainbow2-7 { - background: rgba(255, 127, 0, 0.35) !important; + background: rgba(255, 127, 0, 0.35); } .rainbow2-8 { - background: rgba(202, 178, 214, 0.35) !important; + background: rgba(202, 178, 214, 0.35); } .rainbow2-9 { - background: rgba(106, 61, 154, 0.35) !important; + background: rgba(106, 61, 154, 0.35); } .rainbow2-10 { - background: rgba(255, 255, 153, 0.35) !important; + background: rgba(255, 255, 153, 0.35); } .rainbow2-11 { - background: rgba(177, 89, 40, 0.35) !important; + background: rgba(177, 89, 40, 0.35); } /* earth is 'BrBG' */ .earth-0 { - background: rgba(140, 81, 10, 0.35) !important; + background: rgba(140, 81, 10, 0.35); } .earth-1 { - background: rgba(191, 129, 45, 0.35) !important; + background: rgba(191, 129, 45, 0.35); } .earth-2 { - background: rgba(223, 194, 125, 0.35) !important; + background: rgba(223, 194, 125, 0.35); } .earth-3 { - background: rgba(246, 232, 195, 0.35) !important; + background: rgba(246, 232, 195, 0.35); } .earth-4 { - background: rgba(245, 245, 245, 0.35) !important; + background: rgba(245, 245, 245, 0.35); } .earth-5 { - background: rgba(199, 234, 229, 0.35) !important; + background: rgba(199, 234, 229, 0.35); } .earth-6 { - background: rgba(128, 205, 193, 0.35) !important; + background: rgba(128, 205, 193, 0.35); } .earth-7 { - background: rgba(53, 151, 143, 0.35) !important; + background: rgba(53, 151, 143, 0.35); } .earth-8 { - background: rgba(1, 102, 94, 0.35) !important; + background: rgba(1, 102, 94, 0.35); } /* Greens and blues is Paired */ .green-blue-0 { - background: rgba(166, 206, 227, 0.35) !important; + background: rgba(166, 206, 227, 0.35); } .green-blue-1 { - background: rgba(31, 120, 180, 0.35) !important; + background: rgba(31, 120, 180, 0.35); } .green-blue-2 { - background: rgba(178, 223, 138, 0.35) !important; + background: rgba(178, 223, 138, 0.35); } .green-blue-3 { - background: rgba(51, 160, 44, 0.35) !important; + background: rgba(51, 160, 44, 0.35); } /* Gray shades */ .gray-shade-0 { - background: rgba(190, 190, 190, 0.35) !important; + background: rgba(190, 190, 190, 0.35); } .gray-shade-1 { - background: rgba(150, 150, 150, 0.35) !important; + background: rgba(150, 150, 150, 0.35); } .gray-shade-2 { - background: rgba(110, 110, 110, 0.35) !important; + background: rgba(110, 110, 110, 0.35); } .gray-shade-3 { - background: rgba(70, 70, 70, 0.35) !important; + background: rgba(70, 70, 70, 0.35); } diff --git a/static/explorer.css b/static/explorer.css index 3aaa7b012..b787fd35d 100644 --- a/static/explorer.css +++ b/static/explorer.css @@ -241,7 +241,6 @@ pre.content.wrap { .linked-code-decoration-column { font-weight: 600; - color: pink; } .modal-content .well { From dbea59a34e947341249f6cb9f7c6451f584587f1 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 17 May 2019 11:55:06 -0700 Subject: [PATCH 07/21] Add WebAssembly clang target --- CONTRIBUTORS.md | 1 + etc/config/c++.amazon.properties | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 49137afca..467b5cdb8 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -71,3 +71,4 @@ From oldest to newest contributor, we would like to thank: - [Gennadiy Civil](https://github.com/gennadiycivil) - [Paul Scharnofske](https://github.com/asynts) - [Sebastian Staffa](https://github.com/Staff-d) +- [Sam Clegg](https://github.com/sbc100) diff --git a/etc/config/c++.amazon.properties b/etc/config/c++.amazon.properties index b35deaf7d..cda641763 100644 --- a/etc/config/c++.amazon.properties +++ b/etc/config/c++.amazon.properties @@ -1,4 +1,4 @@ -compilers=&gcc86:&icc:&clang:&rvclang:&cl:&cross:&ellcc:&zapcc:www.godbolt.ms@443:&djggp +compilers=&gcc86:&icc:&clang:&rvclang:&wasmclang:&cl:&cross:&ellcc:&zapcc:www.godbolt.ms@443:&djggp defaultCompiler=g91 demangler=/opt/compiler-explorer/gcc-8.2.0/bin/c++filt objdumper=/opt/compiler-explorer/gcc-8.2.0/bin/objdump @@ -210,6 +210,14 @@ compiler.rv64clang.exe=/opt/compiler-explorer/clang-trunk/bin/clang++ compiler.rv64clang.name=RISC-V rv64gc clang (trunk) compiler.rv64clang.options=-target riscv64 -march=rv64gc -mabi=lp64 +# Clang for WebAssembly +group.wasmclang.compilers=wasm32clang +group.wasmclang.groupName=Clang WebAssembly +group.wasmclang.supportsBinary=false +compiler.wasm32clang.exe=/opt/compiler-explorer/clang-trunk/bin/clang++ +compiler.wasm32clang.name=WebAssembly clang (trunk) +compiler.wasm32clang.options=-target wasm32 + # icc for x86 group.icc.compilers=icc1301:icc16:icc17:icc18:icc19:icc191 group.icc.intelAsm=-masm=intel From d631e2981a9e3bb7fac41a0ecc606d87377ec411 Mon Sep 17 00:00:00 2001 From: Partouf Date: Sat, 18 May 2019 16:51:01 +0200 Subject: [PATCH 08/21] improved responsiveness of mouseover highlighting --- static/panes/compiler.js | 2 +- static/panes/editor.js | 2 +- static/panes/ir-view.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/static/panes/compiler.js b/static/panes/compiler.js index 70ed9c23a..35e1f2f8f 100644 --- a/static/panes/compiler.js +++ b/static/panes/compiler.js @@ -1163,7 +1163,7 @@ Compiler.prototype.initCallbacks = function () { .on('change', optionsChange) .on('keyup', optionsChange); - this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 250); + this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 50); this.outputEditor.onMouseMove(_.bind(function (e) { this.mouseMoveThrottledFunction(e); }, this)); diff --git a/static/panes/editor.js b/static/panes/editor.js index 5f8767cec..0a8f57cef 100644 --- a/static/panes/editor.js +++ b/static/panes/editor.js @@ -252,7 +252,7 @@ Editor.prototype.initCallbacks = function () { this.updateState(); }, this)); - this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 250); + this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 50); this.editor.onMouseMove(_.bind(function (e) { this.mouseMoveThrottledFunction(e); diff --git a/static/panes/ir-view.js b/static/panes/ir-view.js index 6daaaa287..766084e50 100644 --- a/static/panes/ir-view.js +++ b/static/panes/ir-view.js @@ -110,7 +110,7 @@ Ir.prototype.initButtons = function (state) { Ir.prototype.initCallbacks = function () { this.linkedFadeTimeoutId = -1; - this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 250); + this.mouseMoveThrottledFunction = _.throttle(_.bind(this.onMouseMove, this), 50); this.irEditor.onMouseMove(_.bind(function (e) { this.mouseMoveThrottledFunction(e); }, this)); From 1114f6e428ecc6a7f21249c62cd9455060857972 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Sun, 19 May 2019 15:13:12 -0500 Subject: [PATCH 09/21] Fix up handling of error indicators. Fixes #1384 --- .idea/runConfigurations/All_Mocha_Tests.xml | 2 +- lib/base-compiler.js | 5 +-- lib/exec.js | 19 ++++++---- package-lock.json | 39 +++++++-------------- package.json | 2 +- test/exec-tests.js | 39 +++++++++++++++------ 6 files changed, 60 insertions(+), 46 deletions(-) diff --git a/.idea/runConfigurations/All_Mocha_Tests.xml b/.idea/runConfigurations/All_Mocha_Tests.xml index d88b64134..1106dab01 100644 --- a/.idea/runConfigurations/All_Mocha_Tests.xml +++ b/.idea/runConfigurations/All_Mocha_Tests.xml @@ -1,6 +1,6 @@ - project + /opt/compiler-explorer/node/bin/node $PROJECT_DIR$/node_modules/mocha $PROJECT_DIR$ diff --git a/lib/base-compiler.js b/lib/base-compiler.js index a831a785f..61d185eba 100644 --- a/lib/base-compiler.js +++ b/lib/base-compiler.js @@ -123,8 +123,9 @@ class BaseCompiler { return this.exec(compiler, options, execOptions).then(result => { result.inputFilename = inputFilename; - result.stdout = utils.parseOutput(result.stdout, inputFilename); - result.stderr = utils.parseOutput(result.stderr, inputFilename); + const transformedInput = result.filenameTransform(inputFilename); + result.stdout = utils.parseOutput(result.stdout, transformedInput); + result.stderr = utils.parseOutput(result.stderr, transformedInput); return result; }); } diff --git a/lib/exec.js b/lib/exec.js index 3471a31a1..c9642fb43 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -37,7 +37,10 @@ function setupOnError(stream, name) { }); } -function executeDirect(command, args, options) { +function executeDirect(command, args, options, filenameTransform) { + // filename transform is expected to have been pre-applied by the caller. + // it is passed through here only so clients can see it in the result. + filenameTransform = filenameTransform || (x => x); options = options || {}; const maxOutput = options.maxOutput || 1024 * 1024; const timeoutMs = options.timeoutMs || 0; @@ -117,10 +120,11 @@ function executeDirect(command, args, options) { if (code === null) code = -1; if (timeout !== undefined) clearTimeout(timeout); const result = { - code: code, + code, + okToCache, + filenameTransform, stdout: streams.stdout, - stderr: streams.stderr, - okToCache: okToCache + stderr: streams.stderr }; logger.debug("Execution", {type: "executed", command: command, args: args, result: result}); resolve(result); @@ -317,15 +321,18 @@ function executeFirejail(command, args, options) { logger.debug("Regular execution via firejail", {command, args}); baseOptions.push('--profile=etc/firejail/execute.profile'); + let filenameTransform; if (options.customCwd) { baseOptions.push(`--private=${options.customCwd}`); - args = args.map(opt => opt.replace(options.customCwd, ".")); + const replacement = options.customCwd; + filenameTransform = opt => opt.replace(replacement, "."); + args = args.map(filenameTransform); delete options.customCwd; } else { baseOptions.push('--private'); } baseOptions.push(command); - return executeDirect(firejail, baseOptions.concat(args), options); + return executeDirect(firejail, baseOptions.concat(args), options, filenameTransform); } function executeNone(command, args, options) { diff --git a/package-lock.json b/package-lock.json index ab1d9b6d7..f2803e695 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1095,22 +1095,17 @@ } }, "chai": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", - "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", "dev": true, "requires": { - "assertion-error": "^1.0.1", - "deep-eql": "^0.1.3", - "type-detect": "^1.0.0" - }, - "dependencies": { - "type-detect": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", - "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", - "dev": true - } + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" } }, "chai-as-promised": { @@ -1748,20 +1743,12 @@ "dev": true }, "deep-eql": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", - "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true, "requires": { - "type-detect": "0.1.1" - }, - "dependencies": { - "type-detect": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", - "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", - "dev": true - } + "type-detect": "^4.0.0" } }, "deep-equal": { diff --git a/package.json b/package.json index d18814311..0f9d62661 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ }, "devDependencies": { "aws-sdk-mock": "^1.7.0", - "chai": "3.5.x", + "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "chai-http": "^4.2.1", "codecov": "^3.0.0", diff --git a/test/exec-tests.js b/test/exec-tests.js index 0133382c3..3dfb3417f 100644 --- a/test/exec-tests.js +++ b/test/exec-tests.js @@ -22,26 +22,36 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -var chai = require('chai'), +const chai = require('chai'), chaiAsPromised = require("chai-as-promised"), exec = require('../lib/exec'); chai.use(chaiAsPromised); chai.should(); +function testExecOutput(x) { + // Work around chai not being able to deepEquals with a function + x.filenameTransform.should.be.a('function'); + delete x.filenameTransform; + return x; +} + if (process.platform !== 'win32') { // POSIX describe('Executes external commands', () => { it('supports output', () => { - return exec.execute('echo', ['hello', 'world'], {}).should.eventually.deep.equals( - { - code: 0, - okToCache: true, - stderr: "", - stdout: "hello world\n" - }); + return exec.execute('echo', ['hello', 'world'], {}) + .then(testExecOutput) + .should.eventually.deep.equals( + { + code: 0, + okToCache: true, + stderr: "", + stdout: "hello world\n" + }); }); it('limits output', () => { return exec.execute('echo', ['A very very very very very long string'], {maxOutput: 10}) + .then(testExecOutput) .should.eventually.deep.equals( { code: 0, @@ -52,6 +62,7 @@ if (process.platform !== 'win32') { // POSIX }); it('handles failing commands', () => { return exec.execute('false', [], {}) + .then(testExecOutput) .should.eventually.deep.equals( { code: 1, @@ -62,6 +73,7 @@ if (process.platform !== 'win32') { // POSIX }); it('handles timouts', () => { return exec.execute('sleep', ['5'], {timeoutMs: 10}) + .then(testExecOutput) .should.eventually.deep.equals( { code: -1, @@ -75,7 +87,9 @@ if (process.platform !== 'win32') { // POSIX .should.be.rejectedWith("ENOENT"); }); it('handles input', () => { - return exec.execute('cat', [], {input: "this is stdin"}).should.eventually.deep.equals( + return exec.execute('cat', [], {input: "this is stdin"}) + .then(testExecOutput) + .should.eventually.deep.equals( { code: 0, okToCache: true, @@ -88,7 +102,9 @@ if (process.platform !== 'win32') { // POSIX describe('Executes external commands', () => { // note: we use powershell, since echo is a builtin, and false doesn't exist it('supports output', () => { - return exec.execute('powershell', ['-Command', 'echo "hello world"'], {}).should.eventually.deep.equals( + return exec.execute('powershell', ['-Command', 'echo "hello world"'], {}) + .then(testExecOutput) + .should.eventually.deep.equals( { code: 0, okToCache: true, @@ -98,6 +114,7 @@ if (process.platform !== 'win32') { // POSIX }); it('limits output', () => { return exec.execute('powershell', ['-Command', 'echo "A very very very very very long string"'], {maxOutput: 10}) + .then(testExecOutput) .should.eventually.deep.equals( { code: 0, @@ -108,6 +125,7 @@ if (process.platform !== 'win32') { // POSIX }); it('handles failing commands', () => { return exec.execute('powershell', ['-Command', 'function Fail { exit 1 }; Fail'], {}) + .then(testExecOutput) .should.eventually.deep.equals( { code: 1, @@ -118,6 +136,7 @@ if (process.platform !== 'win32') { // POSIX }); it('handles timouts', () => { return exec.execute('powershell', ['-Command', '"sleep 5"'], {timeoutMs: 10}) + .then(testExecOutput) .should.eventually.deep.equals( { code: 1, From 99b5884cff94868be02db081cce8d4c29120c647 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 14:06:22 -0500 Subject: [PATCH 10/21] Minor logging tweaks --- lib/base-compiler.js | 2 +- lib/handlers/compile.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/base-compiler.js b/lib/base-compiler.js index 61d185eba..542ed4b4a 100644 --- a/lib/base-compiler.js +++ b/lib/base-compiler.js @@ -828,7 +828,7 @@ Please select another pass or change filters.`; result.asm = postResult.stdout; if (postResult.code !== 0) { result.asm = ``; - logger.error("Error during post-processing", result); + logger.error("Error during post-processing: ", result); } return result; } diff --git a/lib/handlers/compile.js b/lib/handlers/compile.js index a96688a6e..7ef33108f 100644 --- a/lib/handlers/compile.js +++ b/lib/handlers/compile.js @@ -299,7 +299,7 @@ class CompileHandler { } }, error => { - logger.error("Error during compilation", error); + logger.error("Error during compilation: ", error); if (typeof (error) !== "string") { if (error.code) { if (typeof (error.stderr) === "string") { From 4b0f8e612e758c360693546e5e6530d4f06a089c Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 14:06:55 -0500 Subject: [PATCH 11/21] Fix for post processing in DMD under firejail. Closes #1386 --- lib/compilers/dmd.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/compilers/dmd.js b/lib/compilers/dmd.js index 8ee342277..b4d96198b 100644 --- a/lib/compilers/dmd.js +++ b/lib/compilers/dmd.js @@ -37,7 +37,9 @@ class DMDCompiler extends BaseCompiler { } execPostProcess(result, postProcesses, outputFilename, maxSize) { - return this.exec(postProcesses[0], ["-l", path.relative(process.cwd(), outputFilename)], {maxOutput: maxSize}) + const dirPath = path.dirname(outputFilename); + const lPath = path.basename(outputFilename); + return this.exec(postProcesses[0], ["-l", lPath], {customCwd: dirPath, maxOutput: maxSize}) .then(postResult => this.handlePostProcessResult(result, postResult)); } From 491adcd0f4c57e3a1150bf68e7c64b7772dc65c3 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 14:08:30 -0500 Subject: [PATCH 12/21] Use demanglers stored on /opt/compiler-explorer instead of local ones, to work around firejail issues on Amazon --- etc/config/d.amazon.properties | 2 +- etc/config/haskell.amazon.properties | 1 + etc/config/rust.amazon.properties | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/config/d.amazon.properties b/etc/config/d.amazon.properties index c3a6d27ad..273a0eec7 100644 --- a/etc/config/d.amazon.properties +++ b/etc/config/d.amazon.properties @@ -63,7 +63,7 @@ group.dmd.compilerType=dmd group.dmd.groupName=DMD2 group.dmd.binaryHideFuncRe=^(_.*|\.text.*|(de)?register_tm_clones|frame_dummy|.*@plt)$ group.dmd.optionsBlacklistRe=^((@|-conf|-debuglib|-defaultlib|-D|-H|-I|-J|-o|-run|-X).*)$ -group.dmd.demangler=d/demangle +group.dmd.demangler=/opt/compiler-explorer/demanglers/d/demangle group.dmd.postProcess=/opt/compiler-explorer/dmd-2.078.3/dmd2/linux/bin64/obj2asm group.dmd.isSemVer=true group.dmd.baseName=dmd diff --git a/etc/config/haskell.amazon.properties b/etc/config/haskell.amazon.properties index 3176dd93f..692db79c2 100644 --- a/etc/config/haskell.amazon.properties +++ b/etc/config/haskell.amazon.properties @@ -1,5 +1,6 @@ compilers=&ghc defaultCompiler=ghc862 +demangler=/opt/compiler-explorer/demanglers/haskell/demangle group.ghc.compilers=ghc802:ghc841:ghc842:ghc843:ghc844:ghc861:ghc862 group.ghc.isSemVer=true diff --git a/etc/config/rust.amazon.properties b/etc/config/rust.amazon.properties index 6b6f514c1..5d0552ab7 100644 --- a/etc/config/rust.amazon.properties +++ b/etc/config/rust.amazon.properties @@ -1,6 +1,7 @@ compilers=&rust objdumper=/opt/compiler-explorer/gcc-8.1.0/bin/objdump defaultCompiler=r1340 +demangler=/opt/compiler-explorer/demanglers/rust/bin/rustfilt group.rust.compilers=r1340:r1330:r1320:r1310:r1300:r1290:r1280:r1271:r1270:r1260:r1250:r1240:r1230:r1220:r1210:r1200:r1190:r1180:r1170:r1160:r1151:r1140:r1130:r1120:r1110:r1100:r190:r180:r170:r160:r150:r140:r130:r120:r110:r100:nightly:beta group.rust.compilerType=rust group.rust.isSemVer=true From d516ef42cdf5124f6d6c1d146cb869cafe84e1f2 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 15:22:32 -0500 Subject: [PATCH 13/21] Assume a patched CE-specific version of firejail to get a private cwd, and ensure proper cleanup and exit code --- etc/firejail/standard.inc | 5 ----- lib/exec.js | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/etc/firejail/standard.inc b/etc/firejail/standard.inc index a1e9e83e2..27d136190 100644 --- a/etc/firejail/standard.inc +++ b/etc/firejail/standard.inc @@ -20,11 +20,6 @@ x11 none shell none disable-mnt -# blacklisting this directory to ensure the "cwd" of the process is not valid when executed. -# this forces firejail to chdir("~") before running, which we rely on. Also good hygiene in -# general, even though the image is pretty much open source. -blacklist /compiler-explorer-image - blacklist /sbin blacklist /usr/local/sbin blacklist /initrd* diff --git a/lib/exec.js b/lib/exec.js index c9642fb43..e1f8cc9de 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -306,7 +306,7 @@ function executeWineDirect(command, args, options) { function executeFirejail(command, args, options) { options = options || {}; const firejail = execProps("firejail"); - const baseOptions = ['--quiet']; + const baseOptions = ['--quiet', '--deterministic-exit-code', '--terminate-orphans']; if (needsWine(command)) { logger.debug("WINE execution via firejail", {command, args}); options.env = applyWineEnv(options.env); @@ -331,6 +331,7 @@ function executeFirejail(command, args, options) { } else { baseOptions.push('--private'); } + baseOptions.push('--private-cwd'); baseOptions.push(command); return executeDirect(firejail, baseOptions.concat(args), options, filenameTransform); } From 12bd66d50c4c9c44672e318cdd1de3aacf2824ad Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 20:26:52 -0500 Subject: [PATCH 14/21] Workaround for now until we have another firejail patch --- lib/exec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/exec.js b/lib/exec.js index e1f8cc9de..77d8d8368 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -328,10 +328,12 @@ function executeFirejail(command, args, options) { filenameTransform = opt => opt.replace(replacement, "."); args = args.map(filenameTransform); delete options.customCwd; + // TODO: once it's supported properly in our patched firejail, make this option common to both customCwd and + // non-customCwd code paths. + baseOptions.push('--private-cwd'); } else { baseOptions.push('--private'); } - baseOptions.push('--private-cwd'); baseOptions.push(command); return executeDirect(firejail, baseOptions.concat(args), options, filenameTransform); } From 2dc15a9093d0f4077c975b9d215394db7636897e Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 21:51:12 -0500 Subject: [PATCH 15/21] Minor logging fixes; use new command line flags for sandbox --- lib/base-compiler.js | 2 +- lib/exec.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/base-compiler.js b/lib/base-compiler.js index 542ed4b4a..03ecf8704 100644 --- a/lib/base-compiler.js +++ b/lib/base-compiler.js @@ -348,7 +348,7 @@ class BaseCompiler { }; }); }).catch((err) => { - logger.debug("Tried to get executable from cache, but got an error: ", err); + logger.debug("Tried to get executable from cache, but got an error: ", {err}); return this.buildExecutableInFolder(key, dirPath).then(result => { if (result.code !== 0) { diff --git a/lib/exec.js b/lib/exec.js index 77d8d8368..2cbb66223 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -136,16 +136,16 @@ function executeDirect(command, args, options, filenameTransform) { function sandboxFirejail(command, args, options) { - logger.info("Sandbox execution via firejail", command, args); + logger.info("Sandbox execution via firejail", {command, args}); const execPath = path.dirname(command); const execName = path.basename(command); const jailingOptions = [ '--quiet', + '--deterministic-exit-code', + '--terminate-orphans', '--profile=etc/firejail/sandbox.profile', - // '--debug', - // TODO: If no cwd, just `--private` '--private=/tmp/private-home', else infer... - // hack for now: which relies on knowing the execPath will be in the private temp directory. `--private=${execPath}`, + '--private-cwd', `./${execName}` ].concat(args); command = 'firejail'; From 5b4338a32e1e5e10f3ee559a9cd3e931caa668cb Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 21:51:28 -0500 Subject: [PATCH 16/21] Enable execution in beta environment! --- etc/config/compiler-explorer.beta.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/config/compiler-explorer.beta.properties b/etc/config/compiler-explorer.beta.properties index 0efc0cdaa..1ba5dd60c 100644 --- a/etc/config/compiler-explorer.beta.properties +++ b/etc/config/compiler-explorer.beta.properties @@ -3,3 +3,4 @@ httpRoot=/beta urlShortenService=none storageSolution=s3 motdUrl=https://s3.dualstack.us-east-1.amazonaws.com/compiler-explorer/motd/motd-beta.json +supportsExecute=true From b08b1bb1b40a4910c7196012d96d8f20c22687d2 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 22:16:53 -0500 Subject: [PATCH 17/21] First wave of environment variable removals --- etc/firejail/sandbox.profile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/firejail/sandbox.profile b/etc/firejail/sandbox.profile index 13927f2d0..f7b3cbdb8 100644 --- a/etc/firejail/sandbox.profile +++ b/etc/firejail/sandbox.profile @@ -10,7 +10,12 @@ memory-deny-write-execute # Using seccomp.keep seems to turn things into a whitelist #seccomp.keep ptrace -# TODO need to launder the environment more before executing +# Remove some env vars, mostly to stop people emailing me about them +rmenv SUDO_COMMAND # this is one with actual somewhat sensitive info) +rmenv SUDO_USER +rmenv SUDO_UID +rmenv SUDO_GID +rmenv DBUS_SESSION_BUS_ADDRESS # TODO are these appropriate values? # rlimit-nproc seems not to be as useful as we want; it _seems_ to count *all* processes From cea11b0d9a7e4a82b087f24c0e09406fdd274056 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Mon, 20 May 2019 22:31:28 -0500 Subject: [PATCH 18/21] Arg terrible config files --- etc/firejail/sandbox.profile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/firejail/sandbox.profile b/etc/firejail/sandbox.profile index f7b3cbdb8..a724ce4e5 100644 --- a/etc/firejail/sandbox.profile +++ b/etc/firejail/sandbox.profile @@ -11,7 +11,8 @@ memory-deny-write-execute #seccomp.keep ptrace # Remove some env vars, mostly to stop people emailing me about them -rmenv SUDO_COMMAND # this is one with actual somewhat sensitive info) +# SUDO_COMMAND is one with actual somewhat sensitive info +rmenv SUDO_COMMAND rmenv SUDO_USER rmenv SUDO_UID rmenv SUDO_GID From 0d4f6d61dddacbb8fdc755b4bccb95575be2367e Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Wed, 22 May 2019 17:07:17 +0200 Subject: [PATCH 19/21] Set dark theme as default if the user ask for it The feature does not have great browser support yet, (Firefox just got it) but it's better than nothing Plans for automatically asking the user if they want to switch when they change the default values --- static/settings.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/settings.js b/static/settings.js index 3c964267d..485997d4b 100644 --- a/static/settings.js +++ b/static/settings.js @@ -143,7 +143,13 @@ function setupSettings(root, settings, onChange, langId) { add(root.find('.hoverShowSource'), 'hoverShowSource', true, Checkbox); add(root.find('.hoverShowAsmDoc'), 'hoverShowAsmDoc', true, Checkbox); var themeSelect = root.find('.theme'); - add(themeSelect, 'theme', themes.default.id, Select, + + var defaultThemeId = themes.default.id; + if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { + defaultThemeId = themes.dark.id; + } + + add(themeSelect, 'theme', defaultThemeId, Select, _.map(themes, function (theme) { return {label: theme.id, desc: theme.name}; }) From 9fdde1d9244e03e5b341d85e0e71862af49f6262 Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Thu, 23 May 2019 15:13:28 +0200 Subject: [PATCH 20/21] Use default Monaco color for dark text highlights Source linking is next in line to get changed --- static/themes/dark-theme.css | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/static/themes/dark-theme.css b/static/themes/dark-theme.css index b5e9ee012..a843b6a4f 100644 --- a/static/themes/dark-theme.css +++ b/static/themes/dark-theme.css @@ -79,6 +79,10 @@ a.navbar-brand img.logo.normal { background-color: #333 !important; } +.linked-code-decoration-line { + background: rgb(40, 80, 116) !important; +} + .linked-code-decoration-inline { background: #121212 !important; } @@ -102,6 +106,7 @@ a.navbar-brand img.logo.normal { .selectize-control.single .selectize-input { color: #f2f2f2 !important; background: #666 linear-gradient(to bottom, #555, #222) !important; + text-shadow: none !important; } .selectize-dropdown { @@ -305,8 +310,9 @@ input { } .community-advert { - background: #a1a1a1 !important; - border-color: #006400 + color: white; + background: #474747 !important; + border-color: #006400; } .community-advert button { From dfd2681dd391c34df29201b902032abc891ba47e Mon Sep 17 00:00:00 2001 From: RabsRincon Date: Thu, 23 May 2019 15:19:50 +0200 Subject: [PATCH 21/21] Make linked text more readable in dark mode But now it's less obvious which lines belong where --- static/colours.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/colours.css b/static/colours.css index e505914e9..0b77a201c 100644 --- a/static/colours.css +++ b/static/colours.css @@ -155,17 +155,17 @@ /* Gray shades */ .gray-shade-0 { - background: rgba(190, 190, 190, 0.35); + background: rgba(190, 190, 190, 0.15); } .gray-shade-1 { - background: rgba(150, 150, 150, 0.35); + background: rgba(150, 150, 150, 0.15); } .gray-shade-2 { - background: rgba(110, 110, 110, 0.35); + background: rgba(110, 110, 110, 0.15); } .gray-shade-3 { - background: rgba(70, 70, 70, 0.35); + background: rgba(70, 70, 70, 0.15); }