2468 - overload print-character as just 'print'

This commit is contained in:
Kartik K. Agaram 2015-11-21 10:19:34 -08:00
parent 3f7eed6c60
commit 136412d263
19 changed files with 103 additions and 103 deletions

View File

@ -94,7 +94,7 @@ recipe fake-screen-is-empty? screen:address:screen -> result:boolean [
reply 1/true
]
recipe print-character screen:address:screen, c:character -> screen:address:screen [
recipe print screen:address:screen, c:character -> screen:address:screen [
local-scope
load-ingredients
color:number, color-found?:boolean <- next-ingredient
@ -187,7 +187,7 @@ recipe print-character screen:address:screen, c:character -> screen:address:scre
scenario print-character-at-top-left [
run [
1:address:screen <- new-fake-screen 3/width, 2/height
1:address:screen <- print-character 1:address:screen, 97 # 'a'
1:address:screen <- print 1:address:screen, 97 # 'a'
2:address:array:screen-cell <- get *1:address:screen, data:offset
3:array:screen-cell <- copy *2:address:array:screen-cell
]
@ -199,10 +199,10 @@ scenario print-character-at-top-left [
]
]
scenario print-character-color [
scenario print-character-in-color [
run [
1:address:screen <- new-fake-screen 3/width, 2/height
1:address:screen <- print-character 1:address:screen, 97/a, 1/red
1:address:screen <- print 1:address:screen, 97/a, 1/red
2:address:array:screen-cell <- get *1:address:screen, data:offset
3:array:screen-cell <- copy *2:address:array:screen-cell
]
@ -217,8 +217,8 @@ scenario print-character-color [
scenario print-backspace-character [
run [
1:address:screen <- new-fake-screen 3/width, 2/height
1:address:screen <- print-character 1:address:screen, 97 # 'a'
1:address:screen <- print-character 1:address:screen, 8 # backspace
1:address:screen <- print 1:address:screen, 97 # 'a'
1:address:screen <- print 1:address:screen, 8 # backspace
2:number <- get *1:address:screen, cursor-column:offset
3:address:array:screen-cell <- get *1:address:screen, data:offset
4:array:screen-cell <- copy *3:address:array:screen-cell
@ -235,9 +235,9 @@ scenario print-backspace-character [
scenario print-extra-backspace-character [
run [
1:address:screen <- new-fake-screen 3/width, 2/height
1:address:screen <- print-character 1:address:screen, 97 # 'a'
1:address:screen <- print-character 1:address:screen, 8 # backspace
1:address:screen <- print-character 1:address:screen, 8 # backspace
1:address:screen <- print 1:address:screen, 97 # 'a'
1:address:screen <- print 1:address:screen, 8 # backspace
1:address:screen <- print 1:address:screen, 8 # backspace
2:number <- get *1:address:screen, cursor-column:offset
3:address:array:screen-cell <- get *1:address:screen, data:offset
4:array:screen-cell <- copy *3:address:array:screen-cell
@ -251,12 +251,12 @@ scenario print-extra-backspace-character [
]
]
scenario print-at-right-margin [
scenario print-character-at-right-margin [
run [
1:address:screen <- new-fake-screen 2/width, 2/height
1:address:screen <- print-character 1:address:screen, 97 # 'a'
1:address:screen <- print-character 1:address:screen, 98 # 'b'
1:address:screen <- print-character 1:address:screen, 99 # 'c'
1:address:screen <- print 1:address:screen, 97 # 'a'
1:address:screen <- print 1:address:screen, 98 # 'b'
1:address:screen <- print 1:address:screen, 99 # 'c'
2:number <- get *1:address:screen, cursor-column:offset
3:address:array:screen-cell <- get *1:address:screen, data:offset
4:array:screen-cell <- copy *3:address:array:screen-cell
@ -275,8 +275,8 @@ scenario print-at-right-margin [
scenario print-newline-character [
run [
1:address:screen <- new-fake-screen 3/width, 2/height
1:address:screen <- print-character 1:address:screen, 97 # 'a'
1:address:screen <- print-character 1:address:screen, 10/newline
1:address:screen <- print 1:address:screen, 97 # 'a'
1:address:screen <- print 1:address:screen, 10/newline
2:number <- get *1:address:screen, cursor-row:offset
3:number <- get *1:address:screen, cursor-column:offset
4:address:array:screen-cell <- get *1:address:screen, data:offset
@ -295,9 +295,9 @@ scenario print-newline-character [
scenario print-newline-at-bottom-line [
run [
1:address:screen <- new-fake-screen 3/width, 2/height
1:address:screen <- print-character 1:address:screen, 10/newline
1:address:screen <- print-character 1:address:screen, 10/newline
1:address:screen <- print-character 1:address:screen, 10/newline
1:address:screen <- print 1:address:screen, 10/newline
1:address:screen <- print 1:address:screen, 10/newline
1:address:screen <- print 1:address:screen, 10/newline
2:number <- get *1:address:screen, cursor-row:offset
3:number <- get *1:address:screen, cursor-column:offset
]
@ -307,15 +307,15 @@ scenario print-newline-at-bottom-line [
]
]
scenario print-at-bottom-right [
scenario print-character-at-bottom-right [
run [
1:address:screen <- new-fake-screen 2/width, 2/height
1:address:screen <- print-character 1:address:screen, 10/newline
1:address:screen <- print-character 1:address:screen, 97 # 'a'
1:address:screen <- print-character 1:address:screen, 98 # 'b'
1:address:screen <- print-character 1:address:screen, 99 # 'c'
1:address:screen <- print-character 1:address:screen, 10/newline
1:address:screen <- print-character 1:address:screen, 100 # 'd'
1:address:screen <- print 1:address:screen, 10/newline
1:address:screen <- print 1:address:screen, 97 # 'a'
1:address:screen <- print 1:address:screen, 98 # 'b'
1:address:screen <- print 1:address:screen, 99 # 'c'
1:address:screen <- print 1:address:screen, 10/newline
1:address:screen <- print 1:address:screen, 100 # 'd'
2:number <- get *1:address:screen, cursor-row:offset
3:number <- get *1:address:screen, cursor-column:offset
4:address:array:screen-cell <- get *1:address:screen, data:offset
@ -351,7 +351,7 @@ recipe clear-line screen:address:screen -> screen:address:screen [
right:number <- subtract width, 1
done?:boolean <- greater-or-equal *column, right
break-if done?
print-character screen, [ ] # implicitly updates 'column'
print screen, [ ] # implicitly updates 'column'
loop
}
# now back to where the cursor was
@ -395,7 +395,7 @@ scenario clear-line-erases-printed-characters [
run [
1:address:screen <- new-fake-screen 3/width, 2/height
# print a character
1:address:screen <- print-character 1:address:screen, 97 # 'a'
1:address:screen <- print 1:address:screen, 97 # 'a'
# move cursor to start of line
1:address:screen <- move-cursor 1:address:screen, 0/row, 0/column
# clear line
@ -613,7 +613,7 @@ recipe print screen:address:screen, s:address:array:character -> screen:address:
done?:boolean <- greater-or-equal i, len
break-if done?
c:character <- index *s, i
print-character screen, c, color, bg-color
print screen, c, color, bg-color
i <- add i, 1
loop
}

View File

@ -9,7 +9,7 @@
scenario screen-in-scenario [
assume-screen 5/width, 3/height
run [
screen:address:screen <- print-character screen:address:screen, 97 # 'a'
screen:address:screen <- print screen:address:screen, 97 # 'a'
]
screen-should-contain [
# 01234
@ -23,8 +23,8 @@ scenario screen-in-scenario [
scenario screen-in-scenario-unicode-color [
assume-screen 5/width, 3/height
run [
screen:address:screen <- print-character screen:address:screen, 955/greek-small-lambda, 1/red
screen:address:screen <- print-character screen:address:screen, 97/a
screen:address:screen <- print screen:address:screen, 955/greek-small-lambda, 1/red
screen:address:screen <- print screen:address:screen, 97/a
]
screen-should-contain [
# 01234
@ -39,8 +39,8 @@ scenario screen-in-scenario-unicode-color [
scenario screen-in-scenario-color [
assume-screen 5/width, 3/height
run [
screen:address:screen <- print-character screen:address:screen, 955/greek-small-lambda, 1/red
screen:address:screen <- print-character screen:address:screen, 97/a, 7/white
screen:address:screen <- print screen:address:screen, 955/greek-small-lambda, 1/red
screen:address:screen <- print screen:address:screen, 97/a, 7/white
]
# screen-should-contain shows everything
screen-should-contain [
@ -72,7 +72,7 @@ scenario screen-in-scenario-color [
scenario screen-in-scenario-error [
assume-screen 5/width, 3/height
run [
screen:address:screen <- print-character screen:address:screen, 97 # 'a'
screen:address:screen <- print screen:address:screen, 97 # 'a'
]
screen-should-contain [
# 01234
@ -90,7 +90,7 @@ scenario screen-in-scenario-error [
scenario screen-in-scenario-color [
assume-screen 5/width, 3/height
run [
screen:address:screen <- print-character screen:address:screen, 97/a, 1/red
screen:address:screen <- print screen:address:screen, 97/a, 1/red
]
screen-should-contain-in-color 2/green, [
# 01234

View File

@ -3,7 +3,7 @@
scenario print-character-at-top-left-2 [
assume-screen 3/width, 2/height
run [
screen:address:screen <- print-character screen:address:screen, 97/a
screen:address:screen <- print screen:address:screen, 97/a
]
screen-should-contain [
.a .
@ -15,7 +15,7 @@ scenario clear-line-erases-printed-characters-2 [
assume-screen 5/width, 3/height
run [
# print a character
screen:address:screen <- print-character screen:address:screen, 97/a
screen:address:screen <- print screen:address:screen, 97/a
# move cursor to start of line
screen:address:screen <- move-cursor screen:address:screen, 0/row, 0/column
# clear line

View File

@ -80,7 +80,7 @@ recipe send-keys-to-channel console:address:console, chan:address:channel, scree
loop-unless found?
break-if quit?
assert c, [invalid event, expected text]
screen <- print-character screen, c
screen <- print screen, c
chan <- write chan, c
loop
}

View File

@ -36,7 +36,7 @@ scenario print-board-and-read-move [
run [
screen:address:screen, console:address:console <- chessboard screen:address:screen, console:address:console
# icon for the cursor
screen <- print-character screen, 9251/␣
screen <- print screen, 9251/␣
]
screen-should-contain [
# 1 2 3 4 5 6 7 8 9 10 11
@ -165,8 +165,8 @@ recipe print-board screen:address:screen, board:address:array:address:array:char
break-if done?:boolean
f:address:array:character <- index *board, col
c:character <- index *f, row
print-character screen, c
print-character screen, 32/space
print screen, c
print screen, 32/space
col <- add col, 1
loop
}
@ -303,7 +303,7 @@ recipe read-file stdin:address:channel, screen:address:screen -> file:number, qu
break-if above-min
error-message:address:array:character <- new [file too low: ]
print screen, error-message
print-character screen, c
print screen, c
cursor-to-next-line screen
reply 0/dummy, 0/quit, 1/error
}
@ -312,7 +312,7 @@ recipe read-file stdin:address:channel, screen:address:screen -> file:number, qu
break-if below-max
error-message <- new [file too high: ]
print screen, error-message
print-character screen, c
print screen, c
reply 0/dummy, 0/quit, 1/error
}
reply file, 0/quit, 0/error
@ -347,7 +347,7 @@ recipe read-rank stdin:address:channel, screen:address:screen -> rank:number, qu
break-if above-min
error-message <- new [rank too low: ]
print screen, error-message
print-character screen, c
print screen, c
reply 0/dummy, 0/quit, 1/error
}
{
@ -355,7 +355,7 @@ recipe read-rank stdin:address:channel, screen:address:screen -> rank:number, qu
break-if below-max
error-message <- new [rank too high: ]
print screen, error-message
print-character screen, c
print screen, c
reply 0/dummy, 0/quit, 1/error
}
reply rank, 0/quit, 0/error

View File

@ -193,14 +193,14 @@ recipe render screen:address:screen, editor:address:editor-data -> last-row:numb
at-right?:boolean <- equal column, right
break-unless at-right?
# print wrap icon
print-character screen, 8617/loop-back-to-left, 245/grey
print screen, 8617/loop-back-to-left, 245/grey
column <- copy left
row <- add row, 1
screen <- move-cursor screen, row, column
# don't increment curr
loop +next-character:label
}
print-character screen, c, color
print screen, c, color
curr <- next curr
prev <- next prev
column <- add column, 1
@ -230,7 +230,7 @@ recipe clear-line-delimited screen:address:screen, column:number, right:number -
{
done?:boolean <- greater-than column, right
break-if done?
screen <- print-character screen, 32/space
screen <- print screen, 32/space
column <- add column, 1
loop
}

View File

@ -224,7 +224,7 @@ recipe insert-at-cursor editor:address:editor-data, c:character, screen:address:
overflow?:boolean <- and at-bottom?, at-right?
break-if overflow?
move-cursor screen, save-row, save-column
print-character screen, c
print screen, c
go-render? <- copy 0/false
reply
}
@ -246,7 +246,7 @@ recipe insert-at-cursor editor:address:editor-data, c:character, screen:address:
currc:character <- get *curr, value:offset
at-newline?:boolean <- equal currc, 10/newline
break-if at-newline?
print-character screen, currc
print screen, currc
curr-column <- add curr-column, 1
curr <- next curr
loop
@ -1035,7 +1035,7 @@ recipe draw-horizontal screen:address:screen, row:number, x:number, right:number
{
continue?:boolean <- lesser-or-equal x, right # right is inclusive, to match editor-data semantics
break-unless continue?
print-character screen, style, color, bg-color
print screen, style, color, bg-color
x <- add x, 1
loop
}

View File

@ -118,13 +118,13 @@ recipe delete-before-cursor editor:address:editor-data, screen:address:screen ->
currc:character <- get *curr, value:offset
at-newline?:boolean <- equal currc, 10/newline
break-if at-newline?
screen <- print-character screen, currc
screen <- print screen, currc
curr-column <- add curr-column, 1
curr <- next curr
loop
}
# we're guaranteed not to be at the right margin
screen <- print-character screen, 32/space
screen <- print screen, 32/space
go-render? <- copy 0/false
]
@ -358,13 +358,13 @@ recipe delete-at-cursor editor:address:editor-data, screen:address:screen -> edi
currc:character <- get *curr, value:offset
at-newline?:boolean <- equal currc, 10/newline
break-if at-newline?
screen <- print-character screen, currc
screen <- print screen, currc
curr-column <- add curr-column, 1
curr <- next curr
loop
}
# we're guaranteed not to be at the right margin
screen <- print-character screen, 32/space
screen <- print screen, 32/space
go-render? <- copy 0/false
]

View File

@ -267,7 +267,7 @@ scenario edit-multiple-editors [
]
# show the cursor at the right window
run [
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
screen-should-contain [
. run (F4) .
@ -307,7 +307,7 @@ scenario editor-in-focus-keeps-cursor [
assume-console []
run [
event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
# is cursor at the right place?
screen-should-contain [
@ -322,7 +322,7 @@ scenario editor-in-focus-keeps-cursor [
]
run [
event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
# cursor should still be right
screen-should-contain [
@ -356,7 +356,7 @@ def]
]
run [
event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
# cursor moves to end of old line
screen-should-contain [
@ -473,7 +473,7 @@ recipe render screen:address:screen, s:address:array:character, left:number, rig
at-right?:boolean <- equal column, right
break-unless at-right?
# print wrap icon
print-character screen, 8617/loop-back-to-left, 245/grey
print screen, 8617/loop-back-to-left, 245/grey
column <- copy left
row <- add row, 1
screen <- move-cursor screen, row, column
@ -488,7 +488,7 @@ recipe render screen:address:screen, s:address:array:character, left:number, rig
{
done?:boolean <- greater-than column, right
break-if done?
print-character screen, 32/space
print screen, 32/space
column <- add column, 1
loop
}
@ -497,7 +497,7 @@ recipe render screen:address:screen, s:address:array:character, left:number, rig
screen <- move-cursor screen, row, column
loop +next-character:label
}
print-character screen, c, color
print screen, c, color
column <- add column, 1
loop
}
@ -534,7 +534,7 @@ recipe render-code screen:address:screen, s:address:array:character, left:number
at-right?:boolean <- equal column, right
break-unless at-right?
# print wrap icon
print-character screen, 8617/loop-back-to-left, 245/grey
print screen, 8617/loop-back-to-left, 245/grey
column <- copy left
row <- add row, 1
screen <- move-cursor screen, row, column
@ -549,7 +549,7 @@ recipe render-code screen:address:screen, s:address:array:character, left:number
{
done?:boolean <- greater-than column, right
break-if done?
print-character screen, 32/space
print screen, 32/space
column <- add column, 1
loop
}
@ -558,7 +558,7 @@ recipe render-code screen:address:screen, s:address:array:character, left:number
screen <- move-cursor screen, row, column
loop +next-character:label
}
print-character screen, c, color
print screen, c, color
column <- add column, 1
loop
}
@ -616,7 +616,7 @@ recipe draw-vertical screen:address:screen, col:number, y:number, bottom:number
continue?:boolean <- lesser-than y, bottom
break-unless continue?
screen <- move-cursor screen, y, col
print-character screen, style, color
print screen, style, color
y <- add y, 1
loop
}

View File

@ -250,7 +250,7 @@ recipe render-sandboxes screen:address:screen, sandbox:address:sandbox-data, lef
row <- add row, 1
screen <- move-cursor screen, row, left
clear-line-delimited screen, left, right
print-character screen, 120/x, 245/grey
print screen, 120/x, 245/grey
# save menu row so we can detect clicks to it later
starting-row:address:number <- get-address *sandbox, starting-row-on-screen:offset
*starting-row <- copy row
@ -346,9 +346,9 @@ recipe render-screen screen:address:screen, sandbox-screen:address:screen, left:
column <- copy left
screen <- move-cursor screen, row, column
# initial leader for each row: two spaces and a '.'
print-character screen, 32/space, 245/grey
print-character screen, 32/space, 245/grey
print-character screen, 46/full-stop, 245/grey
print screen, 32/space, 245/grey
print screen, 32/space, 245/grey
print screen, 46/full-stop, 245/grey
column <- add left, 3
{
# print row
@ -363,19 +363,19 @@ recipe render-screen screen:address:screen, sandbox-screen:address:screen, left:
break-unless white?
color <- copy 245/grey
}
print-character screen, c, color
print screen, c, color
column <- add column, 1
i <- add i, 1
loop
}
# print final '.'
print-character screen, 46/full-stop, 245/grey
print screen, 46/full-stop, 245/grey
column <- add column, 1
{
# clear rest of current line
line-done?:boolean <- greater-than column, right
break-if line-done?
print-character screen, 32/space
print screen, 32/space
column <- add column, 1
loop
}

View File

@ -45,7 +45,7 @@ recipe foo [
]
# cursor should remain unmoved
run [
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
screen-should-contain [
. run (F4) .

View File

@ -30,7 +30,7 @@ recipe foo [
]
run [
event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
# trace now printed and cursor shouldn't have budged
screen-should-contain [
@ -59,7 +59,7 @@ recipe foo [
]
run [
event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
# trace hidden again
screen-should-contain [

View File

@ -193,14 +193,14 @@ recipe render screen:address:screen, editor:address:editor-data -> last-row:numb
at-right?:boolean <- equal column, right
break-unless at-right?
# print wrap icon
print-character screen, 8617/loop-back-to-left, 245/grey
print screen, 8617/loop-back-to-left, 245/grey
column <- copy left
row <- add row, 1
screen <- move-cursor screen, row, column
# don't increment curr
loop +next-character:label
}
print-character screen, c, color
print screen, c, color
curr <- next curr
prev <- next prev
column <- add column, 1
@ -230,7 +230,7 @@ recipe clear-line-delimited screen:address:screen, column:number, right:number -
{
done?:boolean <- greater-than column, right
break-if done?
screen <- print-character screen, 32/space
screen <- print screen, 32/space
column <- add column, 1
loop
}

View File

@ -224,7 +224,7 @@ recipe insert-at-cursor editor:address:editor-data, c:character, screen:address:
overflow?:boolean <- and at-bottom?, at-right?
break-if overflow?
move-cursor screen, save-row, save-column
print-character screen, c
print screen, c
go-render? <- copy 0/false
reply
}
@ -246,7 +246,7 @@ recipe insert-at-cursor editor:address:editor-data, c:character, screen:address:
currc:character <- get *curr, value:offset
at-newline?:boolean <- equal currc, 10/newline
break-if at-newline?
print-character screen, currc
print screen, currc
curr-column <- add curr-column, 1
curr <- next curr
loop
@ -1035,7 +1035,7 @@ recipe draw-horizontal screen:address:screen, row:number, x:number, right:number
{
continue?:boolean <- lesser-or-equal x, right # right is inclusive, to match editor-data semantics
break-unless continue?
print-character screen, style, color, bg-color
print screen, style, color, bg-color
x <- add x, 1
loop
}

View File

@ -118,13 +118,13 @@ recipe delete-before-cursor editor:address:editor-data, screen:address:screen ->
currc:character <- get *curr, value:offset
at-newline?:boolean <- equal currc, 10/newline
break-if at-newline?
screen <- print-character screen, currc
screen <- print screen, currc
curr-column <- add curr-column, 1
curr <- next curr
loop
}
# we're guaranteed not to be at the right margin
screen <- print-character screen, 32/space
screen <- print screen, 32/space
go-render? <- copy 0/false
]
@ -358,13 +358,13 @@ recipe delete-at-cursor editor:address:editor-data, screen:address:screen -> edi
currc:character <- get *curr, value:offset
at-newline?:boolean <- equal currc, 10/newline
break-if at-newline?
screen <- print-character screen, currc
screen <- print screen, currc
curr-column <- add curr-column, 1
curr <- next curr
loop
}
# we're guaranteed not to be at the right margin
screen <- print-character screen, 32/space
screen <- print screen, 32/space
go-render? <- copy 0/false
]

View File

@ -223,7 +223,7 @@ recipe render screen:address:screen, s:address:array:character, left:number, rig
at-right?:boolean <- equal column, right
break-unless at-right?
# print wrap icon
print-character screen, 8617/loop-back-to-left, 245/grey
print screen, 8617/loop-back-to-left, 245/grey
column <- copy left
row <- add row, 1
screen <- move-cursor screen, row, column
@ -238,7 +238,7 @@ recipe render screen:address:screen, s:address:array:character, left:number, rig
{
done?:boolean <- greater-than column, right
break-if done?
print-character screen, 32/space
print screen, 32/space
column <- add column, 1
loop
}
@ -247,7 +247,7 @@ recipe render screen:address:screen, s:address:array:character, left:number, rig
screen <- move-cursor screen, row, column
loop +next-character:label
}
print-character screen, c, color
print screen, c, color
column <- add column, 1
loop
}
@ -284,7 +284,7 @@ recipe render-code screen:address:screen, s:address:array:character, left:number
at-right?:boolean <- equal column, right
break-unless at-right?
# print wrap icon
print-character screen, 8617/loop-back-to-left, 245/grey
print screen, 8617/loop-back-to-left, 245/grey
column <- copy left
row <- add row, 1
screen <- move-cursor screen, row, column
@ -299,7 +299,7 @@ recipe render-code screen:address:screen, s:address:array:character, left:number
{
done?:boolean <- greater-than column, right
break-if done?
print-character screen, 32/space
print screen, 32/space
column <- add column, 1
loop
}
@ -308,7 +308,7 @@ recipe render-code screen:address:screen, s:address:array:character, left:number
screen <- move-cursor screen, row, column
loop +next-character:label
}
print-character screen, c, color
print screen, c, color
column <- add column, 1
loop
}

View File

@ -234,7 +234,7 @@ recipe render-sandboxes screen:address:screen, sandbox:address:sandbox-data, lef
row <- add row, 1
screen <- move-cursor screen, row, left
clear-line-delimited screen, left, right
print-character screen, 120/x, 245/grey
print screen, 120/x, 245/grey
# save menu row so we can detect clicks to it later
starting-row:address:number <- get-address *sandbox, starting-row-on-screen:offset
*starting-row <- copy row
@ -330,9 +330,9 @@ recipe render-screen screen:address:screen, sandbox-screen:address:screen, left:
column <- copy left
screen <- move-cursor screen, row, column
# initial leader for each row: two spaces and a '.'
print-character screen, 32/space, 245/grey
print-character screen, 32/space, 245/grey
print-character screen, 46/full-stop, 245/grey
print screen, 32/space, 245/grey
print screen, 32/space, 245/grey
print screen, 46/full-stop, 245/grey
column <- add left, 3
{
# print row
@ -347,19 +347,19 @@ recipe render-screen screen:address:screen, sandbox-screen:address:screen, left:
break-unless white?
color <- copy 245/grey
}
print-character screen, c, color
print screen, c, color
column <- add column, 1
i <- add i, 1
loop
}
# print final '.'
print-character screen, 46/full-stop, 245/grey
print screen, 46/full-stop, 245/grey
column <- add column, 1
{
# clear rest of current line
line-done?:boolean <- greater-than column, right
break-if line-done?
print-character screen, 32/space
print screen, 32/space
column <- add column, 1
loop
}

View File

@ -25,7 +25,7 @@ scenario sandbox-click-on-code-toggles-app-trace [
]
run [
event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
# trace now printed and cursor shouldn't have budged
screen-should-contain [
@ -54,7 +54,7 @@ scenario sandbox-click-on-code-toggles-app-trace [
]
run [
event-loop screen:address:screen, console:address:console, 2:address:programming-environment-data
print-character screen:address:screen, 9251/␣/cursor
print screen:address:screen, 9251/␣/cursor
]
# trace hidden again
screen-should-contain [

View File

@ -5,12 +5,12 @@
recipe main [
open-console
print-character 0/screen, 97/a, 2/red
print 0/screen, 97/a, 2/red
1:number/raw, 2:number/raw <- cursor-position 0/screen
wait-for-event 0/console
clear-screen 0/screen
move-cursor 0/screen, 0/row, 4/column
print-character 0/screen, 98/b
print 0/screen, 98/b
wait-for-event 0/console
move-cursor 0/screen, 0/row, 0/column
clear-line 0/screen