diff options
-rw-r--r-- | 061text.mu | 2 | ||||
-rw-r--r-- | edit/001-editor.mu | 12 | ||||
-rw-r--r-- | edit/003-shortcuts.mu | 2 | ||||
-rw-r--r-- | edit/004-programming-environment.mu | 4 | ||||
-rw-r--r-- | edit/012-editor-undo.mu | 5 | ||||
-rw-r--r-- | html/061text.mu.html | 2 | ||||
-rw-r--r-- | html/edit/001-editor.mu.html | 12 | ||||
-rw-r--r-- | html/edit/003-shortcuts.mu.html | 2 | ||||
-rw-r--r-- | html/edit/004-programming-environment.mu.html | 4 | ||||
-rw-r--r-- | html/edit/012-editor-undo.mu.html | 5 | ||||
-rw-r--r-- | sandbox/001-editor.mu | 12 | ||||
-rw-r--r-- | sandbox/003-shortcuts.mu | 2 | ||||
-rw-r--r-- | sandbox/004-programming-environment.mu | 4 | ||||
-rw-r--r-- | sandbox/012-editor-undo.mu | 5 |
14 files changed, 32 insertions, 41 deletions
diff --git a/061text.mu b/061text.mu index d8e40112..fac5609c 100644 --- a/061text.mu +++ b/061text.mu @@ -448,7 +448,7 @@ def replace s:text, oldc:char, newc:char, from:num/optional -> s:text [ len:num <- length *s i:num <- find-next s, oldc, from done?:bool <- greater-or-equal i, len - return-if done?, s/same-as-ingredient:0 + return-if done? *s <- put-index *s, i, newc i <- add i, 1 s <- replace s, oldc, newc, i diff --git a/edit/001-editor.mu b/edit/001-editor.mu index 170468cd..c3e8e6da 100644 --- a/edit/001-editor.mu +++ b/edit/001-editor.mu @@ -73,9 +73,9 @@ def insert-text editor:&:editor, text:text -> editor:&:editor [ local-scope load-ingredients # early exit if text is empty - return-unless text, editor/same-as-ingredient:0 + return-unless text len:num <- length *text - return-unless len, editor/same-as-ingredient:0 + return-unless len idx:num <- copy 0 # now we can start appending the rest, character by character curr:&:duplex-list:char <- get *editor, data:offset @@ -89,7 +89,6 @@ def insert-text editor:&:editor, text:text -> editor:&:editor [ idx <- add idx, 1 loop } - return editor/same-as-ingredient:0 ] scenario editor-initializes-without-data [ @@ -123,7 +122,7 @@ scenario editor-initializes-without-data [ def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope load-ingredients - return-unless editor, 1/top, 0/left, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen right:num <- get *editor, right:offset @@ -218,7 +217,7 @@ def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, sc *editor <- put *editor, cursor-row:offset, cursor-row *editor <- put *editor, cursor-column:offset, cursor-column *editor <- put *editor, before-cursor:offset, before-cursor - return row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + return row, column ] def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num -> screen:&:screen [ @@ -228,13 +227,12 @@ def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num { break-if screen clear-display-from row, column, left, right - return screen/same-as-ingredient:0 + return } # if not, go the slower route screen <- move-cursor screen, row, column clear-line-until screen, right clear-rest-of-screen screen, row, left, right - return screen/same-as-ingredient:0 ] def clear-rest-of-screen screen:&:screen, row:num, left:num, right:num -> screen:&:screen [ diff --git a/edit/003-shortcuts.mu b/edit/003-shortcuts.mu index 27710ea8..b747a869 100644 --- a/edit/003-shortcuts.mu +++ b/edit/003-shortcuts.mu @@ -478,7 +478,7 @@ def move-cursor-coordinates-right editor:&:editor, screen-height:num -> editor:& cursor-column <- copy left *editor <- put *editor, cursor-column:offset, cursor-column below-screen?:bool <- greater-or-equal cursor-row, screen-height # must be equal - return-unless below-screen?, editor/same-as-ingredient:0, 0/no-more-render + return-unless below-screen?, editor, 0/no-more-render <scroll-down> cursor-row <- subtract cursor-row, 1 # bring back into screen range *editor <- put *editor, cursor-row:offset, cursor-row diff --git a/edit/004-programming-environment.mu b/edit/004-programming-environment.mu index 2a2dcdfa..7747e7a1 100644 --- a/edit/004-programming-environment.mu +++ b/edit/004-programming-environment.mu @@ -204,7 +204,7 @@ def resize screen:&:screen, env:&:environment -> env:&:environment, screen:&:scr def render-without-moving-cursor screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope load-ingredients - return-unless editor, 1/top, 0/left, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen right:num <- get *editor, right:offset @@ -278,7 +278,7 @@ def render-without-moving-cursor screen:&:screen, editor:&:editor -> last-row:nu # save first character off-screen *editor <- put *editor, bottom-of-screen:offset, curr *editor <- put *editor, bottom:offset, row - return row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + return row, column ] scenario point-at-multiple-editors [ diff --git a/edit/012-editor-undo.mu b/edit/012-editor-undo.mu index ecc0707d..c69e6c82 100644 --- a/edit/012-editor-undo.mu +++ b/edit/012-editor-undo.mu @@ -74,7 +74,7 @@ after <handle-special-character> [ redo <- push op, redo *editor <- put *editor, redo:offset, redo <handle-undo> - return screen/same-as-ingredient:0, editor/same-as-ingredient:1, 1/go-render + return screen, editor, 1/go-render } ] @@ -92,7 +92,7 @@ after <handle-special-character> [ undo <- push op, undo *editor <- put *editor, undo:offset, undo <handle-redo> - return screen/same-as-ingredient:0, editor/same-as-ingredient:1, 1/go-render + return screen, editor, 1/go-render } ] @@ -206,7 +206,6 @@ def add-operation editor:&:editor, op:&:operation -> editor:&:editor [ redo:&:list:&:operation <- get *editor, redo:offset redo <- copy 0 *editor <- put *editor, redo:offset, redo - return editor/same-as-ingredient:0 ] after <handle-undo> [ diff --git a/html/061text.mu.html b/html/061text.mu.html index 41234594..fdc50f19 100644 --- a/html/061text.mu.html +++ b/html/061text.mu.html @@ -482,7 +482,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color len:num <span class="Special"><-</span> length *s i:num <span class="Special"><-</span> find-next s, oldc, from done?:bool <span class="Special"><-</span> greater-or-equal i, len - <span class="muControl">return-if</span> done?, s/same-as-ingredient:0 + <span class="muControl">return-if</span> done? *s <span class="Special"><-</span> put-index *s, i, newc i <span class="Special"><-</span> add i,<span class="Constant"> 1</span> s <span class="Special"><-</span> replace s, oldc, newc, i diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index ae213b6b..cc75c8a6 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -108,9 +108,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Comment"># early exit if text is empty</span> - <span class="muControl">return-unless</span> text, editor/same-as-ingredient:0 + <span class="muControl">return-unless</span> text len:num <span class="Special"><-</span> length *text - <span class="muControl">return-unless</span> len, editor/same-as-ingredient:0 + <span class="muControl">return-unless</span> len idx:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span class="Comment"># now we can start appending the rest, character by character</span> curr:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> @@ -124,7 +124,6 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color idx <span class="Special"><-</span> add idx,<span class="Constant"> 1</span> <span class="muControl">loop</span> <span class="Delimiter">}</span> - <span class="muControl">return</span> editor/same-as-ingredient:0 ] <span class="muScenario">scenario</span> editor-initializes-without-data [ @@ -158,7 +157,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muRecipe">def</span> render screen:&:screen, editor:&:editor<span class="muRecipe"> -> </span>last-row:num, last-column:num, screen:&:screen, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - <span class="muControl">return-unless</span> editor, <span class="Constant">1/top</span>, <span class="Constant">0/left</span>, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + <span class="muControl">return-unless</span> editor, <span class="Constant">1/top</span>, <span class="Constant">0/left</span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> screen-height:num <span class="Special"><-</span> screen-height screen right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> @@ -253,7 +252,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor - <span class="muControl">return</span> row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + <span class="muControl">return</span> row, column ] <span class="muRecipe">def</span> clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num<span class="muRecipe"> -> </span>screen:&:screen [ @@ -263,13 +262,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">{</span> <span class="muControl">break-if</span> screen clear-display-from row, column, left, right - <span class="muControl">return</span> screen/same-as-ingredient:0 + <span class="muControl">return</span> <span class="Delimiter">}</span> <span class="Comment"># if not, go the slower route</span> screen <span class="Special"><-</span> move-cursor screen, row, column clear-line-until screen, right clear-rest-of-screen screen, row, left, right - <span class="muControl">return</span> screen/same-as-ingredient:0 ] <span class="muRecipe">def</span> clear-rest-of-screen screen:&:screen, row:num, left:num, right:num<span class="muRecipe"> -> </span>screen:&:screen [ diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index 3e248a6c..9225ac1a 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -512,7 +512,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color cursor-column <span class="Special"><-</span> copy left *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column below-screen?:bool <span class="Special"><-</span> greater-or-equal cursor-row, screen-height <span class="Comment"># must be equal</span> - <span class="muControl">return-unless</span> below-screen?, editor/same-as-ingredient:0, <span class="Constant">0/no-more-render</span> + <span class="muControl">return-unless</span> below-screen?, editor, <span class="Constant">0/no-more-render</span> <span class="Constant"> <scroll-down></span> cursor-row <span class="Special"><-</span> subtract cursor-row,<span class="Constant"> 1</span> <span class="Comment"># bring back into screen range</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index 8b6e4c62..f363ac7e 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -239,7 +239,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muRecipe">def</span> render-without-moving-cursor screen:&:screen, editor:&:editor<span class="muRecipe"> -> </span>last-row:num, last-column:num, screen:&:screen, editor:&:editor [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - <span class="muControl">return-unless</span> editor, <span class="Constant">1/top</span>, <span class="Constant">0/left</span>, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + <span class="muControl">return-unless</span> editor, <span class="Constant">1/top</span>, <span class="Constant">0/left</span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> screen-height:num <span class="Special"><-</span> screen-height screen right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> @@ -313,7 +313,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># save first character off-screen</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">bottom-of-screen:offset</span>, curr *editor <span class="Special"><-</span> put *editor, <span class="Constant">bottom:offset</span>, row - <span class="muControl">return</span> row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + <span class="muControl">return</span> row, column ] <span class="muScenario">scenario</span> point-at-multiple-editors [ diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index 7ff25219..c0f6d84a 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -109,7 +109,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color redo <span class="Special"><-</span> push op, redo *editor <span class="Special"><-</span> put *editor, <span class="Constant">redo:offset</span>, redo <span class="Constant"> <handle-undo></span> - <span class="muControl">return</span> screen/same-as-ingredient:0, editor/same-as-ingredient:1, <span class="Constant">1/go-render</span> + <span class="muControl">return</span> screen, editor, <span class="Constant">1/go-render</span> <span class="Delimiter">}</span> ] @@ -127,7 +127,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color undo <span class="Special"><-</span> push op, undo *editor <span class="Special"><-</span> put *editor, <span class="Constant">undo:offset</span>, undo <span class="Constant"> <handle-redo></span> - <span class="muControl">return</span> screen/same-as-ingredient:0, editor/same-as-ingredient:1, <span class="Constant">1/go-render</span> + <span class="muControl">return</span> screen, editor, <span class="Constant">1/go-render</span> <span class="Delimiter">}</span> ] @@ -241,7 +241,6 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color redo:&:list:&:operation <span class="Special"><-</span> get *editor, <span class="Constant">redo:offset</span> redo <span class="Special"><-</span> copy<span class="Constant"> 0</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">redo:offset</span>, redo - <span class="muControl">return</span> editor/same-as-ingredient:0 ] <span class="muRecipe">after</span> <span class="Constant"><handle-undo></span> [ diff --git a/sandbox/001-editor.mu b/sandbox/001-editor.mu index 170468cd..c3e8e6da 100644 --- a/sandbox/001-editor.mu +++ b/sandbox/001-editor.mu @@ -73,9 +73,9 @@ def insert-text editor:&:editor, text:text -> editor:&:editor [ local-scope load-ingredients # early exit if text is empty - return-unless text, editor/same-as-ingredient:0 + return-unless text len:num <- length *text - return-unless len, editor/same-as-ingredient:0 + return-unless len idx:num <- copy 0 # now we can start appending the rest, character by character curr:&:duplex-list:char <- get *editor, data:offset @@ -89,7 +89,6 @@ def insert-text editor:&:editor, text:text -> editor:&:editor [ idx <- add idx, 1 loop } - return editor/same-as-ingredient:0 ] scenario editor-initializes-without-data [ @@ -123,7 +122,7 @@ scenario editor-initializes-without-data [ def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope load-ingredients - return-unless editor, 1/top, 0/left, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen right:num <- get *editor, right:offset @@ -218,7 +217,7 @@ def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, sc *editor <- put *editor, cursor-row:offset, cursor-row *editor <- put *editor, cursor-column:offset, cursor-column *editor <- put *editor, before-cursor:offset, before-cursor - return row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + return row, column ] def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num -> screen:&:screen [ @@ -228,13 +227,12 @@ def clear-screen-from screen:&:screen, row:num, column:num, left:num, right:num { break-if screen clear-display-from row, column, left, right - return screen/same-as-ingredient:0 + return } # if not, go the slower route screen <- move-cursor screen, row, column clear-line-until screen, right clear-rest-of-screen screen, row, left, right - return screen/same-as-ingredient:0 ] def clear-rest-of-screen screen:&:screen, row:num, left:num, right:num -> screen:&:screen [ diff --git a/sandbox/003-shortcuts.mu b/sandbox/003-shortcuts.mu index 248c2c64..d4255704 100644 --- a/sandbox/003-shortcuts.mu +++ b/sandbox/003-shortcuts.mu @@ -471,7 +471,7 @@ def move-cursor-coordinates-right editor:&:editor, screen-height:num -> editor:& cursor-column <- copy left *editor <- put *editor, cursor-column:offset, cursor-column below-screen?:bool <- greater-or-equal cursor-row, screen-height # must be equal - return-unless below-screen?, editor/same-as-ingredient:0, 0/no-more-render + return-unless below-screen?, editor, 0/no-more-render cursor-row <- subtract cursor-row, 1 # bring back into screen range *editor <- put *editor, cursor-row:offset, cursor-row go-render? <- copy 1/true diff --git a/sandbox/004-programming-environment.mu b/sandbox/004-programming-environment.mu index be55c7ee..c32501a6 100644 --- a/sandbox/004-programming-environment.mu +++ b/sandbox/004-programming-environment.mu @@ -157,7 +157,7 @@ def resize screen:&:screen, env:&:environment -> env:&:environment, screen:&:scr def render-without-moving-cursor screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope load-ingredients - return-unless editor, 1/top, 0/left, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + return-unless editor, 1/top, 0/left left:num <- get *editor, left:offset screen-height:num <- screen-height screen right:num <- get *editor, right:offset @@ -231,7 +231,7 @@ def render-without-moving-cursor screen:&:screen, editor:&:editor -> last-row:nu # save first character off-screen *editor <- put *editor, bottom-of-screen:offset, curr *editor <- put *editor, bottom:offset, row - return row, column, screen/same-as-ingredient:0, editor/same-as-ingredient:1 + return row, column ] def render-all screen:&:screen, env:&:environment, {render-editor: (recipe (address screen) (address editor) -> number number (address screen) (address editor))} -> screen:&:screen, env:&:environment [ diff --git a/sandbox/012-editor-undo.mu b/sandbox/012-editor-undo.mu index bc37f307..a3e4956d 100644 --- a/sandbox/012-editor-undo.mu +++ b/sandbox/012-editor-undo.mu @@ -74,7 +74,7 @@ after <handle-special-character> [ redo <- push op, redo *editor <- put *editor, redo:offset, redo <handle-undo> - return screen/same-as-ingredient:0, editor/same-as-ingredient:1, 1/go-render + return screen, editor, 1/go-render } ] @@ -92,7 +92,7 @@ after <handle-special-character> [ undo <- push op, undo *editor <- put *editor, undo:offset, undo <handle-redo> - return screen/same-as-ingredient:0, editor/same-as-ingredient:1, 1/go-render + return screen, editor, 1/go-render } ] @@ -206,7 +206,6 @@ def add-operation editor:&:editor, op:&:operation -> editor:&:editor [ redo:&:list:&:operation <- get *editor, redo:offset redo <- copy 0 *editor <- put *editor, redo:offset, redo - return editor/same-as-ingredient:0 ] after <handle-undo> [ |