From 6aaeadfee858b9dacfe391610b99c1c152853383 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 15 Feb 2021 13:21:28 -0800 Subject: 7752 --- baremetal/shell/line.mu | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'baremetal/shell') diff --git a/baremetal/shell/line.mu b/baremetal/shell/line.mu index b86974cc..aadba891 100644 --- a/baremetal/shell/line.mu +++ b/baremetal/shell/line.mu @@ -155,7 +155,6 @@ fn render-word-with-stack-and-cursor screen: (addr screen), line: (addr line), c } fn test-render-line-with-stack-singleton { - # line = [1] var line-storage: line var line/esi: (addr line) <- address line-storage parse-line "1", line @@ -175,7 +174,6 @@ fn test-render-line-with-stack-singleton { } fn test-render-line-with-stack { - # line = [1 2] var line-storage: line var line/esi: (addr line) <- address line-storage parse-line "1 2", line @@ -195,6 +193,26 @@ fn test-render-line-with-stack { # not bothering to test hash colors for numbers } +# { } groups have no effect on the stack by default. +fn test-render-line-with-stack-groups { + var line-storage: line + var line/esi: (addr line) <- address line-storage + parse-line "{ 1 2 }", line + # setup: screen + var screen-on-stack: screen + var screen/edi: (addr screen) <- address screen-on-stack + initialize-screen screen, 0x20, 4 + # + var new-x/eax: int <- copy 0 + var new-y/ecx: int <- copy 0 + new-x, new-y <- render-line-with-stack screen, line, 0/x, 0/y, 0/no-cursor + check-screen-row screen, 0/y, "{ 1 2 } ", "F - test-render-line-with-stack-groups/0" + check-screen-row screen, 1/y, " ", "F - test-render-line-with-stack-groups/1" + # ___ ___ + check-screen-row screen, 2/y, " 1 2 ", "F - test-render-line-with-stack-groups/2" + check-screen-row screen, 3/y, " 1 ", "F - test-render-line-with-stack-groups/3" +} + fn edit-line _self: (addr line), key: byte { var self/esi: (addr line) <- copy _self var cursor-word-ah/edx: (addr handle word) <- get self, cursor -- cgit 1.4.1-2-gfad0