diff options
-rw-r--r-- | shell/gap-buffer.mu | 28 | ||||
-rw-r--r-- | shell/global.mu | 18 | ||||
-rw-r--r-- | shell/grapheme-stack.mu | 30 | ||||
-rw-r--r-- | shell/main.mu | 5 | ||||
-rw-r--r-- | shell/sandbox.mu | 106 |
5 files changed, 102 insertions, 85 deletions
diff --git a/shell/gap-buffer.mu b/shell/gap-buffer.mu index 7abe57c1..911fb16f 100644 --- a/shell/gap-buffer.mu +++ b/shell/gap-buffer.mu @@ -120,7 +120,7 @@ fn emit-stack-from-top _self: (addr grapheme-stack), out: (addr stream byte) { # We implicitly render everything editable in a single color, and assume the # cursor is a single other color. -fn render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr gap-buffer), xmin: int, ymin: int, xmax: int, ymax: int, render-cursor?: boolean -> _/eax: int, _/ecx: int { +fn render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr gap-buffer), xmin: int, ymin: int, xmax: int, ymax: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int { var gap/esi: (addr gap-buffer) <- copy _gap var left/edx: (addr grapheme-stack) <- get gap, left var highlight-matching-open-paren?/ebx: boolean <- copy 0/false @@ -128,11 +128,11 @@ fn render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr highlight-matching-open-paren?, matching-open-paren-depth <- highlight-matching-open-paren? gap, render-cursor? var x2/eax: int <- copy 0 var y2/ecx: int <- copy 0 - x2, y2 <- render-stack-from-bottom-wrapping-right-then-down screen, left, xmin, ymin, xmax, ymax, xmin, ymin, highlight-matching-open-paren?, matching-open-paren-depth + x2, y2 <- render-stack-from-bottom-wrapping-right-then-down screen, left, xmin, ymin, xmax, ymax, xmin, ymin, highlight-matching-open-paren?, matching-open-paren-depth, color, background-color var right/edx: (addr grapheme-stack) <- get gap, right - x2, y2 <- render-stack-from-top-wrapping-right-then-down screen, right, xmin, ymin, xmax, ymax, x2, y2, render-cursor? + x2, y2 <- render-stack-from-top-wrapping-right-then-down screen, right, xmin, ymin, xmax, ymax, x2, y2, render-cursor?, color, background-color # decide whether we still need to print a cursor - var bg/ebx: int <- copy 0 + var bg/ebx: int <- copy background-color compare render-cursor?, 0/false { break-if-= @@ -144,11 +144,11 @@ fn render-gap-buffer-wrapping-right-then-down screen: (addr screen), _gap: (addr } # print a grapheme either way so that cursor position doesn't affect printed width var space/edx: grapheme <- copy 0x20 - x2, y2 <- render-grapheme screen, space, xmin, ymin, xmax, ymax, x2, y2, 3/fg=cyan, bg + x2, y2 <- render-grapheme screen, space, xmin, ymin, xmax, ymax, x2, y2, color, bg return x2, y2 } -fn render-gap-buffer screen: (addr screen), gap: (addr gap-buffer), x: int, y: int, render-cursor?: boolean -> _/eax: int { +fn render-gap-buffer screen: (addr screen), gap: (addr gap-buffer), x: int, y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int { var _width/eax: int <- copy 0 var _height/ecx: int <- copy 0 _width, _height <- screen-size screen @@ -156,7 +156,7 @@ fn render-gap-buffer screen: (addr screen), gap: (addr gap-buffer), x: int, y: i var height/ebx: int <- copy _height var x2/eax: int <- copy 0 var y2/ecx: int <- copy 0 - x2, y2 <- render-gap-buffer-wrapping-right-then-down screen, gap, x, y, width, height, render-cursor? + x2, y2 <- render-gap-buffer-wrapping-right-then-down screen, gap, x, y, width, height, render-cursor?, color, background-color return x2 # y2? yolo } @@ -556,7 +556,7 @@ fn test-render-gap-buffer-without-cursor { var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 5, 4, 0/no-pixel-graphics # - var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 0/no-cursor + var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 0/no-cursor, 3/fg, 0/bg check-screen-row screen, 0/y, "abc ", "F - test-render-gap-buffer-without-cursor" check-ints-equal x, 4, "F - test-render-gap-buffer-without-cursor: result" # abc @@ -574,7 +574,7 @@ fn test-render-gap-buffer-with-cursor-at-end { var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 5, 4, 0/no-pixel-graphics # - var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor + var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor, 3/fg, 0/bg check-screen-row screen, 0/y, "abc ", "F - test-render-gap-buffer-with-cursor-at-end" # we've drawn one extra grapheme for the cursor check-ints-equal x, 4, "F - test-render-gap-buffer-with-cursor-at-end: result" @@ -594,7 +594,7 @@ fn test-render-gap-buffer-with-cursor-in-middle { var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 5, 4, 0/no-pixel-graphics # - var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor + var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor, 3/fg, 0/bg check-screen-row screen, 0/y, "abc ", "F - test-render-gap-buffer-with-cursor-in-middle" check-ints-equal x, 4, "F - test-render-gap-buffer-with-cursor-in-middle: result" # abc @@ -611,7 +611,7 @@ fn test-render-gap-buffer-with-cursor-at-start { var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 5, 4, 0/no-pixel-graphics # - var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor + var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor, 3/fg, 0/bg check-screen-row screen, 0/y, "abc ", "F - test-render-gap-buffer-with-cursor-at-start" check-ints-equal x, 4, "F - test-render-gap-buffer-with-cursor-at-start: result" # abc @@ -628,7 +628,7 @@ fn test-render-gap-buffer-highlight-matching-close-paren { var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 5, 4, 0/no-pixel-graphics # - var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor + var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor, 3/fg, 0/bg check-screen-row screen, 0/y, "(a) ", "F - test-render-gap-buffer-highlight-matching-close-paren" check-ints-equal x, 4, "F - test-render-gap-buffer-highlight-matching-close-paren: result" check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, "| ", "F - test-render-gap-buffer-highlight-matching-close-paren: cursor" @@ -646,7 +646,7 @@ fn test-render-gap-buffer-highlight-matching-open-paren { var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 5, 4, 0/no-pixel-graphics # - var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor + var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor, 3/fg, 0/bg check-screen-row screen, 0/y, "(a) ", "F - test-render-gap-buffer-highlight-matching-open-paren" check-ints-equal x, 4, "F - test-render-gap-buffer-highlight-matching-open-paren: result" check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, " | ", "F - test-render-gap-buffer-highlight-matching-open-paren: cursor" @@ -663,7 +663,7 @@ fn test-render-gap-buffer-highlight-matching-open-paren-of-end { var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 5, 4, 0/no-pixel-graphics # - var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor + var x/eax: int <- render-gap-buffer screen, gap, 0/x, 0/y, 1/show-cursor, 3/fg, 0/bg check-screen-row screen, 0/y, "(a) ", "F - test-render-gap-buffer-highlight-matching-open-paren-of-end" check-ints-equal x, 4, "F - test-render-gap-buffer-highlight-matching-open-paren-of-end: result" check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, " |", "F - test-render-gap-buffer-highlight-matching-open-paren-of-end: cursor" diff --git a/shell/global.mu b/shell/global.mu index c5b11471..e5b2071d 100644 --- a/shell/global.mu +++ b/shell/global.mu @@ -123,11 +123,12 @@ fn write-globals out: (addr stream byte), _self: (addr global-table) { write out, " ))\n" } -fn render-globals screen: (addr screen), _self: (addr global-table), xmin: int, ymin: int, xmax: int, ymax: int { - clear-rect screen, xmin, ymin, xmax, ymax, 0x12/bg=almost-black +# globals layout: 1 char padding, 41 code, 1 padding, 41 code, 1 padding = 85 chars +fn render-globals screen: (addr screen), _self: (addr global-table) { + clear-rect screen, 0/xmin, 0/ymin, 0x56/xmax, 0x2f/ymax=screen-height-without-menu, 0x12/bg=almost-black var self/esi: (addr global-table) <- copy _self # render primitives - render-primitives screen, xmin, ymin, xmax, ymax + render-primitives screen, 1/xmin=padding-left, 0x55/xmax, 0x2f/ymax var data-ah/eax: (addr handle array global) <- get self, data var data/eax: (addr array global) <- lookup *data-ah var curr-index/edx: int <- copy 1 @@ -141,13 +142,13 @@ fn render-globals screen: (addr screen), _self: (addr global-table), xmin: int, loop } var lowest-index/edi: int <- copy curr-index - var y/ecx: int <- copy ymin + var y/ecx: int <- copy 1/padding-top var final-index/edx: (addr int) <- get self, final-index var curr-index/edx: int <- copy *final-index { compare curr-index, lowest-index break-if-< - compare y, ymax + compare y, 0x2f/ymax break-if->= { var curr-offset/edx: (offset global) <- compute-offset data, curr-index @@ -157,8 +158,9 @@ fn render-globals screen: (addr screen), _self: (addr global-table), xmin: int, var curr-input/ebx: (addr gap-buffer) <- copy _curr-input compare curr-input, 0 break-if-= - var x/eax: int <- copy xmin - x, y <- render-gap-buffer-wrapping-right-then-down screen, curr-input, xmin, y, xmax, ymax, 0/no-cursor + var x/eax: int <- copy 1/padding-left + x, y <- render-gap-buffer-wrapping-right-then-down screen, curr-input, x, y, 0x56/xmax, 0x2f/ymax, 0/no-cursor, 3/fg=cyan, 0x14/bg=definition + y <- increment } curr-index <- decrement y <- increment @@ -166,7 +168,7 @@ fn render-globals screen: (addr screen), _self: (addr global-table), xmin: int, } } -fn render-primitives screen: (addr screen), xmin: int, ymin: int, xmax: int, ymax: int { +fn render-primitives screen: (addr screen), xmin: int, xmax: int, ymax: int { var y/ecx: int <- copy ymax y <- subtract 0xf var tmpx/eax: int <- copy xmin diff --git a/shell/grapheme-stack.mu b/shell/grapheme-stack.mu index ab8ac09c..dda4623d 100644 --- a/shell/grapheme-stack.mu +++ b/shell/grapheme-stack.mu @@ -82,8 +82,9 @@ fn copy-grapheme-stack _src: (addr grapheme-stack), dest: (addr grapheme-stack) } # dump stack to screen from bottom to top -# colors hardcoded -fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int -> _/eax: int, _/ecx: int { +# hardcoded colors: +# matching paren +fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, highlight-matching-open-paren?: boolean, open-paren-depth: int, color: int, background-color: int -> _/eax: int, _/ecx: int { var self/esi: (addr grapheme-stack) <- copy _self var matching-open-paren-index/edx: int <- get-matching-open-paren-index self, highlight-matching-open-paren?, open-paren-depth var data-ah/edi: (addr handle array grapheme) <- get self, data @@ -99,13 +100,16 @@ fn render-stack-from-bottom-wrapping-right-then-down screen: (addr screen), _sel { var g/esi: (addr grapheme) <- index data, i var fg: int - copy-to fg, 3/cyan + { + var tmp/eax: int <- copy color + copy-to fg, tmp + } { compare i, matching-open-paren-index break-if-!= copy-to fg, 0xf/highlight } - x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, fg, 0/bg + x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, fg, background-color } i <- increment loop @@ -122,13 +126,16 @@ fn render-stack-from-bottom screen: (addr screen), self: (addr grapheme-stack), var height/ebx: int <- copy _height var x2/eax: int <- copy 0 var y2/ecx: int <- copy 0 - x2, y2 <- render-stack-from-bottom-wrapping-right-then-down screen, self, x, y, width, height, x, y, highlight-matching-open-paren?, open-paren-depth + x2, y2 <- render-stack-from-bottom-wrapping-right-then-down screen, self, x, y, width, height, x, y, highlight-matching-open-paren?, open-paren-depth, 3/fg=cyan, 0/bg return x2 # y2? yolo } # dump stack to screen from top to bottom # optionally render a 'cursor' with the top grapheme -fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean -> _/eax: int, _/ecx: int { +# hard-coded colors: +# matching paren +# cursor +fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: (addr grapheme-stack), xmin: int, ymin: int, xmax: int, ymax: int, _x: int, _y: int, render-cursor?: boolean, color: int, background-color: int -> _/eax: int, _/ecx: int { var self/esi: (addr grapheme-stack) <- copy _self var matching-close-paren-index/edx: int <- get-matching-close-paren-index self, render-cursor? var data-ah/eax: (addr handle array grapheme) <- get self, data @@ -146,7 +153,7 @@ fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: compare i, 0 break-if-< var g/esi: (addr grapheme) <- index data, i - x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, 3/fg=cyan, 7/bg=cursor + x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, color, 7/bg=cursor i <- decrement } # remaining iterations @@ -155,7 +162,10 @@ fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: break-if-< # highlight matching paren if needed var fg: int - copy-to fg, 3/cyan + { + var tmp/eax: int <- copy color + copy-to fg, tmp + } compare i, matching-close-paren-index { break-if-!= @@ -163,7 +173,7 @@ fn render-stack-from-top-wrapping-right-then-down screen: (addr screen), _self: } # var g/esi: (addr grapheme) <- index data, i - x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, fg, 0/bg=cursor + x, y <- render-grapheme screen, *g, xmin, ymin, xmax, ymax, x, y, fg, background-color i <- decrement loop } @@ -179,7 +189,7 @@ fn render-stack-from-top screen: (addr screen), self: (addr grapheme-stack), x: var height/ebx: int <- copy _height var x2/eax: int <- copy 0 var y2/ecx: int <- copy 0 - x2, y2 <- render-stack-from-top-wrapping-right-then-down screen, self, x, y, width, height, x, y, render-cursor? + x2, y2 <- render-stack-from-top-wrapping-right-then-down screen, self, x, y, width, height, x, y, render-cursor?, 3/fg=cyan, 0/bg return x2 # y2? yolo } diff --git a/shell/main.mu b/shell/main.mu index e89a0906..cb3c75b9 100644 --- a/shell/main.mu +++ b/shell/main.mu @@ -10,7 +10,10 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) initialize-sandbox sandbox, 1/with-screen load-state data-disk, sandbox, globals $main:loop: { - render-globals screen, globals, 0/x, 0/y, 0x55/xmax, 0x2f/screen-height-without-menu + # globals layout: 1 char padding, 41 code, 1 padding, 41 code, 1 padding = 85 + # sandbox layout: 1 padding, 41 code, 1 padding = 43 + # total = 128 chars + render-globals screen, globals render-sandbox screen, sandbox, 0x56/sandbox-left-margin, 1/y, 0x80/screen-width, 0x2f/screen-height-without-menu { var key/eax: byte <- read-key keyboard diff --git a/shell/sandbox.mu b/shell/sandbox.mu index 0bc856bf..9af1637f 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -80,6 +80,8 @@ fn write-sandbox out: (addr stream byte), _self: (addr sandbox) { fn render-sandbox screen: (addr screen), _self: (addr sandbox), xmin: int, ymin: int, xmax: int, ymax: int { clear-rect screen, xmin, ymin, xmax, ymax, 0/bg=black + add-to xmin, 1/padding-left + subtract-from xmax, 1/padding-right var self/esi: (addr sandbox) <- copy _self # data var data-ah/eax: (addr handle gap-buffer) <- get self, data @@ -90,7 +92,7 @@ fn render-sandbox screen: (addr screen), _self: (addr sandbox), xmin: int, ymin: y <- maybe-render-empty-screen screen, self, xmin, y y <- maybe-render-keyboard screen, self, xmin, y var cursor-in-sandbox?/ebx: (addr boolean) <- get self, cursor-in-data? - x, y <- render-gap-buffer-wrapping-right-then-down screen, data, x, y, xmax, ymax, *cursor-in-sandbox? + x, y <- render-gap-buffer-wrapping-right-then-down screen, data, x, y, xmax, ymax, *cursor-in-sandbox?, 3/fg, 0/bg y <- increment # trace var trace-ah/eax: (addr handle trace) <- get self, trace @@ -149,7 +151,7 @@ fn clear-sandbox-output screen: (addr screen), _self: (addr sandbox), xmin: int, y <- maybe-render-empty-screen screen, self, xmin, y y <- maybe-render-keyboard screen, self, xmin, y var cursor-in-sandbox?/ebx: (addr boolean) <- get self, cursor-in-data? - x, y <- render-gap-buffer-wrapping-right-then-down screen, data, x, y, xmax, ymax, *cursor-in-sandbox? + x, y <- render-gap-buffer-wrapping-right-then-down screen, data, x, y, xmax, ymax, *cursor-in-sandbox?, 3/fg, 0/bg y <- increment clear-rect screen, xmin, y, xmax, ymax, 0/bg=black } @@ -462,7 +464,7 @@ fn render-keyboard screen: (addr screen), _keyboard: (addr gap-buffer), xmin: in var x/eax: int <- copy xmin draw-code-point screen, 0x7c/vertical-bar, x, y, 0x18/fg, 0/bg x <- increment - x <- render-gap-buffer screen, keyboard, x, y, render-cursor? + x <- render-gap-buffer screen, keyboard, x, y, render-cursor?, 3/fg, 0/bg x <- copy xmin x <- add 1 # for left bar x <- add 0x10/keyboard-capacity @@ -759,9 +761,9 @@ fn test-run-integer { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "1 ", "F - test-run-integer/0" - check-screen-row screen, 1/y, "... ", "F - test-run-integer/1" - check-screen-row screen, 2/y, "=> 1 ", "F - test-run-integer/2" + check-screen-row screen, 0/y, " 1 ", "F - test-run-integer/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-integer/1" + check-screen-row screen, 2/y, " => 1 ", "F - test-run-integer/2" } fn test-run-error-invalid-integer { @@ -776,9 +778,9 @@ fn test-run-error-invalid-integer { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "1a ", "F - test-run-error-invalid-integer/0" - check-screen-row screen, 1/y, "... ", "F - test-run-error-invalid-integer/0" - check-screen-row screen, 2/y, "invalid number ", "F - test-run-error-invalid-integer/2" + check-screen-row screen, 0/y, " 1a ", "F - test-run-error-invalid-integer/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-error-invalid-integer/0" + check-screen-row screen, 2/y, " invalid number ", "F - test-run-error-invalid-integer/2" } fn test-run-with-spaces { @@ -793,10 +795,10 @@ fn test-run-with-spaces { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, " 1 ", "F - test-run-with-spaces/0" - check-screen-row screen, 1/y, " ", "F - test-run-with-spaces/1" - check-screen-row screen, 2/y, "... ", "F - test-run-with-spaces/2" - check-screen-row screen, 3/y, "=> 1 ", "F - test-run-with-spaces/3" + check-screen-row screen, 0/y, " 1 ", "F - test-run-with-spaces/0" + check-screen-row screen, 1/y, " ", "F - test-run-with-spaces/1" + check-screen-row screen, 2/y, " ... ", "F - test-run-with-spaces/2" + check-screen-row screen, 3/y, " => 1 ", "F - test-run-with-spaces/3" } fn test-run-quote { @@ -811,9 +813,9 @@ fn test-run-quote { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "'a ", "F - test-run-quote/0" - check-screen-row screen, 1/y, "... ", "F - test-run-quote/1" - check-screen-row screen, 2/y, "=> a ", "F - test-run-quote/2" + check-screen-row screen, 0/y, " 'a ", "F - test-run-quote/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-quote/1" + check-screen-row screen, 2/y, " => a ", "F - test-run-quote/2" } fn test-run-dotted-list { @@ -828,9 +830,9 @@ fn test-run-dotted-list { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "'(a . b) ", "F - test-run-dotted-list/0" - check-screen-row screen, 1/y, "... ", "F - test-run-dotted-list/1" - check-screen-row screen, 2/y, "=> (a . b) ", "F - test-run-dotted-list/2" + check-screen-row screen, 0/y, " '(a . b) ", "F - test-run-dotted-list/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-dotted-list/1" + check-screen-row screen, 2/y, " => (a . b) ", "F - test-run-dotted-list/2" } fn test-run-dot-and-list { @@ -845,9 +847,9 @@ fn test-run-dot-and-list { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "'(a . (b)) ", "F - test-run-dot-and-list/0" - check-screen-row screen, 1/y, "... ", "F - test-run-dot-and-list/1" - check-screen-row screen, 2/y, "=> (a b) ", "F - test-run-dot-and-list/2" + check-screen-row screen, 0/y, " '(a . (b)) ", "F - test-run-dot-and-list/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-dot-and-list/1" + check-screen-row screen, 2/y, " => (a b) ", "F - test-run-dot-and-list/2" } fn test-run-final-dot { @@ -862,9 +864,9 @@ fn test-run-final-dot { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "'(a .) ", "F - test-run-final-dot/0" - check-screen-row screen, 1/y, "... ", "F - test-run-final-dot/1" - check-screen-row screen, 2/y, "'. )' makes no sense ", "F - test-run-final-dot/2" + check-screen-row screen, 0/y, " '(a .) ", "F - test-run-final-dot/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-final-dot/1" + check-screen-row screen, 2/y, " '. )' makes no sense ", "F - test-run-final-dot/2" # further errors may occur } @@ -880,9 +882,9 @@ fn test-run-double-dot { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "'(a . .) ", "F - test-run-double-dot/0" - check-screen-row screen, 1/y, "... ", "F - test-run-double-dot/1" - check-screen-row screen, 2/y, "'. .' makes no sense ", "F - test-run-double-dot/2" + check-screen-row screen, 0/y, " '(a . .) ", "F - test-run-double-dot/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-double-dot/1" + check-screen-row screen, 2/y, " '. .' makes no sense ", "F - test-run-double-dot/2" # further errors may occur } @@ -898,9 +900,9 @@ fn test-run-multiple-expressions-after-dot { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "'(a . b c) ", "F - test-run-multiple-expressions-after-dot/0" - check-screen-row screen, 1/y, "... ", "F - test-run-multiple-expressions-after-dot/1" - check-screen-row screen, 2/y, "cannot have multiple expressions between '.' and ')' ", "F - test-run-multiple-expressions-after-dot/2" + check-screen-row screen, 0/y, " '(a . b c) ", "F - test-run-multiple-expressions-after-dot/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-multiple-expressions-after-dot/1" + check-screen-row screen, 2/y, " cannot have multiple expressions between '.' and ')' ", "F - test-run-multiple-expressions-after-dot/2" # further errors may occur } @@ -916,9 +918,9 @@ fn test-run-stream { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "[a b] ", "F - test-run-stream/0" - check-screen-row screen, 1/y, "... ", "F - test-run-stream/1" - check-screen-row screen, 2/y, "=> [a b] ", "F - test-run-stream/2" + check-screen-row screen, 0/y, " [a b] ", "F - test-run-stream/0" + check-screen-row screen, 1/y, " ... ", "F - test-run-stream/1" + check-screen-row screen, 2/y, " => [a b] ", "F - test-run-stream/2" } fn test-run-move-cursor-into-trace { @@ -933,32 +935,32 @@ fn test-run-move-cursor-into-trace { initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "12 ", "F - test-run-move-cursor-into-trace/pre-0" - check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, " | ", "F - test-run-move-cursor-into-trace/pre-0/cursor" - check-screen-row screen, 1/y, "... ", "F - test-run-move-cursor-into-trace/pre-1" - check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-move-cursor-into-trace/pre-1/cursor" - check-screen-row screen, 2/y, "=> 12 ", "F - test-run-move-cursor-into-trace/pre-2" - check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-move-cursor-into-trace/pre-2/cursor" + check-screen-row screen, 0/y, " 12 ", "F - test-run-move-cursor-into-trace/pre-0" + check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, " | ", "F - test-run-move-cursor-into-trace/pre-0/cursor" + check-screen-row screen, 1/y, " ... ", "F - test-run-move-cursor-into-trace/pre-1" + check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-move-cursor-into-trace/pre-1/cursor" + check-screen-row screen, 2/y, " => 12 ", "F - test-run-move-cursor-into-trace/pre-2" + check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-move-cursor-into-trace/pre-2/cursor" # move cursor into trace edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk, 0/no-screen, 0/no-tweak-screen # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "12 ", "F - test-run-move-cursor-into-trace/trace-0" - check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, " ", "F - test-run-move-cursor-into-trace/trace-0/cursor" - check-screen-row screen, 1/y, "... ", "F - test-run-move-cursor-into-trace/trace-1" - check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, "||| ", "F - test-run-move-cursor-into-trace/trace-1/cursor" - check-screen-row screen, 2/y, "=> 12 ", "F - test-run-move-cursor-into-trace/trace-2" - check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-move-cursor-into-trace/trace-2/cursor" + check-screen-row screen, 0/y, " 12 ", "F - test-run-move-cursor-into-trace/trace-0" + check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, " ", "F - test-run-move-cursor-into-trace/trace-0/cursor" + check-screen-row screen, 1/y, " ... ", "F - test-run-move-cursor-into-trace/trace-1" + check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ||| ", "F - test-run-move-cursor-into-trace/trace-1/cursor" + check-screen-row screen, 2/y, " => 12 ", "F - test-run-move-cursor-into-trace/trace-2" + check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-move-cursor-into-trace/trace-2/cursor" # move cursor into input edit-sandbox sandbox, 0xd/ctrl-m, 0/no-globals, 0/no-disk, 0/no-screen, 0/no-tweak-screen # render-sandbox screen, sandbox, 0/x, 0/y, 0x80/width, 0x10/height - check-screen-row screen, 0/y, "12 ", "F - test-run-move-cursor-into-trace/input-0" - check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, " | ", "F - test-run-move-cursor-into-trace/input-0/cursor" - check-screen-row screen, 1/y, "... ", "F - test-run-move-cursor-into-trace/input-1" - check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-move-cursor-into-trace/input-1/cursor" - check-screen-row screen, 2/y, "=> 12 ", "F - test-run-move-cursor-into-trace/input-2" - check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-move-cursor-into-trace/input-2/cursor" + check-screen-row screen, 0/y, " 12 ", "F - test-run-move-cursor-into-trace/input-0" + check-background-color-in-screen-row screen, 7/bg=cursor, 0/y, " | ", "F - test-run-move-cursor-into-trace/input-0/cursor" + check-screen-row screen, 1/y, " ... ", "F - test-run-move-cursor-into-trace/input-1" + check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " ", "F - test-run-move-cursor-into-trace/input-1/cursor" + check-screen-row screen, 2/y, " => 12 ", "F - test-run-move-cursor-into-trace/input-2" + check-background-color-in-screen-row screen, 7/bg=cursor, 2/y, " ", "F - test-run-move-cursor-into-trace/input-2/cursor" } fn has-trace? _self: (addr sandbox) -> _/eax: boolean { |