diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-08-22 08:39:53 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-08-22 08:39:53 -0700 |
commit | 736b26a73f2b1f31593d1b2fb7bd690280576ac8 (patch) | |
tree | efefb0dfb558b3fa8afb19c6156457078ed4dce3 /edit | |
parent | fd256875325d6dddadfc02128fae6d5ab626bf8b (diff) | |
download | mu-736b26a73f2b1f31593d1b2fb7bd690280576ac8.tar.gz |
3980
Diffstat (limited to 'edit')
-rw-r--r-- | edit/002-typing.mu | 12 | ||||
-rw-r--r-- | edit/003-shortcuts.mu | 84 | ||||
-rw-r--r-- | edit/004-programming-environment.mu | 4 | ||||
-rw-r--r-- | edit/005-sandbox.mu | 4 | ||||
-rw-r--r-- | edit/011-errors.mu | 4 | ||||
-rw-r--r-- | edit/012-editor-undo.mu | 28 |
6 files changed, 68 insertions, 68 deletions
diff --git a/edit/002-typing.mu b/edit/002-typing.mu index 3b29c322..f5bbeb6f 100644 --- a/edit/002-typing.mu +++ b/edit/002-typing.mu @@ -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 } ] diff --git a/edit/003-shortcuts.mu b/edit/003-shortcuts.mu index 6ffc9bcf..df40a6e4 100644 --- a/edit/003-shortcuts.mu +++ b/edit/003-shortcuts.mu @@ -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 } ] diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu index 897f2923..73d26d4d 100644 --- a/edit/004-programming-environment.mu +++ b/edit/004-programming-environment.mu @@ -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 diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu index 6c74ca29..9e175378 100644 --- a/edit/005-sandbox.mu +++ b/edit/005-sandbox.mu @@ -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 diff --git a/edit/011-errors.mu b/edit/011-errors.mu index dcccf598..0c1ba545 100644 --- a/edit/011-errors.mu +++ b/edit/011-errors.mu @@ -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 diff --git a/edit/012-editor-undo.mu b/edit/012-editor-undo.mu index b7f9e976..024a0398 100644 --- a/edit/012-editor-undo.mu +++ b/edit/012-editor-undo.mu @@ -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 |