diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-12-26 20:44:10 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-12-26 20:58:37 -0800 |
commit | 201458e3bd2f1d79a0ea0b853552e9df267e92b1 (patch) | |
tree | 0a4f13662cde7f92ae0bcf641c9733e2a0fcd6ef /html/edit/002-typing.mu.html | |
parent | e35c2d6857e1ed916221faae707e3c53ff8ed042 (diff) | |
download | mu-201458e3bd2f1d79a0ea0b853552e9df267e92b1.tar.gz |
3713 - cross-link calls with definitions in html
Diffstat (limited to 'html/edit/002-typing.mu.html')
-rw-r--r-- | html/edit/002-typing.mu.html | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index ad215a8f..e6d55bfc 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -70,7 +70,7 @@ if ('onhashchange' in window) { <span id="L11" class="LineNr"> 11 </span> close-console <span id="L12" class="LineNr"> 12 </span>] <span id="L13" class="LineNr"> 13 </span> -<span id="L14" class="LineNr"> 14 </span><span class="muRecipe">def</span> editor-event-loop screen:&:screen, console:&:console, editor:&:editor<span class="muRecipe"> -> </span>screen:&:screen, console:&:console, editor:&:editor [ +<span id="L14" class="LineNr"> 14 </span><span class="muRecipe">def</span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a>, editor:&:editor<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a>, editor:&:editor [ <span id="L15" class="LineNr"> 15 </span> <span class="Constant">local-scope</span> <span id="L16" class="LineNr"> 16 </span> <span class="Constant">load-ingredients</span> <span id="L17" class="LineNr"> 17 </span> <span class="Delimiter">{</span> @@ -78,25 +78,25 @@ if ('onhashchange' in window) { <span id="L19" class="LineNr"> 19 </span><span class="Constant"> +next-event</span> <span id="L20" class="LineNr"> 20 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L21" class="LineNr"> 21 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L22" class="LineNr"> 22 </span> screen <span class="Special"><-</span> move-cursor screen, cursor-row, cursor-column -<span id="L23" class="LineNr"> 23 </span> e:event, found?:bool, quit?:bool, console <span class="Special"><-</span> read-event console +<span id="L22" class="LineNr"> 22 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L442'>move-cursor</a> <a href='081print.mu.html#L4'>screen</a>, cursor-row, cursor-column +<span id="L23" class="LineNr"> 23 </span> e:<a href='084console.mu.html#L4'>event</a>, found?:bool, quit?:bool, <a href='084console.mu.html#L23'>console</a> <span class="Special"><-</span> <a href='084console.mu.html#L35'>read-event</a> <a href='084console.mu.html#L23'>console</a> <span id="L24" class="LineNr"> 24 </span> <span class="muControl">loop-unless</span> found? <span id="L25" class="LineNr"> 25 </span> <span class="muControl">break-if</span> quit? <span class="Comment"># only in tests</span> <span id="L26" class="LineNr"> 26 </span> trace<span class="Constant"> 10</span>, <span class="Constant">[app]</span>, <span class="Constant">[next-event]</span> <span id="L27" class="LineNr"> 27 </span> <span class="Comment"># 'touch' event</span> -<span id="L28" class="LineNr"> 28 </span> t:touch-event, is-touch?:bool <span class="Special"><-</span> maybe-convert e, <span class="Constant">touch:variant</span> +<span id="L28" class="LineNr"> 28 </span> t:<a href='084console.mu.html#L12'>touch-event</a>, is-touch?:bool <span class="Special"><-</span> maybe-convert e, <span class="Constant">touch:variant</span> <span id="L29" class="LineNr"> 29 </span> <span class="Delimiter">{</span> <span id="L30" class="LineNr"> 30 </span> <span class="muControl">break-unless</span> is-touch? -<span id="L31" class="LineNr"> 31 </span> move-cursor-in-editor screen, editor, t +<span id="L31" class="LineNr"> 31 </span> move-cursor-in-editor <a href='081print.mu.html#L4'>screen</a>, editor, t <span id="L32" class="LineNr"> 32 </span> <span class="muControl">loop</span> <span class="Constant">+next-event</span> <span id="L33" class="LineNr"> 33 </span> <span class="Delimiter">}</span> <span id="L34" class="LineNr"> 34 </span> <span class="Comment"># keyboard events</span> <span id="L35" class="LineNr"> 35 </span> <span class="Delimiter">{</span> <span id="L36" class="LineNr"> 36 </span> <span class="muControl">break-if</span> is-touch? -<span id="L37" class="LineNr"> 37 </span> go-render?:bool <span class="Special"><-</span> handle-keyboard-event screen, editor, e +<span id="L37" class="LineNr"> 37 </span> go-render?:bool <span class="Special"><-</span> handle-keyboard-event <a href='081print.mu.html#L4'>screen</a>, editor, e <span id="L38" class="LineNr"> 38 </span> <span class="Delimiter">{</span> <span id="L39" class="LineNr"> 39 </span> <span class="muControl">break-unless</span> go-render? -<span id="L40" class="LineNr"> 40 </span> screen <span class="Special"><-</span> editor-render screen, editor +<span id="L40" class="LineNr"> 40 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> editor-render <a href='081print.mu.html#L4'>screen</a>, editor <span id="L41" class="LineNr"> 41 </span> <span class="Delimiter">}</span> <span id="L42" class="LineNr"> 42 </span> <span class="Delimiter">}</span> <span id="L43" class="LineNr"> 43 </span> <span class="muControl">loop</span> @@ -104,7 +104,7 @@ if ('onhashchange' in window) { <span id="L45" class="LineNr"> 45 </span>] <span id="L46" class="LineNr"> 46 </span> <span id="L47" class="LineNr"> 47 </span><span class="Comment"># process click, return if it was on current editor</span> -<span id="L48" class="LineNr"> 48 </span><span class="muRecipe">def</span> move-cursor-in-editor screen:&:screen, editor:&:editor, t:touch-event<span class="muRecipe"> -> </span>in-focus?:bool, editor:&:editor [ +<span id="L48" class="LineNr"> 48 </span><span class="muRecipe">def</span> move-cursor-in-editor <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, editor:&:editor, t:<a href='084console.mu.html#L12'>touch-event</a><span class="muRecipe"> -> </span>in-focus?:bool, editor:&:editor [ <span id="L49" class="LineNr"> 49 </span> <span class="Constant">local-scope</span> <span id="L50" class="LineNr"> 50 </span> <span class="Constant">load-ingredients</span> <span id="L51" class="LineNr"> 51 </span> <span class="muControl">return-unless</span> editor, <span class="Constant">0/false</span> @@ -119,7 +119,7 @@ if ('onhashchange' in window) { <span id="L60" class="LineNr"> 60 </span> <span class="muControl">return-if</span> too-far-right?, <span class="Constant">0/false</span> <span id="L61" class="LineNr"> 61 </span> <span class="Comment"># position cursor</span> <span id="L62" class="LineNr"> 62 </span><span class="Constant"> <move-cursor-begin></span> -<span id="L63" class="LineNr"> 63 </span> editor <span class="Special"><-</span> snap-cursor screen, editor, click-row, click-column +<span id="L63" class="LineNr"> 63 </span> editor <span class="Special"><-</span> snap-cursor <a href='081print.mu.html#L4'>screen</a>, editor, click-row, click-column <span id="L64" class="LineNr"> 64 </span> undo-coalesce-tag:num <span class="Special"><-</span> copy <span class="Constant">0/never</span> <span id="L65" class="LineNr"> 65 </span><span class="Constant"> <move-cursor-end></span> <span id="L66" class="LineNr"> 66 </span> <span class="Comment"># gain focus</span> @@ -129,17 +129,17 @@ if ('onhashchange' in window) { <span id="L70" class="LineNr"> 70 </span><span class="Comment"># Variant of 'render' that only moves the cursor (coordinates and</span> <span id="L71" class="LineNr"> 71 </span><span class="Comment"># before-cursor). If it's past the end of a line, it 'slides' it left. If it's</span> <span id="L72" class="LineNr"> 72 </span><span class="Comment"># past the last line it positions at end of last line.</span> -<span id="L73" class="LineNr"> 73 </span><span class="muRecipe">def</span> snap-cursor screen:&:screen, editor:&:editor, target-row:num, target-column:num<span class="muRecipe"> -> </span>editor:&:editor [ +<span id="L73" class="LineNr"> 73 </span><span class="muRecipe">def</span> snap-cursor <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, editor:&:editor, target-row:num, target-column:num<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L74" class="LineNr"> 74 </span> <span class="Constant">local-scope</span> <span id="L75" class="LineNr"> 75 </span> <span class="Constant">load-ingredients</span> <span id="L76" class="LineNr"> 76 </span> <span class="muControl">return-unless</span> editor <span id="L77" class="LineNr"> 77 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L78" class="LineNr"> 78 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> -<span id="L79" class="LineNr"> 79 </span> screen-height:num <span class="Special"><-</span> screen-height screen +<span id="L79" class="LineNr"> 79 </span> <a href='081print.mu.html#L594'>screen-height</a>:num <span class="Special"><-</span> <a href='081print.mu.html#L594'>screen-height</a> <a href='081print.mu.html#L4'>screen</a> <span id="L80" class="LineNr"> 80 </span> <span class="Comment"># count newlines until screen row</span> <span id="L81" class="LineNr"> 81 </span> curr:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> -<span id="L82" class="LineNr"> 82 </span> prev:&:duplex-list:char <span class="Special"><-</span> copy curr <span class="Comment"># just in case curr becomes null and we can't compute prev</span> -<span id="L83" class="LineNr"> 83 </span> curr <span class="Special"><-</span> next curr +<span id="L82" class="LineNr"> 82 </span> <a href='065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> copy curr <span class="Comment"># just in case curr becomes null and we can't compute prev</span> +<span id="L83" class="LineNr"> 83 </span> curr <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> curr <span id="L84" class="LineNr"> 84 </span> row:num <span class="Special"><-</span> copy <span class="Constant">1/top</span> <span id="L85" class="LineNr"> 85 </span> column:num <span class="Special"><-</span> copy left <span id="L86" class="LineNr"> 86 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, target-row @@ -150,7 +150,7 @@ if ('onhashchange' in window) { <span id="L91" class="LineNr"> 91 </span> <span class="Delimiter">{</span> <span id="L92" class="LineNr"> 92 </span><span class="Constant"> +next-character</span> <span id="L93" class="LineNr"> 93 </span> <span class="muControl">break-unless</span> curr -<span id="L94" class="LineNr"> 94 </span> off-screen?:bool <span class="Special"><-</span> greater-or-equal row, screen-height +<span id="L94" class="LineNr"> 94 </span> off-screen?:bool <span class="Special"><-</span> greater-or-equal row, <a href='081print.mu.html#L594'>screen-height</a> <span id="L95" class="LineNr"> 95 </span> <span class="muControl">break-if</span> off-screen? <span id="L96" class="LineNr"> 96 </span> <span class="Comment"># update editor.before-cursor</span> <span id="L97" class="LineNr"> 97 </span> <span class="Comment"># Doing so at the start of each iteration ensures it stays one step behind</span> @@ -160,7 +160,7 @@ if ('onhashchange' in window) { <span id="L101" class="LineNr"> 101 </span> <span class="muControl">break-unless</span> at-cursor-row? <span id="L102" class="LineNr"> 102 </span> at-cursor?:bool <span class="Special"><-</span> equal column, cursor-column <span id="L103" class="LineNr"> 103 </span> <span class="muControl">break-unless</span> at-cursor? -<span id="L104" class="LineNr"> 104 </span> before-cursor <span class="Special"><-</span> copy prev +<span id="L104" class="LineNr"> 104 </span> before-cursor <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L36'>prev</a> <span id="L105" class="LineNr"> 105 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor <span id="L106" class="LineNr"> 106 </span> <span class="Delimiter">}</span> <span id="L107" class="LineNr"> 107 </span> c:char <span class="Special"><-</span> get *curr, <span class="Constant">value:offset</span> @@ -176,14 +176,14 @@ if ('onhashchange' in window) { <span id="L117" class="LineNr"> 117 </span> <span class="muControl">break-unless</span> left-of-cursor? <span id="L118" class="LineNr"> 118 </span> cursor-column <span class="Special"><-</span> copy column <span id="L119" class="LineNr"> 119 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L120" class="LineNr"> 120 </span> before-cursor <span class="Special"><-</span> copy prev +<span id="L120" class="LineNr"> 120 </span> before-cursor <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L36'>prev</a> <span id="L121" class="LineNr"> 121 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor <span id="L122" class="LineNr"> 122 </span> <span class="Delimiter">}</span> <span id="L123" class="LineNr"> 123 </span> <span class="Comment"># skip to next line</span> <span id="L124" class="LineNr"> 124 </span> row <span class="Special"><-</span> add row,<span class="Constant"> 1</span> <span id="L125" class="LineNr"> 125 </span> column <span class="Special"><-</span> copy left -<span id="L126" class="LineNr"> 126 </span> curr <span class="Special"><-</span> next curr -<span id="L127" class="LineNr"> 127 </span> prev <span class="Special"><-</span> next prev +<span id="L126" class="LineNr"> 126 </span> curr <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> curr +<span id="L127" class="LineNr"> 127 </span> <a href='065duplex_list.mu.html#L36'>prev</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='065duplex_list.mu.html#L36'>prev</a> <span id="L128" class="LineNr"> 128 </span> <span class="muControl">loop</span> <span class="Constant">+next-character</span> <span id="L129" class="LineNr"> 129 </span> <span class="Delimiter">}</span> <span id="L130" class="LineNr"> 130 </span> <span class="Delimiter">{</span> @@ -196,8 +196,8 @@ if ('onhashchange' in window) { <span id="L137" class="LineNr"> 137 </span> <span class="Comment"># don't increment curr/prev</span> <span id="L138" class="LineNr"> 138 </span> <span class="muControl">loop</span> <span class="Constant">+next-character</span> <span id="L139" class="LineNr"> 139 </span> <span class="Delimiter">}</span> -<span id="L140" class="LineNr"> 140 </span> curr <span class="Special"><-</span> next curr -<span id="L141" class="LineNr"> 141 </span> prev <span class="Special"><-</span> next prev +<span id="L140" class="LineNr"> 140 </span> curr <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> curr +<span id="L141" class="LineNr"> 141 </span> <a href='065duplex_list.mu.html#L36'>prev</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='065duplex_list.mu.html#L36'>prev</a> <span id="L142" class="LineNr"> 142 </span> column <span class="Special"><-</span> add column,<span class="Constant"> 1</span> <span id="L143" class="LineNr"> 143 </span> <span class="muControl">loop</span> <span id="L144" class="LineNr"> 144 </span> <span class="Delimiter">}</span> @@ -213,19 +213,19 @@ if ('onhashchange' in window) { <span id="L154" class="LineNr"> 154 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row <span id="L155" class="LineNr"> 155 </span> cursor-column <span class="Special"><-</span> copy column <span id="L156" class="LineNr"> 156 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L157" class="LineNr"> 157 </span> before-cursor <span class="Special"><-</span> copy prev +<span id="L157" class="LineNr"> 157 </span> before-cursor <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L36'>prev</a> <span id="L158" class="LineNr"> 158 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor <span id="L159" class="LineNr"> 159 </span> <span class="Delimiter">}</span> <span id="L160" class="LineNr"> 160 </span>] <span id="L161" class="LineNr"> 161 </span> <span id="L162" class="LineNr"> 162 </span><span class="Comment"># Process an event 'e' and try to minimally update the screen.</span> <span id="L163" class="LineNr"> 163 </span><span class="Comment"># Set 'go-render?' to true to indicate the caller must perform a non-minimal update.</span> -<span id="L164" class="LineNr"> 164 </span><span class="muRecipe">def</span> handle-keyboard-event screen:&:screen, editor:&:editor, e:event<span class="muRecipe"> -> </span>go-render?:bool, screen:&:screen, editor:&:editor [ +<span id="L164" class="LineNr"> 164 </span><span class="muRecipe">def</span> handle-keyboard-event <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, editor:&:editor, e:<a href='084console.mu.html#L4'>event</a><span class="muRecipe"> -> </span>go-render?:bool, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, editor:&:editor [ <span id="L165" class="LineNr"> 165 </span> <span class="Constant">local-scope</span> <span id="L166" class="LineNr"> 166 </span> <span class="Constant">load-ingredients</span> <span id="L167" class="LineNr"> 167 </span> <span class="muControl">return-unless</span> editor, <span class="Constant">0/don't-render</span> -<span id="L168" class="LineNr"> 168 </span> screen-width:num <span class="Special"><-</span> screen-width screen -<span id="L169" class="LineNr"> 169 </span> screen-height:num <span class="Special"><-</span> screen-height screen +<span id="L168" class="LineNr"> 168 </span> <a href='081print.mu.html#L581'>screen-width</a>:num <span class="Special"><-</span> <a href='081print.mu.html#L581'>screen-width</a> <a href='081print.mu.html#L4'>screen</a> +<span id="L169" class="LineNr"> 169 </span> <a href='081print.mu.html#L594'>screen-height</a>:num <span class="Special"><-</span> <a href='081print.mu.html#L594'>screen-height</a> <a href='081print.mu.html#L4'>screen</a> <span id="L170" class="LineNr"> 170 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L171" class="LineNr"> 171 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L172" class="LineNr"> 172 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> @@ -245,24 +245,24 @@ if ('onhashchange' in window) { <span id="L186" class="LineNr"> 186 </span> <span class="muControl">return-unless</span> regular-character?, <span class="Constant">0/don't-render</span> <span id="L187" class="LineNr"> 187 </span> <span class="Comment"># otherwise type it in</span> <span id="L188" class="LineNr"> 188 </span><span class="Constant"> <insert-character-begin></span> -<span id="L189" class="LineNr"> 189 </span> go-render? <span class="Special"><-</span> insert-at-cursor editor, c, screen +<span id="L189" class="LineNr"> 189 </span> go-render? <span class="Special"><-</span> insert-at-cursor editor, c, <a href='081print.mu.html#L4'>screen</a> <span id="L190" class="LineNr"> 190 </span><span class="Constant"> <insert-character-end></span> <span id="L191" class="LineNr"> 191 </span> <span class="muControl">return</span> <span id="L192" class="LineNr"> 192 </span> <span class="Delimiter">}</span> <span id="L193" class="LineNr"> 193 </span> <span class="Comment"># special key to modify the text or move the cursor</span> -<span id="L194" class="LineNr"> 194 </span> k:num, is-keycode?:bool <span class="Special"><-</span> maybe-convert e:event, <span class="Constant">keycode:variant</span> +<span id="L194" class="LineNr"> 194 </span> k:num, is-keycode?:bool <span class="Special"><-</span> maybe-convert e:<a href='084console.mu.html#L4'>event</a>, <span class="Constant">keycode:variant</span> <span id="L195" class="LineNr"> 195 </span> assert is-keycode?, <span class="Constant">[event was of unknown type; neither keyboard nor mouse]</span> <span id="L196" class="LineNr"> 196 </span> <span class="Comment"># handlers for each special key will go here</span> <span id="L197" class="LineNr"> 197 </span><span class="Constant"> <handle-special-key></span> <span id="L198" class="LineNr"> 198 </span> <span class="muControl">return</span> <span class="Constant">1/go-render</span> <span id="L199" class="LineNr"> 199 </span>] <span id="L200" class="LineNr"> 200 </span> -<span id="L201" class="LineNr"> 201 </span><span class="muRecipe">def</span> insert-at-cursor editor:&:editor, c:char, screen:&:screen<span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor, screen:&:screen [ +<span id="L201" class="LineNr"> 201 </span><span class="muRecipe">def</span> insert-at-cursor editor:&:editor, c:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L202" class="LineNr"> 202 </span> <span class="Constant">local-scope</span> <span id="L203" class="LineNr"> 203 </span> <span class="Constant">load-ingredients</span> <span id="L204" class="LineNr"> 204 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L205" class="LineNr"> 205 </span> insert c, before-cursor -<span id="L206" class="LineNr"> 206 </span> before-cursor <span class="Special"><-</span> next before-cursor +<span id="L206" class="LineNr"> 206 </span> before-cursor <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L207" class="LineNr"> 207 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor <span id="L208" class="LineNr"> 208 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L209" class="LineNr"> 209 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> @@ -270,34 +270,34 @@ if ('onhashchange' in window) { <span id="L211" class="LineNr"> 211 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L212" class="LineNr"> 212 </span> save-row:num <span class="Special"><-</span> copy cursor-row <span id="L213" class="LineNr"> 213 </span> save-column:num <span class="Special"><-</span> copy cursor-column -<span id="L214" class="LineNr"> 214 </span> screen-width:num <span class="Special"><-</span> screen-width screen -<span id="L215" class="LineNr"> 215 </span> screen-height:num <span class="Special"><-</span> screen-height screen +<span id="L214" class="LineNr"> 214 </span> <a href='081print.mu.html#L581'>screen-width</a>:num <span class="Special"><-</span> <a href='081print.mu.html#L581'>screen-width</a> <a href='081print.mu.html#L4'>screen</a> +<span id="L215" class="LineNr"> 215 </span> <a href='081print.mu.html#L594'>screen-height</a>:num <span class="Special"><-</span> <a href='081print.mu.html#L594'>screen-height</a> <a href='081print.mu.html#L4'>screen</a> <span id="L216" class="LineNr"> 216 </span> <span class="Comment"># occasionally we'll need to mess with the cursor</span> <span id="L217" class="LineNr"> 217 </span><span class="Constant"> <insert-character-special-case></span> <span id="L218" class="LineNr"> 218 </span> <span class="Comment"># but mostly we'll just move the cursor right</span> <span id="L219" class="LineNr"> 219 </span> cursor-column <span class="Special"><-</span> add cursor-column,<span class="Constant"> 1</span> <span id="L220" class="LineNr"> 220 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L221" class="LineNr"> 221 </span> next:&:duplex-list:char <span class="Special"><-</span> next before-cursor +<span id="L221" class="LineNr"> 221 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L222" class="LineNr"> 222 </span> <span class="Delimiter">{</span> <span id="L223" class="LineNr"> 223 </span> <span class="Comment"># at end of all text? no need to scroll? just print the character and leave</span> -<span id="L224" class="LineNr"> 224 </span> at-end?:bool <span class="Special"><-</span> equal next, <span class="Constant">0/null</span> +<span id="L224" class="LineNr"> 224 </span> at-end?:bool <span class="Special"><-</span> equal <a href='065duplex_list.mu.html#L29'>next</a>, <span class="Constant">0/null</span> <span id="L225" class="LineNr"> 225 </span> <span class="muControl">break-unless</span> at-end? -<span id="L226" class="LineNr"> 226 </span> bottom:num <span class="Special"><-</span> subtract screen-height,<span class="Constant"> 1</span> +<span id="L226" class="LineNr"> 226 </span> bottom:num <span class="Special"><-</span> subtract <a href='081print.mu.html#L594'>screen-height</a>,<span class="Constant"> 1</span> <span id="L227" class="LineNr"> 227 </span> at-bottom?:bool <span class="Special"><-</span> equal save-row, bottom <span id="L228" class="LineNr"> 228 </span> at-right?:bool <span class="Special"><-</span> equal save-column, right <span id="L229" class="LineNr"> 229 </span> overflow?:bool <span class="Special"><-</span> and at-bottom?, at-right? <span id="L230" class="LineNr"> 230 </span> <span class="muControl">break-if</span> overflow? -<span id="L231" class="LineNr"> 231 </span> move-cursor screen, save-row, save-column -<span id="L232" class="LineNr"> 232 </span> print screen, c +<span id="L231" class="LineNr"> 231 </span> <a href='081print.mu.html#L442'>move-cursor</a> <a href='081print.mu.html#L4'>screen</a>, save-row, save-column +<span id="L232" class="LineNr"> 232 </span> print <a href='081print.mu.html#L4'>screen</a>, c <span id="L233" class="LineNr"> 233 </span> <span class="muControl">return</span> <span class="Constant">0/don't-render</span> <span id="L234" class="LineNr"> 234 </span> <span class="Delimiter">}</span> <span id="L235" class="LineNr"> 235 </span> <span class="Delimiter">{</span> <span id="L236" class="LineNr"> 236 </span> <span class="Comment"># not at right margin? print the character and rest of line</span> -<span id="L237" class="LineNr"> 237 </span> <span class="muControl">break-unless</span> next -<span id="L238" class="LineNr"> 238 </span> at-right?:bool <span class="Special"><-</span> greater-or-equal cursor-column, screen-width +<span id="L237" class="LineNr"> 237 </span> <span class="muControl">break-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> +<span id="L238" class="LineNr"> 238 </span> at-right?:bool <span class="Special"><-</span> greater-or-equal cursor-column, <a href='081print.mu.html#L581'>screen-width</a> <span id="L239" class="LineNr"> 239 </span> <span class="muControl">break-if</span> at-right? <span id="L240" class="LineNr"> 240 </span> curr:&:duplex-list:char <span class="Special"><-</span> copy before-cursor -<span id="L241" class="LineNr"> 241 </span> move-cursor screen, save-row, save-column +<span id="L241" class="LineNr"> 241 </span> <a href='081print.mu.html#L442'>move-cursor</a> <a href='081print.mu.html#L4'>screen</a>, save-row, save-column <span id="L242" class="LineNr"> 242 </span> curr-column:num <span class="Special"><-</span> copy save-column <span id="L243" class="LineNr"> 243 </span> <span class="Delimiter">{</span> <span id="L244" class="LineNr"> 244 </span> <span class="Comment"># hit right margin? give up and let caller render</span> @@ -308,9 +308,9 @@ if ('onhashchange' in window) { <span id="L249" class="LineNr"> 249 </span> currc:char <span class="Special"><-</span> get *curr, <span class="Constant">value:offset</span> <span id="L250" class="LineNr"> 250 </span> at-newline?:bool <span class="Special"><-</span> equal currc, <span class="Constant">10/newline</span> <span id="L251" class="LineNr"> 251 </span> <span class="muControl">break-if</span> at-newline? -<span id="L252" class="LineNr"> 252 </span> print screen, currc +<span id="L252" class="LineNr"> 252 </span> print <a href='081print.mu.html#L4'>screen</a>, currc <span id="L253" class="LineNr"> 253 </span> curr-column <span class="Special"><-</span> add curr-column,<span class="Constant"> 1</span> -<span id="L254" class="LineNr"> 254 </span> curr <span class="Special"><-</span> next curr +<span id="L254" class="LineNr"> 254 </span> curr <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> curr <span id="L255" class="LineNr"> 255 </span> <span class="muControl">loop</span> <span id="L256" class="LineNr"> 256 </span> <span class="Delimiter">}</span> <span id="L257" class="LineNr"> 257 </span> <span class="muControl">return</span> <span class="Constant">0/don't-render</span> @@ -319,27 +319,27 @@ if ('onhashchange' in window) { <span id="L260" class="LineNr"> 260 </span>] <span id="L261" class="LineNr"> 261 </span> <span id="L262" class="LineNr"> 262 </span><span class="Comment"># helper for tests</span> -<span id="L263" class="LineNr"> 263 </span><span class="muRecipe">def</span> editor-render screen:&:screen, editor:&:editor<span class="muRecipe"> -> </span>screen:&:screen, editor:&:editor [ +<span id="L263" class="LineNr"> 263 </span><span class="muRecipe">def</span> editor-render <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, editor:&:editor<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, editor:&:editor [ <span id="L264" class="LineNr"> 264 </span> <span class="Constant">local-scope</span> <span id="L265" class="LineNr"> 265 </span> <span class="Constant">load-ingredients</span> <span id="L266" class="LineNr"> 266 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L267" class="LineNr"> 267 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> -<span id="L268" class="LineNr"> 268 </span> row:num, column:num <span class="Special"><-</span> render screen, editor -<span id="L269" class="LineNr"> 269 </span> clear-line-until screen, right +<span id="L268" class="LineNr"> 268 </span> row:num, column:num <span class="Special"><-</span> render <a href='081print.mu.html#L4'>screen</a>, editor +<span id="L269" class="LineNr"> 269 </span> <a href='081print.mu.html#L408'>clear-line-until</a> <a href='081print.mu.html#L4'>screen</a>, right <span id="L270" class="LineNr"> 270 </span> row <span class="Special"><-</span> add row,<span class="Constant"> 1</span> -<span id="L271" class="LineNr"> 271 </span> draw-horizontal screen, row, left, right, <span class="Constant">9480/horizontal-dotted</span> +<span id="L271" class="LineNr"> 271 </span> draw-horizontal <a href='081print.mu.html#L4'>screen</a>, row, left, right, <span class="Constant">9480/horizontal-dotted</span> <span id="L272" class="LineNr"> 272 </span> row <span class="Special"><-</span> add row,<span class="Constant"> 1</span> -<span id="L273" class="LineNr"> 273 </span> clear-screen-from screen, row, left, left, right +<span id="L273" class="LineNr"> 273 </span> clear-screen-from <a href='081print.mu.html#L4'>screen</a>, row, left, left, right <span id="L274" class="LineNr"> 274 </span>] <span id="L275" class="LineNr"> 275 </span> <span id="L276" class="LineNr"> 276 </span><span class="muScenario">scenario</span> editor-handles-empty-event-queue [ <span id="L277" class="LineNr"> 277 </span> <span class="Constant">local-scope</span> <span id="L278" class="LineNr"> 278 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L279" class="LineNr"> 279 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abc]</span>, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> -<span id="L280" class="LineNr"> 280 </span> editor-render screen, e +<span id="L280" class="LineNr"> 280 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L281" class="LineNr"> 281 </span> assume-console <span class="Constant">[]</span> <span id="L282" class="LineNr"> 282 </span> run [ -<span id="L283" class="LineNr"> 283 </span> editor-event-loop screen, console, e +<span id="L283" class="LineNr"> 283 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L284" class="LineNr"> 284 </span> ] <span id="L285" class="LineNr"> 285 </span> screen-should-contain [ <span id="L286" class="LineNr"> 286 </span> <span class="Constant"> . .</span> @@ -353,13 +353,13 @@ if ('onhashchange' in window) { <span id="L294" class="LineNr"> 294 </span> <span class="Constant">local-scope</span> <span id="L295" class="LineNr"> 295 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L296" class="LineNr"> 296 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abc]</span>, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> -<span id="L297" class="LineNr"> 297 </span> editor-render screen, e +<span id="L297" class="LineNr"> 297 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L298" class="LineNr"> 298 </span> $clear-trace <span id="L299" class="LineNr"> 299 </span> assume-console [ <span id="L300" class="LineNr"> 300 </span> left-click<span class="Constant"> 1</span>,<span class="Constant"> 1</span> <span class="Comment"># on the 'b'</span> <span id="L301" class="LineNr"> 301 </span> ] <span id="L302" class="LineNr"> 302 </span> run [ -<span id="L303" class="LineNr"> 303 </span> editor-event-loop screen, console, e +<span id="L303" class="LineNr"> 303 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L304" class="LineNr"> 304 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L305" class="LineNr"> 305 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L306" class="LineNr"> 306 </span> ] @@ -385,7 +385,7 @@ if ('onhashchange' in window) { <span id="L326" class="LineNr"> 326 </span> left-click<span class="Constant"> 1</span>,<span class="Constant"> 7</span> <span class="Comment"># last line, to the right of text</span> <span id="L327" class="LineNr"> 327 </span> ] <span id="L328" class="LineNr"> 328 </span> run [ -<span id="L329" class="LineNr"> 329 </span> editor-event-loop screen, console, e +<span id="L329" class="LineNr"> 329 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L330" class="LineNr"> 330 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L331" class="LineNr"> 331 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L332" class="LineNr"> 332 </span> ] @@ -407,7 +407,7 @@ if ('onhashchange' in window) { <span id="L348" class="LineNr"> 348 </span> left-click<span class="Constant"> 1</span>,<span class="Constant"> 7</span> <span class="Comment"># interior line, to the right of text</span> <span id="L349" class="LineNr"> 349 </span> ] <span id="L350" class="LineNr"> 350 </span> run [ -<span id="L351" class="LineNr"> 351 </span> editor-event-loop screen, console, e +<span id="L351" class="LineNr"> 351 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L352" class="LineNr"> 352 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L353" class="LineNr"> 353 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L354" class="LineNr"> 354 </span> ] @@ -429,7 +429,7 @@ if ('onhashchange' in window) { <span id="L370" class="LineNr"> 370 </span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 7</span> <span class="Comment"># below text</span> <span id="L371" class="LineNr"> 371 </span> ] <span id="L372" class="LineNr"> 372 </span> run [ -<span id="L373" class="LineNr"> 373 </span> editor-event-loop screen, console, e +<span id="L373" class="LineNr"> 373 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L374" class="LineNr"> 374 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L375" class="LineNr"> 375 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L376" class="LineNr"> 376 </span> ] @@ -445,14 +445,14 @@ if ('onhashchange' in window) { <span id="L386" class="LineNr"> 386 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L387" class="LineNr"> 387 </span> <span class="Comment"># editor occupies only left half of screen</span> <span id="L388" class="LineNr"> 388 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abc]</span>, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> -<span id="L389" class="LineNr"> 389 </span> editor-render screen, e +<span id="L389" class="LineNr"> 389 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L390" class="LineNr"> 390 </span> $clear-trace <span id="L391" class="LineNr"> 391 </span> assume-console [ <span id="L392" class="LineNr"> 392 </span> <span class="Comment"># click on right half of screen</span> <span id="L393" class="LineNr"> 393 </span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 8</span> <span id="L394" class="LineNr"> 394 </span> ] <span id="L395" class="LineNr"> 395 </span> run [ -<span id="L396" class="LineNr"> 396 </span> editor-event-loop screen, console, e +<span id="L396" class="LineNr"> 396 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L397" class="LineNr"> 397 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L398" class="LineNr"> 398 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L399" class="LineNr"> 399 </span> ] @@ -473,14 +473,14 @@ if ('onhashchange' in window) { <span id="L414" class="LineNr"> 414 </span> <span class="Constant">local-scope</span> <span id="L415" class="LineNr"> 415 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L416" class="LineNr"> 416 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abc]</span>, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> -<span id="L417" class="LineNr"> 417 </span> editor-render screen, e +<span id="L417" class="LineNr"> 417 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L418" class="LineNr"> 418 </span> $clear-trace <span id="L419" class="LineNr"> 419 </span> assume-console [ <span id="L420" class="LineNr"> 420 </span> <span class="Comment"># click on first, 'menu' row</span> <span id="L421" class="LineNr"> 421 </span> left-click<span class="Constant"> 0</span>,<span class="Constant"> 3</span> <span id="L422" class="LineNr"> 422 </span> ] <span id="L423" class="LineNr"> 423 </span> run [ -<span id="L424" class="LineNr"> 424 </span> editor-event-loop screen, console, e +<span id="L424" class="LineNr"> 424 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L425" class="LineNr"> 425 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L426" class="LineNr"> 426 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L427" class="LineNr"> 427 </span> ] @@ -495,13 +495,13 @@ if ('onhashchange' in window) { <span id="L436" class="LineNr"> 436 </span> <span class="Constant">local-scope</span> <span id="L437" class="LineNr"> 437 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L438" class="LineNr"> 438 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[]</span>, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> -<span id="L439" class="LineNr"> 439 </span> editor-render screen, e +<span id="L439" class="LineNr"> 439 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L440" class="LineNr"> 440 </span> $clear-trace <span id="L441" class="LineNr"> 441 </span> assume-console [ <span id="L442" class="LineNr"> 442 </span> type <span class="Constant">[abc]</span> <span id="L443" class="LineNr"> 443 </span> ] <span id="L444" class="LineNr"> 444 </span> run [ -<span id="L445" class="LineNr"> 445 </span> editor-event-loop screen, console, e +<span id="L445" class="LineNr"> 445 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L446" class="LineNr"> 446 </span> ] <span id="L447" class="LineNr"> 447 </span> screen-should-contain [ <span id="L448" class="LineNr"> 448 </span> <span class="Constant"> . .</span> @@ -516,7 +516,7 @@ if ('onhashchange' in window) { <span id="L457" class="LineNr"> 457 </span> <span class="Constant">local-scope</span> <span id="L458" class="LineNr"> 458 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L459" class="LineNr"> 459 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abc]</span>, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> -<span id="L460" class="LineNr"> 460 </span> editor-render screen, e +<span id="L460" class="LineNr"> 460 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L461" class="LineNr"> 461 </span> $clear-trace <span id="L462" class="LineNr"> 462 </span> <span class="Comment"># type two letters at different places</span> <span id="L463" class="LineNr"> 463 </span> assume-console [ @@ -525,7 +525,7 @@ if ('onhashchange' in window) { <span id="L466" class="LineNr"> 466 </span> type <span class="Constant">[d]</span> <span id="L467" class="LineNr"> 467 </span> ] <span id="L468" class="LineNr"> 468 </span> run [ -<span id="L469" class="LineNr"> 469 </span> editor-event-loop screen, console, e +<span id="L469" class="LineNr"> 469 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L470" class="LineNr"> 470 </span> ] <span id="L471" class="LineNr"> 471 </span> screen-should-contain [ <span id="L472" class="LineNr"> 472 </span> <span class="Constant"> . .</span> @@ -540,14 +540,14 @@ if ('onhashchange' in window) { <span id="L481" class="LineNr"> 481 </span> <span class="Constant">local-scope</span> <span id="L482" class="LineNr"> 482 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L483" class="LineNr"> 483 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abc]</span>, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> -<span id="L484" class="LineNr"> 484 </span> editor-render screen, e +<span id="L484" class="LineNr"> 484 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L485" class="LineNr"> 485 </span> $clear-trace <span id="L486" class="LineNr"> 486 </span> assume-console [ <span id="L487" class="LineNr"> 487 </span> left-click<span class="Constant"> 1</span>,<span class="Constant"> 5</span> <span class="Comment"># right of last line</span> <span id="L488" class="LineNr"> 488 </span> type <span class="Constant">[d]</span> <span id="L489" class="LineNr"> 489 </span> ] <span id="L490" class="LineNr"> 490 </span> run [ -<span id="L491" class="LineNr"> 491 </span> editor-event-loop screen, console, e +<span id="L491" class="LineNr"> 491 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L492" class="LineNr"> 492 </span> ] <span id="L493" class="LineNr"> 493 </span> screen-should-contain [ <span id="L494" class="LineNr"> 494 </span> <span class="Constant"> . .</span> @@ -564,14 +564,14 @@ if ('onhashchange' in window) { <span id="L505" class="LineNr"> 505 </span> s:text <span class="Special"><-</span> new <span class="Constant">[abc</span> <span id="L506" class="LineNr"> 506 </span><span class="Constant">d]</span> <span id="L507" class="LineNr"> 507 </span> e:&:editor <span class="Special"><-</span> new-editor s, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> -<span id="L508" class="LineNr"> 508 </span> editor-render screen, e +<span id="L508" class="LineNr"> 508 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L509" class="LineNr"> 509 </span> $clear-trace <span id="L510" class="LineNr"> 510 </span> assume-console [ <span id="L511" class="LineNr"> 511 </span> left-click<span class="Constant"> 1</span>,<span class="Constant"> 5</span> <span class="Comment"># right of non-last line</span> <span id="L512" class="LineNr"> 512 </span> type <span class="Constant">[e]</span> <span id="L513" class="LineNr"> 513 </span> ] <span id="L514" class="LineNr"> 514 </span> run [ -<span id="L515" class="LineNr"> 515 </span> editor-event-loop screen, console, e +<span id="L515" class="LineNr"> 515 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L516" class="LineNr"> 516 </span> ] <span id="L517" class="LineNr"> 517 </span> screen-should-contain [ <span id="L518" class="LineNr"> 518 </span> <span class="Constant"> . .</span> @@ -587,14 +587,14 @@ if ('onhashchange' in window) { <span id="L528" class="LineNr"> 528 </span> <span class="Constant">local-scope</span> <span id="L529" class="LineNr"> 529 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L530" class="LineNr"> 530 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abc]</span>, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> -<span id="L531" class="LineNr"> 531 </span> editor-render screen, e +<span id="L531" class="LineNr"> 531 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L532" class="LineNr"> 532 </span> $clear-trace <span id="L533" class="LineNr"> 533 </span> assume-console [ <span id="L534" class="LineNr"> 534 </span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 5</span> <span class="Comment"># below all text</span> <span id="L535" class="LineNr"> 535 </span> type <span class="Constant">[d]</span> <span id="L536" class="LineNr"> 536 </span> ] <span id="L537" class="LineNr"> 537 </span> run [ -<span id="L538" class="LineNr"> 538 </span> editor-event-loop screen, console, e +<span id="L538" class="LineNr"> 538 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L539" class="LineNr"> 539 </span> ] <span id="L540" class="LineNr"> 540 </span> screen-should-contain [ <span id="L541" class="LineNr"> 541 </span> <span class="Constant"> . .</span> @@ -611,14 +611,14 @@ if ('onhashchange' in window) { <span id="L552" class="LineNr"> 552 </span> s:text <span class="Special"><-</span> new <span class="Constant">[abc</span> <span id="L553" class="LineNr"> 553 </span><span class="Constant">d]</span> <span id="L554" class="LineNr"> 554 </span> e:&:editor <span class="Special"><-</span> new-editor s, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> -<span id="L555" class="LineNr"> 555 </span> editor-render screen, e +<span id="L555" class="LineNr"> 555 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L556" class="LineNr"> 556 </span> $clear-trace <span id="L557" class="LineNr"> 557 </span> assume-console [ <span id="L558" class="LineNr"> 558 </span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 5</span> <span class="Comment"># below all text</span> <span id="L559" class="LineNr"> 559 </span> type <span class="Constant">[e]</span> <span id="L560" class="LineNr"> 560 </span> ] <span id="L561" class="LineNr"> 561 </span> run [ -<span id="L562" class="LineNr"> 562 </span> editor-event-loop screen, console, e +<span id="L562" class="LineNr"> 562 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L563" class="LineNr"> 563 </span> ] <span id="L564" class="LineNr"> 564 </span> screen-should-contain [ <span id="L565" class="LineNr"> 565 </span> <span class="Constant"> . .</span> @@ -636,14 +636,14 @@ if ('onhashchange' in window) { <span id="L577" class="LineNr"> 577 </span> s:text <span class="Special"><-</span> new <span class="Constant">[abc</span> <span id="L578" class="LineNr"> 578 </span><span class="Constant">d]</span> <span id="L579" class="LineNr"> 579 </span> e:&:editor <span class="Special"><-</span> new-editor s, <span class="Constant">0/left</span>, <span class="Constant">10/right</span> -<span id="L580" class="LineNr"> 580 </span> editor-render screen, e +<span id="L580" class="LineNr"> 580 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L581" class="LineNr"> 581 </span> $clear-trace <span id="L582" class="LineNr"> 582 </span> assume-console [ <span id="L583" class="LineNr"> 583 </span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 5</span> <span class="Comment"># below all text</span> <span id="L584" class="LineNr"> 584 </span> type <span class="Constant">[ef]</span> <span id="L585" class="LineNr"> 585 </span> ] <span id="L586" class="LineNr"> 586 </span> run [ -<span id="L587" class="LineNr"> 587 </span> editor-event-loop screen, console, e +<span id="L587" class="LineNr"> 587 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L588" class="LineNr"> 588 </span> ] <span id="L589" class="LineNr"> 589 </span> screen-should-contain [ <span id="L590" class="LineNr"> 590 </span> <span class="Constant"> . .</span> @@ -659,12 +659,12 @@ if ('onhashchange' in window) { <span id="L600" class="LineNr"> 600 </span> <span class="Constant">local-scope</span> <span id="L601" class="LineNr"> 601 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L602" class="LineNr"> 602 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[ab]</span>, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> -<span id="L603" class="LineNr"> 603 </span> editor-render screen, e +<span id="L603" class="LineNr"> 603 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L604" class="LineNr"> 604 </span> assume-console [ <span id="L605" class="LineNr"> 605 </span> type <span class="Constant">[01]</span> <span id="L606" class="LineNr"> 606 </span> ] <span id="L607" class="LineNr"> 607 </span> run [ -<span id="L608" class="LineNr"> 608 </span> editor-event-loop screen, console, e +<span id="L608" class="LineNr"> 608 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L609" class="LineNr"> 609 </span> ] <span id="L610" class="LineNr"> 610 </span> screen-should-contain [ <span id="L611" class="LineNr"> 611 </span> <span class="Constant"> . .</span> @@ -680,13 +680,13 @@ if ('onhashchange' in window) { <span id="L621" class="LineNr"> 621 </span> <span class="Constant">local-scope</span> <span id="L622" class="LineNr"> 622 </span> assume-screen <span class="Constant">5/width</span>, <span class="Constant">5/height</span> <span id="L623" class="LineNr"> 623 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abc]</span>, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> -<span id="L624" class="LineNr"> 624 </span> editor-render screen, e +<span id="L624" class="LineNr"> 624 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L625" class="LineNr"> 625 </span> <span class="Comment"># type a letter</span> <span id="L626" class="LineNr"> 626 </span> assume-console [ <span id="L627" class="LineNr"> 627 </span> type <span class="Constant">[e]</span> <span id="L628" class="LineNr"> 628 </span> ] <span id="L629" class="LineNr"> 629 </span> run [ -<span id="L630" class="LineNr"> 630 </span> editor-event-loop screen, console, e +<span id="L630" class="LineNr"> 630 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L631" class="LineNr"> 631 </span> ] <span id="L632" class="LineNr"> 632 </span> <span class="Comment"># no wrap yet</span> <span id="L633" class="LineNr"> 633 </span> screen-should-contain [ @@ -701,7 +701,7 @@ if ('onhashchange' in window) { <span id="L642" class="LineNr"> 642 </span> type <span class="Constant">[f]</span> <span id="L643" class="LineNr"> 643 </span> ] <span id="L644" class="LineNr"> 644 </span> run [ -<span id="L645" class="LineNr"> 645 </span> editor-event-loop screen, console, e +<span id="L645" class="LineNr"> 645 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L646" class="LineNr"> 646 </span> ] <span id="L647" class="LineNr"> 647 </span> <span class="Comment"># now wrap</span> <span id="L648" class="LineNr"> 648 </span> screen-should-contain [ @@ -720,14 +720,14 @@ if ('onhashchange' in window) { <span id="L661" class="LineNr"> 661 </span> s:text <span class="Special"><-</span> new <span class="Constant">[abcdefg</span> <span id="L662" class="LineNr"> 662 </span><span class="Constant">defg]</span> <span id="L663" class="LineNr"> 663 </span> e:&:editor <span class="Special"><-</span> new-editor s, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> -<span id="L664" class="LineNr"> 664 </span> editor-render screen, e +<span id="L664" class="LineNr"> 664 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L665" class="LineNr"> 665 </span> <span class="Comment"># type more text at the start</span> <span id="L666" class="LineNr"> 666 </span> assume-console [ <span id="L667" class="LineNr"> 667 </span> left-click<span class="Constant"> 3</span>,<span class="Constant"> 0</span> <span id="L668" class="LineNr"> 668 </span> type <span class="Constant">[abc]</span> <span id="L669" class="LineNr"> 669 </span> ] <span id="L670" class="LineNr"> 670 </span> run [ -<span id="L671" class="LineNr"> 671 </span> editor-event-loop screen, console, e +<span id="L671" class="LineNr"> 671 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L672" class="LineNr"> 672 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L673" class="LineNr"> 673 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L674" class="LineNr"> 674 </span> ] @@ -756,9 +756,9 @@ if ('onhashchange' in window) { <span id="L697" class="LineNr"> 697 </span> before-wrap-column:num <span class="Special"><-</span> subtract wrap-column,<span class="Constant"> 1</span> <span id="L698" class="LineNr"> 698 </span> at-wrap?:bool <span class="Special"><-</span> greater-or-equal cursor-column, wrap-column <span id="L699" class="LineNr"> 699 </span> just-before-wrap?:bool <span class="Special"><-</span> greater-or-equal cursor-column, before-wrap-column -<span id="L700" class="LineNr"> 700 </span> next:&:duplex-list:char <span class="Special"><-</span> next before-cursor +<span id="L700" class="LineNr"> 700 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L701" class="LineNr"> 701 </span> <span class="Comment"># at end of line? next == 0 || next.value == 10/newline</span> -<span id="L702" class="LineNr"> 702 </span> at-end-of-line?:bool <span class="Special"><-</span> equal next,<span class="Constant"> 0</span> +<span id="L702" class="LineNr"> 702 </span> at-end-of-line?:bool <span class="Special"><-</span> equal <a href='065duplex_list.mu.html#L29'>next</a>,<span class="Constant"> 0</span> <span id="L703" class="LineNr"> 703 </span> <span class="Delimiter">{</span> <span id="L704" class="LineNr"> 704 </span> <span class="muControl">break-if</span> at-end-of-line? <span id="L705" class="LineNr"> 705 </span> next-character:char <span class="Special"><-</span> get *next, <span class="Constant">value:offset</span> @@ -788,7 +788,7 @@ if ('onhashchange' in window) { <span id="L729" class="LineNr"> 729 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row <span id="L730" class="LineNr"> 730 </span> <span class="Comment"># if we're out of the screen, scroll down</span> <span id="L731" class="LineNr"> 731 </span> <span class="Delimiter">{</span> -<span id="L732" class="LineNr"> 732 </span> below-screen?:bool <span class="Special"><-</span> greater-or-equal cursor-row, screen-height +<span id="L732" class="LineNr"> 732 </span> below-screen?:bool <span class="Special"><-</span> greater-or-equal cursor-row, <a href='081print.mu.html#L594'>screen-height</a> <span id="L733" class="LineNr"> 733 </span> <span class="muControl">break-unless</span> below-screen? <span id="L734" class="LineNr"> 734 </span><span class="Constant"> <scroll-down></span> <span id="L735" class="LineNr"> 735 </span> <span class="Delimiter">}</span> @@ -805,7 +805,7 @@ if ('onhashchange' in window) { <span id="L746" class="LineNr"> 746 </span> type <span class="Constant">[f]</span> <span id="L747" class="LineNr"> 747 </span> ] <span id="L748" class="LineNr"> 748 </span> run [ -<span id="L749" class="LineNr"> 749 </span> editor-event-loop screen, console, e +<span id="L749" class="LineNr"> 749 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L750" class="LineNr"> 750 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L751" class="LineNr"> 751 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L752" class="LineNr"> 752 </span> ] @@ -829,7 +829,7 @@ if ('onhashchange' in window) { <span id="L770" class="LineNr"> 770 </span> s:text <span class="Special"><-</span> new <span class="Constant">[abc</span> <span id="L771" class="LineNr"> 771 </span><span class="Constant">xyz]</span> <span id="L772" class="LineNr"> 772 </span> e:&:editor <span class="Special"><-</span> new-editor s, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> -<span id="L773" class="LineNr"> 773 </span> editor-render screen, e +<span id="L773" class="LineNr"> 773 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L774" class="LineNr"> 774 </span> screen-should-contain [ <span id="L775" class="LineNr"> 775 </span> <span class="Constant"> . .</span> <span id="L776" class="LineNr"> 776 </span> <span class="Constant"> .abc .</span> @@ -842,7 +842,7 @@ if ('onhashchange' in window) { <span id="L783" class="LineNr"> 783 </span> type <span class="Constant">[de]</span> <span class="Comment"># trigger wrap</span> <span id="L784" class="LineNr"> 784 </span> ] <span id="L785" class="LineNr"> 785 </span> run [ -<span id="L786" class="LineNr"> 786 </span> editor-event-loop screen, console, e +<span id="L786" class="LineNr"> 786 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L787" class="LineNr"> 787 </span> ] <span id="L788" class="LineNr"> 788 </span> screen-should-contain [ <span id="L789" class="LineNr"> 789 </span> <span class="Constant"> . .</span> @@ -862,7 +862,7 @@ if ('onhashchange' in window) { <span id="L803" class="LineNr"> 803 </span> type <span class="Constant">[01]</span> <span id="L804" class="LineNr"> 804 </span> ] <span id="L805" class="LineNr"> 805 </span> run [ -<span id="L806" class="LineNr"> 806 </span> editor-event-loop screen, console, e +<span id="L806" class="LineNr"> 806 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L807" class="LineNr"> 807 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L808" class="LineNr"> 808 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L809" class="LineNr"> 809 </span> ] @@ -898,7 +898,7 @@ if ('onhashchange' in window) { <span id="L839" class="LineNr"> 839 </span><span class="Constant">1]</span> <span id="L840" class="LineNr"> 840 </span> ] <span id="L841" class="LineNr"> 841 </span> run [ -<span id="L842" class="LineNr"> 842 </span> editor-event-loop screen, console, e +<span id="L842" class="LineNr"> 842 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L843" class="LineNr"> 843 </span> ] <span id="L844" class="LineNr"> 844 </span> screen-should-contain [ <span id="L845" class="LineNr"> 845 </span> <span class="Constant"> . .</span> @@ -914,13 +914,13 @@ if ('onhashchange' in window) { <span id="L855" class="LineNr"> 855 </span> newline?:bool <span class="Special"><-</span> equal c, <span class="Constant">10/newline</span> <span id="L856" class="LineNr"> 856 </span> <span class="muControl">break-unless</span> newline? <span id="L857" class="LineNr"> 857 </span><span class="Constant"> <insert-enter-begin></span> -<span id="L858" class="LineNr"> 858 </span> insert-new-line-and-indent editor, screen +<span id="L858" class="LineNr"> 858 </span> insert-new-line-and-indent editor, <a href='081print.mu.html#L4'>screen</a> <span id="L859" class="LineNr"> 859 </span><span class="Constant"> <insert-enter-end></span> <span id="L860" class="LineNr"> 860 </span> <span class="muControl">return</span> <span class="Constant">1/go-render</span> <span id="L861" class="LineNr"> 861 </span> <span class="Delimiter">}</span> <span id="L862" class="LineNr"> 862 </span>] <span id="L863" class="LineNr"> 863 </span> -<span id="L864" class="LineNr"> 864 </span><span class="muRecipe">def</span> insert-new-line-and-indent editor:&:editor, screen:&:screen<span class="muRecipe"> -> </span>editor:&:editor, screen:&:screen [ +<span id="L864" class="LineNr"> 864 </span><span class="muRecipe">def</span> insert-new-line-and-indent editor:&:editor, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>editor:&:editor, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L865" class="LineNr"> 865 </span> <span class="Constant">local-scope</span> <span id="L866" class="LineNr"> 866 </span> <span class="Constant">load-ingredients</span> <span id="L867" class="LineNr"> 867 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> @@ -928,10 +928,10 @@ if ('onhashchange' in window) { <span id="L869" class="LineNr"> 869 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L870" class="LineNr"> 870 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L871" class="LineNr"> 871 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> -<span id="L872" class="LineNr"> 872 </span> screen-height:num <span class="Special"><-</span> screen-height screen +<span id="L872" class="LineNr"> 872 </span> <a href='081print.mu.html#L594'>screen-height</a>:num <span class="Special"><-</span> <a href='081print.mu.html#L594'>screen-height</a> <a href='081print.mu.html#L4'>screen</a> <span id="L873" class="LineNr"> 873 </span> <span class="Comment"># insert newline</span> <span id="L874" class="LineNr"> 874 </span> insert <span class="Constant">10/newline</span>, before-cursor -<span id="L875" class="LineNr"> 875 </span> before-cursor <span class="Special"><-</span> next before-cursor +<span id="L875" class="LineNr"> 875 </span> before-cursor <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L876" class="LineNr"> 876 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor <span id="L877" class="LineNr"> 877 </span> cursor-row <span class="Special"><-</span> add cursor-row,<span class="Constant"> 1</span> <span id="L878" class="LineNr"> 878 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row @@ -939,7 +939,7 @@ if ('onhashchange' in window) { <span id="L880" class="LineNr"> 880 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column <span id="L881" class="LineNr"> 881 </span> <span class="Comment"># maybe scroll</span> <span id="L882" class="LineNr"> 882 </span> <span class="Delimiter">{</span> -<span id="L883" class="LineNr"> 883 </span> below-screen?:bool <span class="Special"><-</span> greater-or-equal cursor-row, screen-height <span class="Comment"># must be equal, never greater</span> +<span id="L883" class="LineNr"> 883 </span> below-screen?:bool <span class="Special"><-</span> greater-or-equal cursor-row, <a href='081print.mu.html#L594'>screen-height</a> <span class="Comment"># must be equal, never greater</span> <span id="L884" class="LineNr"> 884 </span> <span class="muControl">break-unless</span> below-screen? <span id="L885" class="LineNr"> 885 </span><span class="Constant"> <scroll-down></span> <span id="L886" class="LineNr"> 886 </span> cursor-row <span class="Special"><-</span> subtract cursor-row,<span class="Constant"> 1</span> <span class="Comment"># bring back into screen range</span> @@ -949,13 +949,13 @@ if ('onhashchange' in window) { <span id="L890" class="LineNr"> 890 </span> indent?:bool <span class="Special"><-</span> get *editor, <span class="Constant">indent?:offset</span> <span id="L891" class="LineNr"> 891 </span> <span class="muControl">return-unless</span> indent? <span id="L892" class="LineNr"> 892 </span> d:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> -<span id="L893" class="LineNr"> 893 </span> end-of-previous-line:&:duplex-list:char <span class="Special"><-</span> prev before-cursor +<span id="L893" class="LineNr"> 893 </span> end-of-previous-line:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> before-cursor <span id="L894" class="LineNr"> 894 </span> indent:num <span class="Special"><-</span> line-indent end-of-previous-line, d <span id="L895" class="LineNr"> 895 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L896" class="LineNr"> 896 </span> <span class="Delimiter">{</span> <span id="L897" class="LineNr"> 897 </span> indent-done?:bool <span class="Special"><-</span> greater-or-equal i, indent <span id="L898" class="LineNr"> 898 </span> <span class="muControl">break-if</span> indent-done? -<span id="L899" class="LineNr"> 899 </span> insert-at-cursor editor, <span class="Constant">32/space</span>, screen +<span id="L899" class="LineNr"> 899 </span> insert-at-cursor editor, <span class="Constant">32/space</span>, <a href='081print.mu.html#L4'>screen</a> <span id="L900" class="LineNr"> 900 </span> i <span class="Special"><-</span> add i,<span class="Constant"> 1</span> <span id="L901" class="LineNr"> 901 </span> <span class="muControl">loop</span> <span id="L902" class="LineNr"> 902 </span> <span class="Delimiter">}</span> @@ -971,7 +971,7 @@ if ('onhashchange' in window) { <span id="L912" class="LineNr"> 912 </span> at-start?:bool <span class="Special"><-</span> equal curr, start <span id="L913" class="LineNr"> 913 </span> <span class="muControl">return-if</span> at-start? <span id="L914" class="LineNr"> 914 </span> <span class="Delimiter">{</span> -<span id="L915" class="LineNr"> 915 </span> curr <span class="Special"><-</span> prev curr +<span id="L915" class="LineNr"> 915 </span> curr <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> curr <span id="L916" class="LineNr"> 916 </span> <span class="muControl">break-unless</span> curr <span id="L917" class="LineNr"> 917 </span> at-start?:bool <span class="Special"><-</span> equal curr, start <span id="L918" class="LineNr"> 918 </span> <span class="muControl">break-if</span> at-start? @@ -1002,7 +1002,7 @@ if ('onhashchange' in window) { <span id="L943" class="LineNr"> 943 </span><span class="Constant">1]</span> <span id="L944" class="LineNr"> 944 </span> ] <span id="L945" class="LineNr"> 945 </span> run [ -<span id="L946" class="LineNr"> 946 </span> editor-event-loop screen, console, e +<span id="L946" class="LineNr"> 946 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L947" class="LineNr"> 947 </span> ] <span id="L948" class="LineNr"> 948 </span> screen-should-contain [ <span id="L949" class="LineNr"> 949 </span> <span class="Constant"> . .</span> @@ -1017,7 +1017,7 @@ if ('onhashchange' in window) { <span id="L958" class="LineNr"> 958 </span> <span class="Constant">local-scope</span> <span id="L959" class="LineNr"> 959 </span> assume-screen <span class="Constant">10/width</span>, <span class="Constant">5/height</span> <span id="L960" class="LineNr"> 960 </span> e:&:editor <span class="Special"><-</span> new-editor <span class="Constant">[abcde]</span>, <span class="Constant">0/left</span>, <span class="Constant">5/right</span> -<span id="L961" class="LineNr"> 961 </span> editor-render screen, e +<span id="L961" class="LineNr"> 961 </span> editor-render <a href='081print.mu.html#L4'>screen</a>, e <span id="L962" class="LineNr"> 962 </span> screen-should-contain [ <span id="L963" class="LineNr"> 963 </span> <span class="Constant"> . .</span> <span id="L964" class="LineNr"> 964 </span> <span class="Constant"> .abcd↩ .</span> @@ -1029,7 +1029,7 @@ if ('onhashchange' in window) { <span id="L970" class="LineNr"> 970 </span> press enter <span id="L971" class="LineNr"> 971 </span> ] <span id="L972" class="LineNr"> 972 </span> run [ -<span id="L973" class="LineNr"> 973 </span> editor-event-loop screen, console, e +<span id="L973" class="LineNr"> 973 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L974" class="LineNr"> 974 </span> ] <span id="L975" class="LineNr"> 975 </span> <span class="Comment"># line should be fully cleared</span> <span id="L976" class="LineNr"> 976 </span> screen-should-contain [ @@ -1055,7 +1055,7 @@ if ('onhashchange' in window) { <span id="L996" class="LineNr"> 996 </span>] <span id="L997" class="LineNr"> 997 </span> ] <span id="L998" class="LineNr"> 998 </span> run [ -<span id="L999" class="LineNr"> 999 </span> editor-event-loop screen, console, e +<span id="L999" class="LineNr"> 999 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L1000" class="LineNr">1000 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L1001" class="LineNr">1001 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L1002" class="LineNr">1002 </span> ] @@ -1081,7 +1081,7 @@ if ('onhashchange' in window) { <span id="L1022" class="LineNr">1022 </span> press<span class="Constant"> 65506</span> <span class="Comment"># end paste</span> <span id="L1023" class="LineNr">1023 </span> ] <span id="L1024" class="LineNr">1024 </span> run [ -<span id="L1025" class="LineNr">1025 </span> editor-event-loop screen, console, e +<span id="L1025" class="LineNr">1025 </span> editor-event-loop <a href='081print.mu.html#L4'>screen</a>, <a href='084console.mu.html#L23'>console</a>, e <span id="L1026" class="LineNr">1026 </span> 3:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-row:offset</span> <span id="L1027" class="LineNr">1027 </span> 4:num/<span class="Special">raw</span> <span class="Special"><-</span> get *e, <span class="Constant">cursor-column:offset</span> <span id="L1028" class="LineNr">1028 </span> ] @@ -1112,7 +1112,7 @@ if ('onhashchange' in window) { <span id="L1053" class="LineNr">1053 </span> <span id="L1054" class="LineNr">1054 </span><span class="SalientComment">## helpers</span> <span id="L1055" class="LineNr">1055 </span> -<span id="L1056" class="LineNr">1056 </span><span class="muRecipe">def</span> draw-horizontal screen:&:screen, row:num, x:num, right:num<span class="muRecipe"> -> </span>screen:&:screen [ +<span id="L1056" class="LineNr">1056 </span><span class="muRecipe">def</span> draw-horizontal <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, row:num, x:num, right:num<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L1057" class="LineNr">1057 </span> <span class="Constant">local-scope</span> <span id="L1058" class="LineNr">1058 </span> <span class="Constant">load-ingredients</span> <span id="L1059" class="LineNr">1059 </span> style:char, style-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> @@ -1131,11 +1131,11 @@ if ('onhashchange' in window) { <span id="L1072" class="LineNr">1072 </span> <span class="muControl">break-if</span> bg-color-found? <span id="L1073" class="LineNr">1073 </span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> <span id="L1074" class="LineNr">1074 </span> <span class="Delimiter">}</span> -<span id="L1075" class="LineNr">1075 </span> screen <span class="Special"><-</span> move-cursor screen, row, x +<span id="L1075" class="LineNr">1075 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L442'>move-cursor</a> <a href='081print.mu.html#L4'>screen</a>, row, x <span id="L1076" class="LineNr">1076 </span> <span class="Delimiter">{</span> <span id="L1077" class="LineNr">1077 </span> continue?:bool <span class="Special"><-</span> lesser-or-equal x, right <span class="Comment"># right is inclusive, to match editor semantics</span> <span id="L1078" class="LineNr">1078 </span> <span class="muControl">break-unless</span> continue? -<span id="L1079" class="LineNr">1079 </span> print screen, style, color, bg-color +<span id="L1079" class="LineNr">1079 </span> print <a href='081print.mu.html#L4'>screen</a>, style, color, bg-color <span id="L1080" class="LineNr">1080 </span> x <span class="Special"><-</span> add x,<span class="Constant"> 1</span> <span id="L1081" class="LineNr">1081 </span> <span class="muControl">loop</span> <span id="L1082" class="LineNr">1082 </span> <span class="Delimiter">}</span> |