This commit is contained in:
Kartik K. Agaram 2017-08-22 08:39:53 -07:00
parent fd25687532
commit 736b26a73f
12 changed files with 123 additions and 123 deletions

View File

@ -61,10 +61,10 @@ def move-cursor editor:&:editor, screen:&:screen, t:touch-event -> in-focus?:boo
too-far-right?:bool <- greater-than click-column, right
return-if too-far-right?, 0/false
# position cursor
<move-cursor-begin>
<begin-move-cursor>
editor <- snap-cursor editor, screen, click-row, click-column
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
# gain focus
return 1/true
]
@ -187,9 +187,9 @@ def handle-keyboard-event screen:&:screen, editor:&:editor, e:event -> go-render
regular-character?:bool <- greater-or-equal c, 32/space
return-unless regular-character?, 0/don't-render
# otherwise type it in
<insert-character-begin>
<begin-insert-character>
go-render? <- insert-at-cursor editor, c, screen
<insert-character-end>
<end-insert-character>
return
}
# special key to modify the text or move the cursor
@ -858,9 +858,9 @@ after <handle-special-character> [
{
newline?:bool <- equal c, 10/newline
break-unless newline?
<insert-enter-begin>
<begin-insert-enter>
insert-new-line-and-indent editor, screen
<insert-enter-end>
<end-insert-enter>
return 1/go-render
}
]

View File

@ -52,12 +52,12 @@ after <handle-special-character> [
{
tab?:bool <- equal c, 9/tab
break-unless tab?
<insert-character-begin>
<begin-insert-character>
# todo: decompose insert-at-cursor into editor update and screen update,
# so that 'tab' doesn't render the current line multiple times
insert-at-cursor editor, 32/space, screen
go-render? <- insert-at-cursor editor, 32/space, screen
<insert-character-end>
<end-insert-character>
return
}
]
@ -96,9 +96,9 @@ after <handle-special-character> [
{
delete-previous-character?:bool <- equal c, 8/backspace
break-unless delete-previous-character?
<backspace-character-begin>
<begin-backspace-character>
go-render?:bool, backspaced-cell:&:duplex-list:char <- delete-before-cursor editor, screen
<backspace-character-end>
<end-backspace-character>
return
}
]
@ -363,9 +363,9 @@ after <handle-special-key> [
{
delete-next-character?:bool <- equal k, 65522/delete
break-unless delete-next-character?
<delete-character-begin>
<begin-delete-character>
go-render?:bool, deleted-cell:&:duplex-list:char <- delete-at-cursor editor, screen
<delete-character-end>
<end-delete-character>
return
}
]
@ -439,13 +439,13 @@ after <handle-special-key> [
next-cursor:&:duplex-list:char <- next before-cursor
break-unless next-cursor
# scan to next character
<move-cursor-begin>
<begin-move-cursor>
before-cursor <- copy next-cursor
*editor <- put *editor, before-cursor:offset, before-cursor
go-render?:bool <- move-cursor-coordinates-right editor, screen-height
screen <- move-cursor screen, cursor-row, cursor-column
undo-coalesce-tag:num <- copy 2/right-arrow
<move-cursor-end>
<end-move-cursor>
return
}
]
@ -723,12 +723,12 @@ after <handle-special-key> [
# if not at start of text (before-cursor at § sentinel)
prev:&:duplex-list:char <- prev before-cursor
return-unless prev, 0/don't-render
<move-cursor-begin>
<begin-move-cursor>
go-render? <- move-cursor-coordinates-left editor
before-cursor <- copy prev
*editor <- put *editor, before-cursor:offset, before-cursor
undo-coalesce-tag:num <- copy 1/left-arrow
<move-cursor-end>
<end-move-cursor>
return
}
]
@ -989,10 +989,10 @@ after <handle-special-key> [
{
move-to-previous-line?:bool <- equal k, 65517/up-arrow
break-unless move-to-previous-line?
<move-cursor-begin>
<begin-move-cursor>
go-render? <- move-to-previous-line editor
undo-coalesce-tag:num <- copy 3/up-arrow
<move-cursor-end>
<end-move-cursor>
return
}
]
@ -1343,10 +1343,10 @@ after <handle-special-key> [
{
move-to-next-line?:bool <- equal k, 65516/down-arrow
break-unless move-to-next-line?
<move-cursor-begin>
<begin-move-cursor>
go-render? <- move-to-next-line editor, screen-height
undo-coalesce-tag:num <- copy 4/down-arrow
<move-cursor-end>
<end-move-cursor>
return
}
]
@ -1540,10 +1540,10 @@ after <handle-special-character> [
{
move-to-start-of-line?:bool <- equal c, 1/ctrl-a
break-unless move-to-start-of-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-start-of-screen-line editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return 0/don't-render
}
]
@ -1552,10 +1552,10 @@ after <handle-special-key> [
{
move-to-start-of-line?:bool <- equal k, 65521/home
break-unless move-to-start-of-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-start-of-screen-line editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return 0/don't-render
}
]
@ -1765,10 +1765,10 @@ after <handle-special-character> [
{
move-to-end-of-line?:bool <- equal c, 5/ctrl-e
break-unless move-to-end-of-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-end-of-line editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return 0/don't-render
}
]
@ -1777,10 +1777,10 @@ after <handle-special-key> [
{
move-to-end-of-line?:bool <- equal k, 65520/end
break-unless move-to-end-of-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-end-of-line editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return 0/don't-render
}
]
@ -1960,9 +1960,9 @@ after <handle-special-character> [
{
delete-to-start-of-line?:bool <- equal c, 21/ctrl-u
break-unless delete-to-start-of-line?
<delete-to-start-of-line-begin>
<begin-delete-to-start-of-line>
deleted-cells:&:duplex-list:char <- delete-to-start-of-line editor
<delete-to-start-of-line-end>
<end-delete-to-start-of-line>
go-render?:bool <- minimal-render-for-ctrl-u screen, editor, deleted-cells
return
}
@ -2537,9 +2537,9 @@ after <handle-special-character> [
{
delete-to-end-of-line?:bool <- equal c, 11/ctrl-k
break-unless delete-to-end-of-line?
<delete-to-end-of-line-begin>
<begin-delete-to-end-of-line>
deleted-cells:&:duplex-list:char <- delete-to-end-of-line editor
<delete-to-end-of-line-end>
<end-delete-to-end-of-line>
# checks if we can do a minimal render and if we can it will do a minimal render
go-render?:bool <- minimal-render-for-ctrl-k screen, editor, deleted-cells
return
@ -3567,10 +3567,10 @@ after <handle-special-character> [
page-down?:bool <- equal c, 6/ctrl-f
break-unless page-down?
old-top:&:duplex-list:char <- get *editor, top-of-screen:offset
<move-cursor-begin>
<begin-move-cursor>
page-down editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset
movement?:bool <- not-equal top-of-screen, old-top
return movement?/go-render
@ -3582,10 +3582,10 @@ after <handle-special-key> [
page-down?:bool <- equal k, 65518/page-down
break-unless page-down?
old-top:&:duplex-list:char <- get *editor, top-of-screen:offset
<move-cursor-begin>
<begin-move-cursor>
page-down editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset
movement?:bool <- not-equal top-of-screen, old-top
return movement?/go-render
@ -3791,10 +3791,10 @@ after <handle-special-character> [
page-up?:bool <- equal c, 2/ctrl-b
break-unless page-up?
old-top:&:duplex-list:char <- get *editor, top-of-screen:offset
<move-cursor-begin>
<begin-move-cursor>
editor <- page-up editor, screen-height
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset
movement?:bool <- not-equal top-of-screen, old-top
return movement?/go-render
@ -3806,10 +3806,10 @@ after <handle-special-key> [
page-up?:bool <- equal k, 65519/page-up
break-unless page-up?
old-top:&:duplex-list:char <- get *editor, top-of-screen:offset
<move-cursor-begin>
<begin-move-cursor>
editor <- page-up editor, screen-height
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset
movement?:bool <- not-equal top-of-screen, old-top
# don't bother re-rendering if nothing changed. todo: test this
@ -4138,10 +4138,10 @@ after <handle-special-character> [
{
scroll-up?:bool <- equal c, 19/ctrl-s
break-unless scroll-up?
<move-cursor-begin>
<begin-move-cursor>
go-render?:bool, editor <- line-up editor, screen-height
undo-coalesce-tag:num <- copy 5/line-up
<move-cursor-end>
<end-move-cursor>
return go-render?
}
]
@ -4169,10 +4169,10 @@ after <handle-special-character> [
{
scroll-down?:bool <- equal c, 24/ctrl-x
break-unless scroll-down?
<move-cursor-begin>
<begin-move-cursor>
go-render?:bool, editor <- line-down editor, screen-height
undo-coalesce-tag:num <- copy 6/line-down
<move-cursor-end>
<end-move-cursor>
return go-render?
}
]
@ -4197,7 +4197,7 @@ after <handle-special-character> [
{
scroll-down?:bool <- equal c, 20/ctrl-t
break-unless scroll-down?
<move-cursor-begin>
<begin-move-cursor>
old-top:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor:&:duplex-list:char <- get *editor, before-cursor:offset
cursor <- next cursor
@ -4206,7 +4206,7 @@ after <handle-special-character> [
*editor <- put *editor, cursor-row:offset, 1
go-render?:bool <- not-equal new-top, old-top
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return go-render?
}
]
@ -4219,7 +4219,7 @@ after <handle-special-character> [
break-unless comment-toggle?
cursor-column:num <- get *editor, cursor-column:offset
data:&:duplex-list:char <- get *editor, data:offset
<insert-character-begin>
<begin-insert-character>
before-line-start:&:duplex-list:char <- before-start-of-screen-line editor
line-start:&:duplex-list:char <- next before-line-start
commented-out?:bool <- match line-start, [#? ] # comment prefix
@ -4239,7 +4239,7 @@ after <handle-special-character> [
*editor <- put *editor, cursor-column:offset, cursor-column
go-render? <- render-line-from-start screen, editor, 0
}
<insert-character-end>
<end-insert-character>
return
}
]

View File

@ -420,7 +420,7 @@ def render-all screen:&:screen, env:&:environment, render-editor:render-recipe -
#
screen <- render-recipes screen, env, render-editor
screen <- render-sandbox-side screen, env, render-editor
<render-components-end> # no early returns permitted
<end-render-components> # no early returns permitted
#
recipes:&:editor <- get *env, recipes:offset
current-sandbox:&:editor <- get *env, current-sandbox:offset
@ -440,7 +440,7 @@ def render-recipes screen:&:screen, env:&:environment, render-editor:render-reci
row:num, column:num, screen <- call render-editor, screen, recipes
clear-line-until screen, right
row <- add row, 1
<render-recipe-components-end>
<end-render-recipe-components>
# draw dotted line after recipes
draw-horizontal screen, row, left, right, 9480/horizontal-dotted
row <- add row, 1

View File

@ -152,7 +152,7 @@ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> e
errors-found?:bool <- update-recipes env, resources, screen
jump-if errors-found?, +return
# check contents of right editor (sandbox)
<run-sandboxes-begin>
<begin-run-sandboxes>
current-sandbox:&:editor <- get *env, current-sandbox:offset
{
sandbox-contents:text <- editor-contents current-sandbox
@ -187,7 +187,7 @@ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> e
idx <- add idx, 1
loop
}
<run-sandboxes-end>
<end-run-sandboxes>
+return
{
break-if resources # ignore this in tests

View File

@ -51,11 +51,11 @@ after <programming-environment-initialization> [
*result <- put *result, error-index:offset, -1
]
after <run-sandboxes-begin> [
after <begin-run-sandboxes> [
*env <- put *env, error-index:offset, -1
]
before <run-sandboxes-end> [
before <end-run-sandboxes> [
{
error-index:num <- get *env, error-index:offset
sandboxes-completed-successfully?:bool <- equal error-index, -1

View File

@ -140,11 +140,11 @@ scenario editor-can-undo-typing [
]
# save operation to undo
after <insert-character-begin> [
after <begin-insert-character> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-before:&:duplex-list:char <- get *editor, before-cursor:offset
]
before <insert-character-end> [
before <end-insert-character> [
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-row:num <- get *editor, cursor-row:offset
cursor-column:num <- get *editor, cursor-column:offset
@ -176,13 +176,13 @@ before <insert-character-end> [
]
# enter operations never coalesce with typing before or after
after <insert-enter-begin> [
after <begin-insert-enter> [
cursor-row-before:num <- copy cursor-row
cursor-column-before:num <- copy cursor-column
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-before:&:duplex-list:char <- get *editor, before-cursor:offset
]
before <insert-enter-end> [
before <end-insert-enter> [
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-row:num <- get *editor, cursor-row:offset
cursor-column:num <- get *editor, cursor-row:offset
@ -718,12 +718,12 @@ ghi]
]
]
after <move-cursor-begin> [
after <begin-move-cursor> [
cursor-row-before:num <- get *editor, cursor-row:offset
cursor-column-before:num <- get *editor, cursor-column:offset
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <move-cursor-end> [
before <end-move-cursor> [
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-row:num <- get *editor, cursor-row:offset
cursor-column:num <- get *editor, cursor-column:offset
@ -1616,10 +1616,10 @@ scenario editor-can-undo-and-redo-backspace [
]
# save operation to undo
after <backspace-character-begin> [
after <begin-backspace-character> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <backspace-character-end> [
before <end-backspace-character> [
{
break-unless backspaced-cell # backspace failed; don't add an undo operation
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
@ -1842,10 +1842,10 @@ scenario editor-can-undo-and-redo-delete [
]
]
after <delete-character-begin> [
after <begin-delete-character> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <delete-character-end> [
before <end-delete-character> [
{
break-unless deleted-cell # delete failed; don't add an undo operation
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
@ -1968,10 +1968,10 @@ def]
]
]
after <delete-to-end-of-line-begin> [
after <begin-delete-to-end-of-line> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <delete-to-end-of-line-end> [
before <end-delete-to-end-of-line> [
{
break-unless deleted-cells # delete failed; don't add an undo operation
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
@ -2071,10 +2071,10 @@ def]
]
]
after <delete-to-start-of-line-begin> [
after <begin-delete-to-start-of-line> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <delete-to-start-of-line-end> [
before <end-delete-to-start-of-line> [
{
break-unless deleted-cells # delete failed; don't add an undo operation
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset

View File

@ -61,10 +61,10 @@ def move-cursor editor:&:editor, screen:&:screen, t:touch-event -> in-focus?:boo
too-far-right?:bool <- greater-than click-column, right
return-if too-far-right?, 0/false
# position cursor
<move-cursor-begin>
<begin-move-cursor>
editor <- snap-cursor editor, screen, click-row, click-column
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
# gain focus
return 1/true
]
@ -187,9 +187,9 @@ def handle-keyboard-event screen:&:screen, editor:&:editor, e:event -> go-render
regular-character?:bool <- greater-or-equal c, 32/space
return-unless regular-character?, 0/don't-render
# otherwise type it in
<insert-character-begin>
<begin-insert-character>
go-render? <- insert-at-cursor editor, c, screen
<insert-character-end>
<end-insert-character>
return
}
# special key to modify the text or move the cursor
@ -858,9 +858,9 @@ after <handle-special-character> [
{
newline?:bool <- equal c, 10/newline
break-unless newline?
<insert-enter-begin>
<begin-insert-enter>
insert-new-line-and-indent editor, screen
<insert-enter-end>
<end-insert-enter>
return 1/go-render
}
]

View File

@ -52,12 +52,12 @@ after <handle-special-character> [
{
tab?:bool <- equal c, 9/tab
break-unless tab?
<insert-character-begin>
<begin-insert-character>
# todo: decompose insert-at-cursor into editor update and screen update,
# so that 'tab' doesn't render the current line multiple times
insert-at-cursor editor, 32/space, screen
go-render? <- insert-at-cursor editor, 32/space, screen
<insert-character-end>
<end-insert-character>
return
}
]
@ -96,9 +96,9 @@ after <handle-special-character> [
{
delete-previous-character?:bool <- equal c, 8/backspace
break-unless delete-previous-character?
<backspace-character-begin>
<begin-backspace-character>
go-render?:bool, backspaced-cell:&:duplex-list:char <- delete-before-cursor editor, screen
<backspace-character-end>
<end-backspace-character>
return
}
]
@ -360,9 +360,9 @@ after <handle-special-key> [
{
delete-next-character?:bool <- equal k, 65522/delete
break-unless delete-next-character?
<delete-character-begin>
<begin-delete-character>
go-render?:bool, deleted-cell:&:duplex-list:char <- delete-at-cursor editor, screen
<delete-character-end>
<end-delete-character>
return
}
]
@ -436,13 +436,13 @@ after <handle-special-key> [
next-cursor:&:duplex-list:char <- next before-cursor
break-unless next-cursor
# scan to next character
<move-cursor-begin>
<begin-move-cursor>
before-cursor <- copy next-cursor
*editor <- put *editor, before-cursor:offset, before-cursor
go-render?:bool <- move-cursor-coordinates-right editor, screen-height
screen <- move-cursor screen, cursor-row, cursor-column
undo-coalesce-tag:num <- copy 2/right-arrow
<move-cursor-end>
<end-move-cursor>
return
}
]
@ -718,12 +718,12 @@ after <handle-special-key> [
# if not at start of text (before-cursor at § sentinel)
prev:&:duplex-list:char <- prev before-cursor
return-unless prev, 0/don't-render
<move-cursor-begin>
<begin-move-cursor>
move-cursor-coordinates-left editor
before-cursor <- copy prev
*editor <- put *editor, before-cursor:offset, before-cursor
undo-coalesce-tag:num <- copy 1/left-arrow
<move-cursor-end>
<end-move-cursor>
return
}
]
@ -984,10 +984,10 @@ after <handle-special-key> [
{
move-to-previous-line?:bool <- equal k, 65517/up-arrow
break-unless move-to-previous-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-previous-line editor
undo-coalesce-tag:num <- copy 3/up-arrow
<move-cursor-end>
<end-move-cursor>
return
}
]
@ -1330,10 +1330,10 @@ after <handle-special-key> [
{
move-to-next-line?:bool <- equal k, 65516/down-arrow
break-unless move-to-next-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-next-line editor, screen-height
undo-coalesce-tag:num <- copy 4/down-arrow
<move-cursor-end>
<end-move-cursor>
return
}
]
@ -1462,10 +1462,10 @@ after <handle-special-character> [
{
move-to-start-of-line?:bool <- equal c, 1/ctrl-a
break-unless move-to-start-of-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-start-of-screen-line editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return 0/don't-render
}
]
@ -1474,10 +1474,10 @@ after <handle-special-key> [
{
move-to-start-of-line?:bool <- equal k, 65521/home
break-unless move-to-start-of-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-start-of-screen-line editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return 0/don't-render
}
]
@ -1687,10 +1687,10 @@ after <handle-special-character> [
{
move-to-end-of-line?:bool <- equal c, 5/ctrl-e
break-unless move-to-end-of-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-end-of-line editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return 0/don't-render
}
]
@ -1699,10 +1699,10 @@ after <handle-special-key> [
{
move-to-end-of-line?:bool <- equal k, 65520/end
break-unless move-to-end-of-line?
<move-cursor-begin>
<begin-move-cursor>
move-to-end-of-line editor
undo-coalesce-tag:num <- copy 0/never
<move-cursor-end>
<end-move-cursor>
return 0/don't-render
}
]
@ -1882,9 +1882,9 @@ after <handle-special-character> [
{
delete-to-start-of-line?:bool <- equal c, 21/ctrl-u
break-unless delete-to-start-of-line?
<delete-to-start-of-line-begin>
<begin-delete-to-start-of-line>
deleted-cells:&:duplex-list:char <- delete-to-start-of-line editor
<delete-to-start-of-line-end>
<end-delete-to-start-of-line>
go-render?:bool <- minimal-render-for-ctrl-u screen, editor, deleted-cells
return
}
@ -2274,9 +2274,9 @@ after <handle-special-character> [
{
delete-to-end-of-line?:bool <- equal c, 11/ctrl-k
break-unless delete-to-end-of-line?
<delete-to-end-of-line-begin>
<begin-delete-to-end-of-line>
deleted-cells:&:duplex-list:char <- delete-to-end-of-line editor
<delete-to-end-of-line-end>
<end-delete-to-end-of-line>
# checks if we can do a minimal render and if we can it will do a minimal render
go-render?:bool <- minimal-render-for-ctrl-k screen, editor, deleted-cells
return
@ -2570,7 +2570,7 @@ after <handle-special-character> [
break-unless comment-toggle?
cursor-column:num <- get *editor, cursor-column:offset
data:&:duplex-list:char <- get *editor, data:offset
<insert-character-begin>
<begin-insert-character>
before-line-start:&:duplex-list:char <- before-start-of-screen-line editor
line-start:&:duplex-list:char <- next before-line-start
commented-out?:bool <- match line-start, [#? ] # comment prefix
@ -2590,7 +2590,7 @@ after <handle-special-character> [
*editor <- put *editor, cursor-column:offset, cursor-column
go-render? <- render-line-from-start screen, editor, 0
}
<insert-character-end>
<end-insert-character>
return
}
]

View File

@ -208,7 +208,7 @@ def render-all screen:&:screen, env:&:environment, render-editor:render-recipe -
print screen, [ run (F4) ], 255/white, 161/reddish
#
screen <- render-sandbox-side screen, env, render-editor
<render-components-end> # no early returns permitted
<end-render-components> # no early returns permitted
#
current-sandbox:&:editor <- get *env, current-sandbox:offset
screen <- update-cursor screen, current-sandbox, env

View File

@ -139,7 +139,7 @@ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> e
load-ingredients
errors-found?:bool <- update-recipes env, resources, screen
# check contents of editor
<run-sandboxes-begin>
<begin-run-sandboxes>
current-sandbox:&:editor <- get *env, current-sandbox:offset
{
sandbox-contents:text <- editor-contents current-sandbox
@ -174,7 +174,7 @@ def run-sandboxes env:&:environment, resources:&:resources, screen:&:screen -> e
idx <- add idx, 1
loop
}
<run-sandboxes-end>
<end-run-sandboxes>
{
break-if resources # ignore this in tests
$system [./snapshot_lesson]

View File

@ -21,7 +21,7 @@ def! update-recipes env:&:environment, resources:&:resources, screen:&:screen ->
errors-found? <- copy 0/false
]
before <render-components-end> [
before <end-render-components> [
trace 11, [app], [render status]
recipe-errors:text <- get *env, recipe-errors:offset
{
@ -38,11 +38,11 @@ after <programming-environment-initialization> [
*result <- put *result, error-index:offset, -1
]
after <run-sandboxes-begin> [
after <begin-run-sandboxes> [
*env <- put *env, error-index:offset, -1
]
before <run-sandboxes-end> [
before <end-run-sandboxes> [
{
error-index:num <- get *env, error-index:offset
sandboxes-completed-successfully?:bool <- equal error-index, -1
@ -51,7 +51,7 @@ before <run-sandboxes-end> [
}
]
before <render-components-end> [
before <end-render-components> [
{
break-if recipe-errors
error-index:num <- get *env, error-index:offset

View File

@ -138,11 +138,11 @@ scenario editor-can-undo-typing [
]
# save operation to undo
after <insert-character-begin> [
after <begin-insert-character> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-before:&:duplex-list:char <- get *editor, before-cursor:offset
]
before <insert-character-end> [
before <end-insert-character> [
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-row:num <- get *editor, cursor-row:offset
cursor-column:num <- get *editor, cursor-column:offset
@ -174,13 +174,13 @@ before <insert-character-end> [
]
# enter operations never coalesce with typing before or after
after <insert-enter-begin> [
after <begin-insert-enter> [
cursor-row-before:num <- copy cursor-row
cursor-column-before:num <- copy cursor-column
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-before:&:duplex-list:char <- get *editor, before-cursor:offset
]
before <insert-enter-end> [
before <end-insert-enter> [
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-row:num <- get *editor, cursor-row:offset
cursor-column:num <- get *editor, cursor-row:offset
@ -716,12 +716,12 @@ ghi]
]
]
after <move-cursor-begin> [
after <begin-move-cursor> [
cursor-row-before:num <- get *editor, cursor-row:offset
cursor-column-before:num <- get *editor, cursor-column:offset
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <move-cursor-end> [
before <end-move-cursor> [
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
cursor-row:num <- get *editor, cursor-row:offset
cursor-column:num <- get *editor, cursor-column:offset
@ -1412,10 +1412,10 @@ scenario editor-can-undo-and-redo-backspace [
]
# save operation to undo
after <backspace-character-begin> [
after <begin-backspace-character> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <backspace-character-end> [
before <end-backspace-character> [
{
break-unless backspaced-cell # backspace failed; don't add an undo operation
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
@ -1638,10 +1638,10 @@ scenario editor-can-undo-and-redo-delete [
]
]
after <delete-character-begin> [
after <begin-delete-character> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <delete-character-end> [
before <end-delete-character> [
{
break-unless deleted-cell # delete failed; don't add an undo operation
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
@ -1764,10 +1764,10 @@ def]
]
]
after <delete-to-end-of-line-begin> [
after <begin-delete-to-end-of-line> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <delete-to-end-of-line-end> [
before <end-delete-to-end-of-line> [
{
break-unless deleted-cells # delete failed; don't add an undo operation
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset
@ -1867,10 +1867,10 @@ def]
]
]
after <delete-to-start-of-line-begin> [
after <begin-delete-to-start-of-line> [
top-before:&:duplex-list:char <- get *editor, top-of-screen:offset
]
before <delete-to-start-of-line-end> [
before <end-delete-to-start-of-line> [
{
break-unless deleted-cells # delete failed; don't add an undo operation
top-after:&:duplex-list:char <- get *editor, top-of-screen:offset