From bdaf97c8cae49399e9676015054ee02bb7796e02 Mon Sep 17 00:00:00 2001 From: Mingfei Date: Fri, 5 Jul 2019 15:45:16 -0400 Subject: [PATCH 1/3] Fix code line numbers on general assembler being clipped off --- static/js/render.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/render.js b/static/js/render.js index d60d7d5c..48df4da3 100644 --- a/static/js/render.js +++ b/static/js/render.js @@ -225,7 +225,7 @@ export class GeneralAssemblerRenderer extends Renderer { const line = $(`
-
+

${this.num_lines + 1}.

From f6d5a8cf3344b19cc5a56a03c22626aceab43a9f Mon Sep 17 00:00:00 2001 From: Mingfei Date: Fri, 5 Jul 2019 16:09:15 -0400 Subject: [PATCH 2/3] Align line numbers in general memory --- static/css/simulations.css | 10 ++++++++++ static/js/render.js | 21 ++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/static/css/simulations.css b/static/css/simulations.css index 18ab7616..18ae560d 100644 --- a/static/css/simulations.css +++ b/static/css/simulations.css @@ -1,3 +1,12 @@ +button { + font-family: Acre-Regular; +} + +.general_memory { + float: left; + text-align: left; +} + .tooltip-inner { white-space: pre-wrap; } @@ -51,6 +60,7 @@ body { .line_no_text { vertical-align: center; + font-family: Courier, monospace; } #code { diff --git a/static/js/render.js b/static/js/render.js index 48df4da3..65d4f687 100644 --- a/static/js/render.js +++ b/static/js/render.js @@ -14,15 +14,18 @@ export class Renderer { create_memory_display() { const general_memory_display = document.getElementById("general_memory_div"); for (let i = 0; i < this.computer.size; i++) { - const para = document.createElement("p"); - const register = document.createTextNode(i.toString()+": "); - para.appendChild(register); - const span = document.createElement("span"); - span.setAttribute("class", "general_memory number"); - span.setAttribute("id", "general_memory" + i.toString()); - span.setAttribute("data-toggle", "tooltip"); - para.appendChild(span); - general_memory_display.appendChild(para); + let element = $(` +
+
+

${i.toString()}:

+
+
+ +
+
+ `)[0]; + general_memory_display.appendChild(element); } } From e621db18f772a84fc4da6aa8b439fa92758dfa8d Mon Sep 17 00:00:00 2001 From: Mingfei Date: Fri, 5 Jul 2019 16:14:32 -0400 Subject: [PATCH 3/3] Mess with alignment of line numbers in code --- static/css/simulations.css | 2 ++ static/js/render.js | 2 +- templates/simulations/base.jinja2 | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/static/css/simulations.css b/static/css/simulations.css index 18ae560d..3754e599 100644 --- a/static/css/simulations.css +++ b/static/css/simulations.css @@ -61,6 +61,8 @@ body { .line_no_text { vertical-align: center; font-family: Courier, monospace; + float: right; + text-align: right; } #code { diff --git a/static/js/render.js b/static/js/render.js index 65d4f687..75ea9055 100644 --- a/static/js/render.js +++ b/static/js/render.js @@ -17,7 +17,7 @@ export class Renderer { let element = $(`
-

${i.toString()}:

+

${i.toString()}:

Code
{# TODO: make sure this doesn't obscure the line numbers #}
-
#
+
#
Lbl
Op
ATD