diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-28 20:08:04 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-28 20:08:04 -0700 |
commit | 6c69569a4c4ca3a23635d4d7a40f0fe557194619 (patch) | |
tree | 162ab23faa9fdc402732f35b875b8755bb646b33 /html/edit/012-editor-undo.mu.html | |
parent | 6f65d5918f4b73de56e6cb6362c7cbc7dbbe5945 (diff) | |
download | mu-6c69569a4c4ca3a23635d4d7a40f0fe557194619.tar.gz |
3430
Diffstat (limited to 'html/edit/012-editor-undo.mu.html')
-rw-r--r-- | html/edit/012-editor-undo.mu.html | 640 |
1 files changed, 325 insertions, 315 deletions
diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index 45abb7e9..be0db050 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -15,9 +15,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color * { font-size: 12pt; font-size: 1em; } .muRecipe { color: #ff8700; } .muData { color: #ffff00; } -.Special { color: #c00000; } .muScenario { color: #00af00; } .Delimiter { color: #800080; } +.Special { color: #c00000; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .SalientComment { color: #00ffff; } @@ -134,21 +134,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo typing</span> <span class="muScenario">scenario</span> editor-can-undo-typing [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor and type a character</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># character should be gone</span> screen-should-contain [ @@ -159,10 +159,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -264,21 +264,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-typing-multiple [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor and type multiple characters</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[012]</span> + <span class="muData">type</span> <span class="Constant">[012]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># all characters must be gone</span> screen-should-contain [ @@ -290,16 +290,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-typing-multiple-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[a]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># type some characters</span> assume-console [ - type <span class="Constant">[012]</span> + <span class="muData">type</span> <span class="Constant">[012]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .012a .</span> @@ -311,7 +311,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># back to original text</span> screen-should-contain [ @@ -322,10 +322,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -336,17 +336,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-typing-enter [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[ abc]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[ abc]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># new line</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">8</span> press enter ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> . abc .</span> @@ -355,8 +355,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> . .</span> ] <span class="Comment"># line is indented</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -366,10 +366,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">5</span> @@ -383,10 +383,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be at end of line</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -399,16 +399,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># redo typing</span> <span class="muScenario">scenario</span> editor-redo-typing [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor, type something, undo</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[a]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[012]</span> + <span class="muData">type</span> <span class="Constant">[012]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -420,7 +420,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># all characters must be back</span> screen-should-contain [ @@ -431,10 +431,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -463,16 +463,16 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-redo-typing-empty [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor, type something, undo</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[012]</span> + <span class="muData">type</span> <span class="Constant">[012]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> . .</span> @@ -484,7 +484,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># all characters must be back</span> screen-should-contain [ @@ -495,10 +495,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[3]</span> + <span class="muData">type</span> <span class="Constant">[3]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -509,23 +509,24 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-work-clears-redo-stack [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text, do some work, undo</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># do some more work</span> assume-console [ - type <span class="Constant">[0]</span> + <span class="muData">type</span> <span class="Constant">[0]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .0abc .</span> @@ -538,7 +539,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># nothing should happen</span> screen-should-contain [ @@ -551,22 +552,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-redo-typing-and-enter-and-tab [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and tabs, hit enter, some more text and tabs</span> assume-console [ press tab - type <span class="Constant">[ab]</span> + <span class="muData">type</span> <span class="Constant">[ab]</span> press tab - type <span class="Constant">[cd]</span> + <span class="muData">type</span> <span class="Constant">[cd]</span> press enter press tab - type <span class="Constant">[efg]</span> + <span class="muData">type</span> <span class="Constant">[efg]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> . ab cd .</span> @@ -574,8 +575,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">7</span> @@ -585,11 +586,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># typing in second line deleted, but not indent</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -606,11 +607,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># indent and newline deleted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">8</span> @@ -626,11 +627,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># empty screen</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> @@ -646,11 +647,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">8</span> @@ -666,11 +667,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># newline and indent inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -687,11 +688,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># indent and newline deleted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">7</span> @@ -708,38 +709,39 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo cursor movement and scroll</span> <span class="muScenario">scenario</span> editor-can-undo-touch [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">1</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># click undone</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -798,21 +800,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-scroll [ + <span class="Constant">local-scope</span> <span class="Comment"># screen has 1 line for menu + 3 lines</span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">4/height</span> <span class="Comment"># editor contains a wrapped line</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">cdefgh]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> <span class="Comment"># position cursor at end of screen and try to move right</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">3</span> press right-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> <span class="Comment"># screen scrolls</span> screen-should-contain [ <span class="Constant"> . .</span> @@ -829,11 +832,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moved back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> @@ -847,10 +850,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -861,39 +864,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-left-arrow [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">1</span> press left-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -905,21 +909,22 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-up-arrow [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">1</span> press up-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -929,21 +934,21 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -955,39 +960,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-down-arrow [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press down-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -999,29 +1005,28 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-ctrl-f [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with multiple pages of text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># scroll the page</span> assume-console [ press ctrl-f ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen should again show page 1</span> screen-should-contain [ @@ -1034,29 +1039,28 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-page-down [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with multiple pages of text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># scroll the page</span> assume-console [ press page-down ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen should again show page 1</span> screen-should-contain [ @@ -1069,30 +1073,29 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-ctrl-b [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with multiple pages of text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># scroll the page down and up</span> assume-console [ press page-down press ctrl-b ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen should again show page 2</span> screen-should-contain [ @@ -1105,30 +1108,29 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-page-up [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with multiple pages of text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[a</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[a</span> <span class="Constant">b</span> <span class="Constant">c</span> <span class="Constant">d</span> <span class="Constant">e</span> <span class="Constant">f]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># scroll the page down and up</span> assume-console [ press page-down press page-up ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># screen should again show page 2</span> screen-should-contain [ @@ -1141,39 +1143,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-ctrl-a [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor, then to start of line</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press ctrl-a ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1185,39 +1188,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-home [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor, then to start of line</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press home ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1229,39 +1233,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-ctrl-e [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor, then to start of line</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press ctrl-e ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1273,39 +1278,40 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-end [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor, then to start of line</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> press end ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># undo</span> assume-console [ press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves back</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1317,13 +1323,14 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-multiple-arrows-in-the-same-direction [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># move the cursor</span> assume-console [ left-click <span class="Constant">2</span>, <span class="Constant">1</span> @@ -1331,9 +1338,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press right-arrow press up-arrow ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> @@ -1343,11 +1350,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># up-arrow is undone</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> @@ -1357,11 +1364,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># both right-arrows are undone</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">2</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1371,38 +1378,39 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># redo cursor movement and scroll</span> <span class="muScenario">scenario</span> editor-redo-touch [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor with some text, click on a character, undo</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def</span> <span class="Constant">ghi]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ left-click <span class="Constant">3</span>, <span class="Constant">1</span> press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e <span class="Comment"># redo</span> assume-console [ press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># cursor moves to left-click</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1428,19 +1436,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-separates-undo-insert-from-undo-cursor-move [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor, type some text, move the cursor, type some more text</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e assume-console [ - type <span class="Constant">[abc]</span> + <span class="muData">type</span> <span class="Constant">[abc]</span> left-click <span class="Constant">1</span>, <span class="Constant">1</span> - type <span class="Constant">[d]</span> + <span class="muData">type</span> <span class="Constant">[d]</span> ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .adbc .</span> @@ -1456,9 +1464,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># last letter typed is deleted</span> screen-should-contain [ @@ -1476,9 +1484,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># no change to screen; cursor moves</span> screen-should-contain [ @@ -1496,9 +1504,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># screen empty</span> screen-should-contain [ @@ -1516,9 +1524,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># first insert</span> screen-should-contain [ @@ -1536,9 +1544,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># cursor moves</span> screen-should-contain [ @@ -1557,9 +1565,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + editor-event-loop screen:&:screen, console:&:console, e + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> ] <span class="Comment"># second insert</span> screen-should-contain [ @@ -1577,26 +1585,26 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo backspace</span> <span class="muScenario">scenario</span> editor-can-undo-and-redo-backspace [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit backspace</span> assume-console [ - type <span class="Constant">[abc]</span> + <span class="muData">type</span> <span class="Constant">[abc]</span> press backspace press backspace ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1606,10 +1614,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">3</span> @@ -1625,10 +1633,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1722,29 +1730,29 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo delete</span> <span class="muScenario">scenario</span> editor-can-undo-and-redo-delete [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ - type <span class="Constant">[abcdef]</span> + <span class="muData">type</span> <span class="Constant">[abcdef]</span> left-click <span class="Constant">1</span>, <span class="Constant">2</span> press delete press backspace press delete press delete ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .af .</span> <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1754,10 +1762,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1773,10 +1781,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1792,10 +1800,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1811,11 +1819,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -1831,11 +1839,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1851,11 +1859,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1911,18 +1919,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo ctrl-k</span> <span class="muScenario">scenario</span> editor-can-undo-and-redo-ctrl-k [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">1</span> press ctrl-k ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .a .</span> @@ -1930,8 +1939,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1941,7 +1950,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -1950,8 +1959,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> @@ -1961,7 +1970,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> screen-should-contain [ @@ -1971,18 +1980,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">1</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2013,18 +2022,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Comment"># undo ctrl-u</span> <span class="muScenario">scenario</span> editor-can-undo-and-redo-ctrl-u [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> + contents:text<span class="Special"> <- </span>new <span class="Constant">[abc</span> <span class="Constant">def]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor contents, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ left-click <span class="Constant">1</span>, <span class="Constant">2</span> press ctrl-u ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .c .</span> @@ -2032,8 +2042,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> @@ -2043,7 +2053,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-z ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2052,8 +2062,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">2</span> @@ -2063,7 +2073,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color press ctrl-y ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] <span class="Comment"># first line inserted</span> screen-should-contain [ @@ -2073,18 +2083,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Constant"> .┈┈┈┈┈┈┈┈┈┈.</span> <span class="Constant"> . .</span> ] - <span class="Constant">3</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-row:offset</span> - <span class="Constant">4</span>:num<span class="Special"> <- </span>get *<span class="Constant">2</span>:&:editor, <span class="Constant">cursor-column:offset</span> + <span class="Constant">3</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-row:offset</span> + <span class="Constant">4</span>:num/<span class="Special">raw <- </span>get *e, <span class="Constant">cursor-column:offset</span> memory-should-contain [ <span class="Constant">3</span><span class="Special"> <- </span><span class="Constant">1</span> <span class="Constant">4</span><span class="Special"> <- </span><span class="Constant">0</span> ] <span class="Comment"># cursor should be in the right place</span> assume-console [ - type <span class="Constant">[1]</span> + <span class="muData">type</span> <span class="Constant">[1]</span> ] run [ - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e ] screen-should-contain [ <span class="Constant"> . .</span> @@ -2114,18 +2124,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="muScenario">scenario</span> editor-can-undo-and-redo-ctrl-u-2 [ + <span class="Constant">local-scope</span> <span class="Comment"># create an editor</span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> - <span class="Constant">1</span>:text<span class="Special"> <- </span>new <span class="Constant">[]</span> - <span class="Constant">2</span>:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">1</span>:text, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> - editor-render screen, <span class="Constant">2</span>:&:editor + e:&:editor<span class="Special"> <- </span>new-editor <span class="Constant">[]</span>, screen:&:screen, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> + editor-render screen, e <span class="Comment"># insert some text and hit delete and backspace a few times</span> assume-console [ - type <span class="Constant">[abc]</span> + <span class="muData">type</span> <span class="Constant">[abc]</span> press ctrl-u press ctrl-z ] - editor-event-loop screen:&:screen, console:&:console, <span class="Constant">2</span>:&:editor + editor-event-loop screen:&:screen, console:&:console, e screen-should-contain [ <span class="Constant"> . .</span> <span class="Constant"> .abc .</span> |