diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-05-27 21:32:51 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-05-27 21:32:51 -0700 |
commit | 4f2adf06713eeec995d7811cd1d7a4dfe3cdda86 (patch) | |
tree | 92fc50fc557842bf4c7ef5a56d9c3ac07eac5ae7 /html/081print.mu.html | |
parent | 3c6cd5e8dca92d8b0073cecd18f5ab4bada1f9c1 (diff) | |
download | mu-4f2adf06713eeec995d7811cd1d7a4dfe3cdda86.tar.gz |
3883
Diffstat (limited to 'html/081print.mu.html')
-rw-r--r-- | html/081print.mu.html | 475 |
1 files changed, 249 insertions, 226 deletions
diff --git a/html/081print.mu.html b/html/081print.mu.html index 22a4c11b..01a5dd12 100644 --- a/html/081print.mu.html +++ b/html/081print.mu.html @@ -286,7 +286,7 @@ if ('onhashchange' in window) { <span id="L223" class="LineNr">223 </span> <span class="Comment"># clear top line and 'rotate' it to the bottom</span> <span id="L224" class="LineNr">224 </span> top-idx:num <span class="Special"><-</span> get *screen, <span class="Constant">top-idx:offset</span> <span class="Comment"># 0 <= top-idx < len(buf)</span> <span id="L225" class="LineNr">225 </span> next-top-idx:num <span class="Special"><-</span> add top-idx, width <span class="Comment"># 0 <= next-top-idx <= len(buf)</span> -<span id="L226" class="LineNr">226 </span> empty-cell:<a href='081print.mu.html#L14'>screen-cell</a> <span class="Special"><-</span> merge<span class="Constant"> 0</span>,<span class="Constant"> 0</span> +<span id="L226" class="LineNr">226 </span> empty-cell:<a href='081print.mu.html#L14'>screen-cell</a> <span class="Special"><-</span> merge <span class="Constant">0/empty</span>, <span class="Constant">7/white</span> <span id="L227" class="LineNr">227 </span> <span class="Delimiter">{</span> <span id="L228" class="LineNr">228 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal top-idx, next-top-idx <span id="L229" class="LineNr">229 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? @@ -546,7 +546,7 @@ if ('onhashchange' in window) { <span id="L483" class="LineNr">483 </span> <span class="Conceal">¦</span><span class="Constant"> 21</span> <span class="Special"><-</span><span class="Constant"> 101</span> <span class="Comment"># 'e'</span> <span id="L484" class="LineNr">484 </span> <span class="Conceal">¦</span><span class="Constant"> 22</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> <span id="L485" class="LineNr">485 </span> <span class="Conceal">¦</span><span class="Constant"> 23</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># unused</span> -<span id="L486" class="LineNr">486 </span> <span class="Conceal">¦</span><span class="Constant"> 24</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># no color</span> +<span id="L486" class="LineNr">486 </span> <span class="Conceal">¦</span><span class="Constant"> 24</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> <span id="L487" class="LineNr">487 </span> ] <span id="L488" class="LineNr">488 </span>] <span id="L489" class="LineNr">489 </span> @@ -600,7 +600,7 @@ if ('onhashchange' in window) { <span id="L537" class="LineNr">537 </span> <span class="Constant">local-scope</span> <span id="L538" class="LineNr">538 </span> <span class="Constant">load-ingredients</span> <span id="L539" class="LineNr">539 </span> row:num, column:num <span class="Special"><-</span> <a href='081print.mu.html#L559'>cursor-position</a> <a href='081print.mu.html#L4'>screen</a> -<span id="L540" class="LineNr">540 </span> height:num <span class="Special"><-</span> <a href='081print.mu.html#L725'>screen-height</a> <a href='081print.mu.html#L4'>screen</a> +<span id="L540" class="LineNr">540 </span> height:num <span class="Special"><-</span> <a href='081print.mu.html#L748'>screen-height</a> <a href='081print.mu.html#L4'>screen</a> <span id="L541" class="LineNr">541 </span> past-bottom?:bool <span class="Special"><-</span> greater-or-equal row, height <span id="L542" class="LineNr">542 </span> <span class="muControl">return-if</span> past-bottom? <span id="L543" class="LineNr">543 </span> space:char <span class="Special"><-</span> copy <span class="Constant">32/space</span> @@ -688,229 +688,252 @@ if ('onhashchange' in window) { <span id="L625" class="LineNr">625 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> <span id="L626" class="LineNr">626 </span> <span class="Delimiter">}</span> <span id="L627" class="LineNr">627 </span> <span class="Comment"># fake screen</span> -<span id="L628" class="LineNr">628 </span> height:num <span class="Special"><-</span> get *screen, <span class="Constant">num-rows:offset</span> -<span id="L629" class="LineNr">629 </span> row:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-row:offset</span> -<span id="L630" class="LineNr">630 </span> max:num <span class="Special"><-</span> subtract height,<span class="Constant"> 1</span> -<span id="L631" class="LineNr">631 </span> at-bottom?:bool <span class="Special"><-</span> greater-or-equal row, max -<span id="L632" class="LineNr">632 </span> <span class="muControl">return-if</span> at-bottom? -<span id="L633" class="LineNr">633 </span> row <span class="Special"><-</span> add row,<span class="Constant"> 1</span> -<span id="L634" class="LineNr">634 </span> *screen <span class="Special"><-</span> put *screen, <span class="Constant">cursor-row:offset</span>, row -<span id="L635" class="LineNr">635 </span>] -<span id="L636" class="LineNr">636 </span> -<span id="L637" class="LineNr">637 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L637'>cursor-up</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L638" class="LineNr">638 </span> <span class="Constant">local-scope</span> -<span id="L639" class="LineNr">639 </span> <span class="Constant">load-ingredients</span> -<span id="L640" class="LineNr">640 </span> <span class="Delimiter">{</span> -<span id="L641" class="LineNr">641 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L4'>screen</a> -<span id="L642" class="LineNr">642 </span> <span class="Conceal">¦</span> <span class="Comment"># real screen</span> -<span id="L643" class="LineNr">643 </span> <span class="Conceal">¦</span> move-cursor-up-on-display -<span id="L644" class="LineNr">644 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> -<span id="L645" class="LineNr">645 </span> <span class="Delimiter">}</span> -<span id="L646" class="LineNr">646 </span> <span class="Comment"># fake screen</span> -<span id="L647" class="LineNr">647 </span> row:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-row:offset</span> -<span id="L648" class="LineNr">648 </span> at-top?:bool <span class="Special"><-</span> lesser-or-equal row,<span class="Constant"> 0</span> -<span id="L649" class="LineNr">649 </span> <span class="muControl">return-if</span> at-top? -<span id="L650" class="LineNr">650 </span> row <span class="Special"><-</span> subtract row,<span class="Constant"> 1</span> -<span id="L651" class="LineNr">651 </span> *screen <span class="Special"><-</span> put *screen, <span class="Constant">cursor-row:offset</span>, row -<span id="L652" class="LineNr">652 </span>] -<span id="L653" class="LineNr">653 </span> -<span id="L654" class="LineNr">654 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L654'>cursor-right</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L655" class="LineNr">655 </span> <span class="Constant">local-scope</span> -<span id="L656" class="LineNr">656 </span> <span class="Constant">load-ingredients</span> -<span id="L657" class="LineNr">657 </span> <span class="Delimiter">{</span> -<span id="L658" class="LineNr">658 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L4'>screen</a> -<span id="L659" class="LineNr">659 </span> <span class="Conceal">¦</span> <span class="Comment"># real screen</span> -<span id="L660" class="LineNr">660 </span> <span class="Conceal">¦</span> move-cursor-right-on-display -<span id="L661" class="LineNr">661 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> -<span id="L662" class="LineNr">662 </span> <span class="Delimiter">}</span> -<span id="L663" class="LineNr">663 </span> <span class="Comment"># fake screen</span> -<span id="L664" class="LineNr">664 </span> width:num <span class="Special"><-</span> get *screen, <span class="Constant">num-columns:offset</span> -<span id="L665" class="LineNr">665 </span> column:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-column:offset</span> -<span id="L666" class="LineNr">666 </span> max:num <span class="Special"><-</span> subtract width,<span class="Constant"> 1</span> -<span id="L667" class="LineNr">667 </span> at-bottom?:bool <span class="Special"><-</span> greater-or-equal column, max -<span id="L668" class="LineNr">668 </span> <span class="muControl">return-if</span> at-bottom? -<span id="L669" class="LineNr">669 </span> column <span class="Special"><-</span> add column,<span class="Constant"> 1</span> -<span id="L670" class="LineNr">670 </span> *screen <span class="Special"><-</span> put *screen, <span class="Constant">cursor-column:offset</span>, column -<span id="L671" class="LineNr">671 </span>] -<span id="L672" class="LineNr">672 </span> -<span id="L673" class="LineNr">673 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L673'>cursor-left</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L674" class="LineNr">674 </span> <span class="Constant">local-scope</span> -<span id="L675" class="LineNr">675 </span> <span class="Constant">load-ingredients</span> -<span id="L676" class="LineNr">676 </span> <span class="Delimiter">{</span> -<span id="L677" class="LineNr">677 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L4'>screen</a> -<span id="L678" class="LineNr">678 </span> <span class="Conceal">¦</span> <span class="Comment"># real screen</span> -<span id="L679" class="LineNr">679 </span> <span class="Conceal">¦</span> move-cursor-left-on-display -<span id="L680" class="LineNr">680 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> -<span id="L681" class="LineNr">681 </span> <span class="Delimiter">}</span> -<span id="L682" class="LineNr">682 </span> <span class="Comment"># fake screen</span> -<span id="L683" class="LineNr">683 </span> column:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-column:offset</span> -<span id="L684" class="LineNr">684 </span> at-top?:bool <span class="Special"><-</span> lesser-or-equal column,<span class="Constant"> 0</span> -<span id="L685" class="LineNr">685 </span> <span class="muControl">return-if</span> at-top? -<span id="L686" class="LineNr">686 </span> column <span class="Special"><-</span> subtract column,<span class="Constant"> 1</span> -<span id="L687" class="LineNr">687 </span> *screen <span class="Special"><-</span> put *screen, <span class="Constant">cursor-column:offset</span>, column -<span id="L688" class="LineNr">688 </span>] -<span id="L689" class="LineNr">689 </span> -<span id="L690" class="LineNr">690 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L690'>cursor-to-start-of-line</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L691" class="LineNr">691 </span> <span class="Constant">local-scope</span> -<span id="L692" class="LineNr">692 </span> <span class="Constant">load-ingredients</span> -<span id="L693" class="LineNr">693 </span> row:num <span class="Special"><-</span> <a href='081print.mu.html#L559'>cursor-position</a> <a href='081print.mu.html#L4'>screen</a> -<span id="L694" class="LineNr">694 </span> column:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> -<span id="L695" class="LineNr">695 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L573'>move-cursor</a> <a href='081print.mu.html#L4'>screen</a>, row, column -<span id="L696" class="LineNr">696 </span>] -<span id="L697" class="LineNr">697 </span> -<span id="L698" class="LineNr">698 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L698'>cursor-to-next-line</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L699" class="LineNr">699 </span> <span class="Constant">local-scope</span> -<span id="L700" class="LineNr">700 </span> <span class="Constant">load-ingredients</span> -<span id="L701" class="LineNr">701 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L618'>cursor-down</a> <a href='081print.mu.html#L4'>screen</a> -<span id="L702" class="LineNr">702 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L690'>cursor-to-start-of-line</a> <a href='081print.mu.html#L4'>screen</a> -<span id="L703" class="LineNr">703 </span>] -<span id="L704" class="LineNr">704 </span> -<span id="L705" class="LineNr">705 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L705'>move-cursor-to-column</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, column:num<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L706" class="LineNr">706 </span> <span class="Constant">local-scope</span> -<span id="L707" class="LineNr">707 </span> <span class="Constant">load-ingredients</span> -<span id="L708" class="LineNr">708 </span> row:num, _ <span class="Special"><-</span> <a href='081print.mu.html#L559'>cursor-position</a> <a href='081print.mu.html#L4'>screen</a> -<span id="L709" class="LineNr">709 </span> <a href='081print.mu.html#L573'>move-cursor</a> <a href='081print.mu.html#L4'>screen</a>, row, column -<span id="L710" class="LineNr">710 </span>] -<span id="L711" class="LineNr">711 </span> -<span id="L712" class="LineNr">712 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L712'>screen-width</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>width:num [ -<span id="L713" class="LineNr">713 </span> <span class="Constant">local-scope</span> -<span id="L714" class="LineNr">714 </span> <span class="Constant">load-ingredients</span> -<span id="L715" class="LineNr">715 </span> <span class="Delimiter">{</span> -<span id="L716" class="LineNr">716 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='081print.mu.html#L4'>screen</a> -<span id="L717" class="LineNr">717 </span> <span class="Conceal">¦</span> <span class="Comment"># fake screen</span> -<span id="L718" class="LineNr">718 </span> <span class="Conceal">¦</span> width <span class="Special"><-</span> get *screen, <span class="Constant">num-columns:offset</span> -<span id="L719" class="LineNr">719 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> -<span id="L720" class="LineNr">720 </span> <span class="Delimiter">}</span> -<span id="L721" class="LineNr">721 </span> <span class="Comment"># real screen</span> -<span id="L722" class="LineNr">722 </span> width <span class="Special"><-</span> display-width -<span id="L723" class="LineNr">723 </span>] -<span id="L724" class="LineNr">724 </span> -<span id="L725" class="LineNr">725 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L725'>screen-height</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>height:num [ -<span id="L726" class="LineNr">726 </span> <span class="Constant">local-scope</span> -<span id="L727" class="LineNr">727 </span> <span class="Constant">load-ingredients</span> -<span id="L728" class="LineNr">728 </span> <span class="Delimiter">{</span> -<span id="L729" class="LineNr">729 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='081print.mu.html#L4'>screen</a> -<span id="L730" class="LineNr">730 </span> <span class="Conceal">¦</span> <span class="Comment"># fake screen</span> -<span id="L731" class="LineNr">731 </span> <span class="Conceal">¦</span> height <span class="Special"><-</span> get *screen, <span class="Constant">num-rows:offset</span> -<span id="L732" class="LineNr">732 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> -<span id="L733" class="LineNr">733 </span> <span class="Delimiter">}</span> -<span id="L734" class="LineNr">734 </span> <span class="Comment"># real screen</span> -<span id="L735" class="LineNr">735 </span> height <span class="Special"><-</span> display-height -<span id="L736" class="LineNr">736 </span>] -<span id="L737" class="LineNr">737 </span> -<span id="L738" class="LineNr">738 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, s:text<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L739" class="LineNr">739 </span> <span class="Constant">local-scope</span> -<span id="L740" class="LineNr">740 </span> <span class="Constant">load-ingredients</span> -<span id="L741" class="LineNr">741 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L742" class="LineNr">742 </span> <span class="Delimiter">{</span> -<span id="L743" class="LineNr">743 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> -<span id="L744" class="LineNr">744 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? -<span id="L745" class="LineNr">745 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> -<span id="L746" class="LineNr">746 </span> <span class="Delimiter">}</span> -<span id="L747" class="LineNr">747 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L748" class="LineNr">748 </span> <span class="Delimiter">{</span> -<span id="L749" class="LineNr">749 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> -<span id="L750" class="LineNr">750 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? -<span id="L751" class="LineNr">751 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> -<span id="L752" class="LineNr">752 </span> <span class="Delimiter">}</span> -<span id="L753" class="LineNr">753 </span> len:num <span class="Special"><-</span> length *s -<span id="L754" class="LineNr">754 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> -<span id="L755" class="LineNr">755 </span> <span class="Delimiter">{</span> -<span id="L756" class="LineNr">756 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal i, len -<span id="L757" class="LineNr">757 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? -<span id="L758" class="LineNr">758 </span> <span class="Conceal">¦</span> c:char <span class="Special"><-</span> index *s, i -<span id="L759" class="LineNr">759 </span> <span class="Conceal">¦</span> print <a href='081print.mu.html#L4'>screen</a>, c, color, bg-color -<span id="L760" class="LineNr">760 </span> <span class="Conceal">¦</span> i <span class="Special"><-</span> add i,<span class="Constant"> 1</span> -<span id="L761" class="LineNr">761 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> -<span id="L762" class="LineNr">762 </span> <span class="Delimiter">}</span> -<span id="L763" class="LineNr">763 </span>] -<span id="L764" class="LineNr">764 </span> -<span id="L765" class="LineNr">765 </span><span class="muScenario">scenario</span> print-text-wraps-past-right-margin [ -<span id="L766" class="LineNr">766 </span> <span class="Constant">local-scope</span> -<span id="L767" class="LineNr">767 </span> fake-screen:&:<a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L19'>new-fake-screen</a> <span class="Constant">3/width</span>, <span class="Constant">2/height</span> -<span id="L768" class="LineNr">768 </span> run [ -<span id="L769" class="LineNr">769 </span> <span class="Conceal">¦</span> fake-screen <span class="Special"><-</span> print fake-screen, <span class="Constant">[abcd]</span> -<span id="L770" class="LineNr">770 </span> <span class="Conceal">¦</span> 5:num/<span class="Special">raw</span> <span class="Special"><-</span> get *fake-screen, <span class="Constant">cursor-row:offset</span> -<span id="L771" class="LineNr">771 </span> <span class="Conceal">¦</span> 6:num/<span class="Special">raw</span> <span class="Special"><-</span> get *fake-screen, <span class="Constant">cursor-column:offset</span> -<span id="L772" class="LineNr">772 </span> <span class="Conceal">¦</span> 7:num/<span class="Special">raw</span> <span class="Special"><-</span> get *fake-screen, <span class="Constant">top-idx:offset</span> -<span id="L773" class="LineNr">773 </span> <span class="Conceal">¦</span> cell:&:@:<a href='081print.mu.html#L14'>screen-cell</a> <span class="Special"><-</span> get *fake-screen, <span class="Constant">data:offset</span> -<span id="L774" class="LineNr">774 </span> <span class="Conceal">¦</span> 10:@:<a href='081print.mu.html#L14'>screen-cell</a>/<span class="Special">raw</span> <span class="Special"><-</span> copy *cell -<span id="L775" class="LineNr">775 </span> ] -<span id="L776" class="LineNr">776 </span> memory-should-contain [ -<span id="L777" class="LineNr">777 </span> <span class="Conceal">¦</span><span class="Constant"> 5</span> <span class="Special"><-</span><span class="Constant"> 1</span> <span class="Comment"># cursor-row</span> -<span id="L778" class="LineNr">778 </span> <span class="Conceal">¦</span><span class="Constant"> 6</span> <span class="Special"><-</span><span class="Constant"> 1</span> <span class="Comment"># cursor-column</span> -<span id="L779" class="LineNr">779 </span> <span class="Conceal">¦</span><span class="Constant"> 7</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># top-idx</span> -<span id="L780" class="LineNr">780 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 6</span> <span class="Comment"># width*height</span> -<span id="L781" class="LineNr">781 </span> <span class="Conceal">¦</span><span class="Constant"> 11</span> <span class="Special"><-</span><span class="Constant"> 97</span> <span class="Comment"># 'a'</span> -<span id="L782" class="LineNr">782 </span> <span class="Conceal">¦</span><span class="Constant"> 12</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> -<span id="L783" class="LineNr">783 </span> <span class="Conceal">¦</span><span class="Constant"> 13</span> <span class="Special"><-</span><span class="Constant"> 98</span> <span class="Comment"># 'b'</span> -<span id="L784" class="LineNr">784 </span> <span class="Conceal">¦</span><span class="Constant"> 14</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> -<span id="L785" class="LineNr">785 </span> <span class="Conceal">¦</span><span class="Constant"> 15</span> <span class="Special"><-</span><span class="Constant"> 99</span> <span class="Comment"># 'c'</span> -<span id="L786" class="LineNr">786 </span> <span class="Conceal">¦</span><span class="Constant"> 16</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> -<span id="L787" class="LineNr">787 </span> <span class="Conceal">¦</span><span class="Constant"> 17</span> <span class="Special"><-</span><span class="Constant"> 100</span> <span class="Comment"># 'd'</span> -<span id="L788" class="LineNr">788 </span> <span class="Conceal">¦</span><span class="Constant"> 18</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> -<span id="L789" class="LineNr">789 </span> <span class="Conceal">¦</span> <span class="Comment"># rest of screen is empty</span> -<span id="L790" class="LineNr">790 </span> <span class="Conceal">¦</span><span class="Constant"> 19</span> <span class="Special"><-</span><span class="Constant"> 0</span> -<span id="L791" class="LineNr">791 </span> ] -<span id="L792" class="LineNr">792 </span>] -<span id="L793" class="LineNr">793 </span> -<span id="L794" class="LineNr">794 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, n:num<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L795" class="LineNr">795 </span> <span class="Constant">local-scope</span> -<span id="L796" class="LineNr">796 </span> <span class="Constant">load-ingredients</span> -<span id="L797" class="LineNr">797 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L798" class="LineNr">798 </span> <span class="Delimiter">{</span> -<span id="L799" class="LineNr">799 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> -<span id="L800" class="LineNr">800 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? -<span id="L801" class="LineNr">801 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> -<span id="L802" class="LineNr">802 </span> <span class="Delimiter">}</span> -<span id="L803" class="LineNr">803 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L804" class="LineNr">804 </span> <span class="Delimiter">{</span> -<span id="L805" class="LineNr">805 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> -<span id="L806" class="LineNr">806 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? -<span id="L807" class="LineNr">807 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> -<span id="L808" class="LineNr">808 </span> <span class="Delimiter">}</span> -<span id="L809" class="LineNr">809 </span> <span class="Comment"># todo: other bases besides decimal</span> -<span id="L810" class="LineNr">810 </span> s:text <span class="Special"><-</span> to-text n -<span id="L811" class="LineNr">811 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> print <a href='081print.mu.html#L4'>screen</a>, s, color, bg-color -<span id="L812" class="LineNr">812 </span>] -<span id="L813" class="LineNr">813 </span> -<span id="L814" class="LineNr">814 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, n:bool<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L815" class="LineNr">815 </span> <span class="Constant">local-scope</span> -<span id="L816" class="LineNr">816 </span> <span class="Constant">load-ingredients</span> -<span id="L817" class="LineNr">817 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L818" class="LineNr">818 </span> <span class="Delimiter">{</span> -<span id="L819" class="LineNr">819 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> -<span id="L820" class="LineNr">820 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? -<span id="L821" class="LineNr">821 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> -<span id="L822" class="LineNr">822 </span> <span class="Delimiter">}</span> -<span id="L823" class="LineNr">823 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L824" class="LineNr">824 </span> <span class="Delimiter">{</span> -<span id="L825" class="LineNr">825 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> -<span id="L826" class="LineNr">826 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? -<span id="L827" class="LineNr">827 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> -<span id="L828" class="LineNr">828 </span> <span class="Delimiter">}</span> -<span id="L829" class="LineNr">829 </span> n2:num <span class="Special"><-</span> copy n -<span id="L830" class="LineNr">830 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> print <a href='081print.mu.html#L4'>screen</a>, n2, color, bg-color -<span id="L831" class="LineNr">831 </span>] -<span id="L832" class="LineNr">832 </span> -<span id="L833" class="LineNr">833 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, n:&:_elem<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ -<span id="L834" class="LineNr">834 </span> <span class="Constant">local-scope</span> -<span id="L835" class="LineNr">835 </span> <span class="Constant">load-ingredients</span> -<span id="L836" class="LineNr">836 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L837" class="LineNr">837 </span> <span class="Delimiter">{</span> -<span id="L838" class="LineNr">838 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> -<span id="L839" class="LineNr">839 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? -<span id="L840" class="LineNr">840 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> -<span id="L841" class="LineNr">841 </span> <span class="Delimiter">}</span> -<span id="L842" class="LineNr">842 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> -<span id="L843" class="LineNr">843 </span> <span class="Delimiter">{</span> -<span id="L844" class="LineNr">844 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> -<span id="L845" class="LineNr">845 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? -<span id="L846" class="LineNr">846 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> -<span id="L847" class="LineNr">847 </span> <span class="Delimiter">}</span> -<span id="L848" class="LineNr">848 </span> n2:num <span class="Special"><-</span> copy n -<span id="L849" class="LineNr">849 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> print <a href='081print.mu.html#L4'>screen</a>, n2, color, bg-color -<span id="L850" class="LineNr">850 </span>] +<span id="L628" class="LineNr">628 </span> <a href='081print.mu.html#L199'>cursor-down-on-fake-screen</a> <a href='081print.mu.html#L4'>screen</a> +<span id="L629" class="LineNr">629 </span>] +<span id="L630" class="LineNr">630 </span> +<span id="L631" class="LineNr">631 </span><span class="muScenario">scenario</span> cursor-down-scrolls [ +<span id="L632" class="LineNr">632 </span> <span class="Constant">local-scope</span> +<span id="L633" class="LineNr">633 </span> fake-screen:&:<a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L19'>new-fake-screen</a> <span class="Constant">3/width</span>, <span class="Constant">2/height</span> +<span id="L634" class="LineNr">634 </span> <span class="Comment"># print something to screen and scroll</span> +<span id="L635" class="LineNr">635 </span> run [ +<span id="L636" class="LineNr">636 </span> <span class="Conceal">¦</span> print fake-screen, <span class="Constant">[abc]</span> +<span id="L637" class="LineNr">637 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L721'>cursor-to-next-line</a> fake-screen +<span id="L638" class="LineNr">638 </span> <span class="Conceal">¦</span> <a href='081print.mu.html#L721'>cursor-to-next-line</a> fake-screen +<span id="L639" class="LineNr">639 </span> <span class="Conceal">¦</span> data:&:@:<a href='081print.mu.html#L14'>screen-cell</a> <span class="Special"><-</span> get *fake-screen, <span class="Constant">data:offset</span> +<span id="L640" class="LineNr">640 </span> <span class="Conceal">¦</span> 10:@:<a href='081print.mu.html#L14'>screen-cell</a>/<span class="Special">raw</span> <span class="Special"><-</span> copy *data +<span id="L641" class="LineNr">641 </span> ] +<span id="L642" class="LineNr">642 </span> <span class="Comment"># screen is now blank</span> +<span id="L643" class="LineNr">643 </span> memory-should-contain [ +<span id="L644" class="LineNr">644 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 6</span> <span class="Comment"># width*height</span> +<span id="L645" class="LineNr">645 </span> <span class="Conceal">¦</span><span class="Constant"> 11</span> <span class="Special"><-</span><span class="Constant"> 0</span> +<span id="L646" class="LineNr">646 </span> <span class="Conceal">¦</span><span class="Constant"> 12</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L647" class="LineNr">647 </span> <span class="Conceal">¦</span><span class="Constant"> 13</span> <span class="Special"><-</span><span class="Constant"> 0</span> +<span id="L648" class="LineNr">648 </span> <span class="Conceal">¦</span><span class="Constant"> 14</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L649" class="LineNr">649 </span> <span class="Conceal">¦</span><span class="Constant"> 15</span> <span class="Special"><-</span><span class="Constant"> 0</span> +<span id="L650" class="LineNr">650 </span> <span class="Conceal">¦</span><span class="Constant"> 16</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L651" class="LineNr">651 </span> <span class="Conceal">¦</span><span class="Constant"> 17</span> <span class="Special"><-</span><span class="Constant"> 0</span> +<span id="L652" class="LineNr">652 </span> <span class="Conceal">¦</span><span class="Constant"> 18</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L653" class="LineNr">653 </span> <span class="Conceal">¦</span><span class="Constant"> 19</span> <span class="Special"><-</span><span class="Constant"> 0</span> +<span id="L654" class="LineNr">654 </span> <span class="Conceal">¦</span><span class="Constant"> 20</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L655" class="LineNr">655 </span> <span class="Conceal">¦</span><span class="Constant"> 21</span> <span class="Special"><-</span><span class="Constant"> 0</span> +<span id="L656" class="LineNr">656 </span> <span class="Conceal">¦</span><span class="Constant"> 22</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L657" class="LineNr">657 </span> ] +<span id="L658" class="LineNr">658 </span>] +<span id="L659" class="LineNr">659 </span> +<span id="L660" class="LineNr">660 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L660'>cursor-up</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L661" class="LineNr">661 </span> <span class="Constant">local-scope</span> +<span id="L662" class="LineNr">662 </span> <span class="Constant">load-ingredients</span> +<span id="L663" class="LineNr">663 </span> <span class="Delimiter">{</span> +<span id="L664" class="LineNr">664 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L4'>screen</a> +<span id="L665" class="LineNr">665 </span> <span class="Conceal">¦</span> <span class="Comment"># real screen</span> +<span id="L666" class="LineNr">666 </span> <span class="Conceal">¦</span> move-cursor-up-on-display +<span id="L667" class="LineNr">667 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> +<span id="L668" class="LineNr">668 </span> <span class="Delimiter">}</span> +<span id="L669" class="LineNr">669 </span> <span class="Comment"># fake screen</span> +<span id="L670" class="LineNr">670 </span> row:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-row:offset</span> +<span id="L671" class="LineNr">671 </span> at-top?:bool <span class="Special"><-</span> lesser-or-equal row,<span class="Constant"> 0</span> +<span id="L672" class="LineNr">672 </span> <span class="muControl">return-if</span> at-top? +<span id="L673" class="LineNr">673 </span> row <span class="Special"><-</span> subtract row,<span class="Constant"> 1</span> +<span id="L674" class="LineNr">674 </span> *screen <span class="Special"><-</span> put *screen, <span class="Constant">cursor-row:offset</span>, row +<span id="L675" class="LineNr">675 </span>] +<span id="L676" class="LineNr">676 </span> +<span id="L677" class="LineNr">677 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L677'>cursor-right</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L678" class="LineNr">678 </span> <span class="Constant">local-scope</span> +<span id="L679" class="LineNr">679 </span> <span class="Constant">load-ingredients</span> +<span id="L680" class="LineNr">680 </span> <span class="Delimiter">{</span> +<span id="L681" class="LineNr">681 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L4'>screen</a> +<span id="L682" class="LineNr">682 </span> <span class="Conceal">¦</span> <span class="Comment"># real screen</span> +<span id="L683" class="LineNr">683 </span> <span class="Conceal">¦</span> move-cursor-right-on-display +<span id="L684" class="LineNr">684 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> +<span id="L685" class="LineNr">685 </span> <span class="Delimiter">}</span> +<span id="L686" class="LineNr">686 </span> <span class="Comment"># fake screen</span> +<span id="L687" class="LineNr">687 </span> width:num <span class="Special"><-</span> get *screen, <span class="Constant">num-columns:offset</span> +<span id="L688" class="LineNr">688 </span> column:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-column:offset</span> +<span id="L689" class="LineNr">689 </span> max:num <span class="Special"><-</span> subtract width,<span class="Constant"> 1</span> +<span id="L690" class="LineNr">690 </span> at-bottom?:bool <span class="Special"><-</span> greater-or-equal column, max +<span id="L691" class="LineNr">691 </span> <span class="muControl">return-if</span> at-bottom? +<span id="L692" class="LineNr">692 </span> column <span class="Special"><-</span> add column,<span class="Constant"> 1</span> +<span id="L693" class="LineNr">693 </span> *screen <span class="Special"><-</span> put *screen, <span class="Constant">cursor-column:offset</span>, column +<span id="L694" class="LineNr">694 </span>] +<span id="L695" class="LineNr">695 </span> +<span id="L696" class="LineNr">696 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L696'>cursor-left</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L697" class="LineNr">697 </span> <span class="Constant">local-scope</span> +<span id="L698" class="LineNr">698 </span> <span class="Constant">load-ingredients</span> +<span id="L699" class="LineNr">699 </span> <span class="Delimiter">{</span> +<span id="L700" class="LineNr">700 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> <a href='081print.mu.html#L4'>screen</a> +<span id="L701" class="LineNr">701 </span> <span class="Conceal">¦</span> <span class="Comment"># real screen</span> +<span id="L702" class="LineNr">702 </span> <span class="Conceal">¦</span> move-cursor-left-on-display +<span id="L703" class="LineNr">703 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> +<span id="L704" class="LineNr">704 </span> <span class="Delimiter">}</span> +<span id="L705" class="LineNr">705 </span> <span class="Comment"># fake screen</span> +<span id="L706" class="LineNr">706 </span> column:num <span class="Special"><-</span> get *screen, <span class="Constant">cursor-column:offset</span> +<span id="L707" class="LineNr">707 </span> at-top?:bool <span class="Special"><-</span> lesser-or-equal column,<span class="Constant"> 0</span> +<span id="L708" class="LineNr">708 </span> <span class="muControl">return-if</span> at-top? +<span id="L709" class="LineNr">709 </span> column <span class="Special"><-</span> subtract column,<span class="Constant"> 1</span> +<span id="L710" class="LineNr">710 </span> *screen <span class="Special"><-</span> put *screen, <span class="Constant">cursor-column:offset</span>, column +<span id="L711" class="LineNr">711 </span>] +<span id="L712" class="LineNr">712 </span> +<span id="L713" class="LineNr">713 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L713'>cursor-to-start-of-line</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L714" class="LineNr">714 </span> <span class="Constant">local-scope</span> +<span id="L715" class="LineNr">715 </span> <span class="Constant">load-ingredients</span> +<span id="L716" class="LineNr">716 </span> row:num <span class="Special"><-</span> <a href='081print.mu.html#L559'>cursor-position</a> <a href='081print.mu.html#L4'>screen</a> +<span id="L717" class="LineNr">717 </span> column:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> +<span id="L718" class="LineNr">718 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L573'>move-cursor</a> <a href='081print.mu.html#L4'>screen</a>, row, column +<span id="L719" class="LineNr">719 </span>] +<span id="L720" class="LineNr">720 </span> +<span id="L721" class="LineNr">721 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L721'>cursor-to-next-line</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L722" class="LineNr">722 </span> <span class="Constant">local-scope</span> +<span id="L723" class="LineNr">723 </span> <span class="Constant">load-ingredients</span> +<span id="L724" class="LineNr">724 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L618'>cursor-down</a> <a href='081print.mu.html#L4'>screen</a> +<span id="L725" class="LineNr">725 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L713'>cursor-to-start-of-line</a> <a href='081print.mu.html#L4'>screen</a> +<span id="L726" class="LineNr">726 </span>] +<span id="L727" class="LineNr">727 </span> +<span id="L728" class="LineNr">728 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L728'>move-cursor-to-column</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, column:num<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L729" class="LineNr">729 </span> <span class="Constant">local-scope</span> +<span id="L730" class="LineNr">730 </span> <span class="Constant">load-ingredients</span> +<span id="L731" class="LineNr">731 </span> row:num, _ <span class="Special"><-</span> <a href='081print.mu.html#L559'>cursor-position</a> <a href='081print.mu.html#L4'>screen</a> +<span id="L732" class="LineNr">732 </span> <a href='081print.mu.html#L573'>move-cursor</a> <a href='081print.mu.html#L4'>screen</a>, row, column +<span id="L733" class="LineNr">733 </span>] +<span id="L734" class="LineNr">734 </span> +<span id="L735" class="LineNr">735 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L735'>screen-width</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>width:num [ +<span id="L736" class="LineNr">736 </span> <span class="Constant">local-scope</span> +<span id="L737" class="LineNr">737 </span> <span class="Constant">load-ingredients</span> +<span id="L738" class="LineNr">738 </span> <span class="Delimiter">{</span> +<span id="L739" class="LineNr">739 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='081print.mu.html#L4'>screen</a> +<span id="L740" class="LineNr">740 </span> <span class="Conceal">¦</span> <span class="Comment"># fake screen</span> +<span id="L741" class="LineNr">741 </span> <span class="Conceal">¦</span> width <span class="Special"><-</span> get *screen, <span class="Constant">num-columns:offset</span> +<span id="L742" class="LineNr">742 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> +<span id="L743" class="LineNr">743 </span> <span class="Delimiter">}</span> +<span id="L744" class="LineNr">744 </span> <span class="Comment"># real screen</span> +<span id="L745" class="LineNr">745 </span> width <span class="Special"><-</span> display-width +<span id="L746" class="LineNr">746 </span>] +<span id="L747" class="LineNr">747 </span> +<span id="L748" class="LineNr">748 </span><span class="muRecipe">def</span> <a href='081print.mu.html#L748'>screen-height</a> <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>height:num [ +<span id="L749" class="LineNr">749 </span> <span class="Constant">local-scope</span> +<span id="L750" class="LineNr">750 </span> <span class="Constant">load-ingredients</span> +<span id="L751" class="LineNr">751 </span> <span class="Delimiter">{</span> +<span id="L752" class="LineNr">752 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='081print.mu.html#L4'>screen</a> +<span id="L753" class="LineNr">753 </span> <span class="Conceal">¦</span> <span class="Comment"># fake screen</span> +<span id="L754" class="LineNr">754 </span> <span class="Conceal">¦</span> height <span class="Special"><-</span> get *screen, <span class="Constant">num-rows:offset</span> +<span id="L755" class="LineNr">755 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> +<span id="L756" class="LineNr">756 </span> <span class="Delimiter">}</span> +<span id="L757" class="LineNr">757 </span> <span class="Comment"># real screen</span> +<span id="L758" class="LineNr">758 </span> height <span class="Special"><-</span> display-height +<span id="L759" class="LineNr">759 </span>] +<span id="L760" class="LineNr">760 </span> +<span id="L761" class="LineNr">761 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, s:text<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L762" class="LineNr">762 </span> <span class="Constant">local-scope</span> +<span id="L763" class="LineNr">763 </span> <span class="Constant">load-ingredients</span> +<span id="L764" class="LineNr">764 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L765" class="LineNr">765 </span> <span class="Delimiter">{</span> +<span id="L766" class="LineNr">766 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> +<span id="L767" class="LineNr">767 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? +<span id="L768" class="LineNr">768 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> +<span id="L769" class="LineNr">769 </span> <span class="Delimiter">}</span> +<span id="L770" class="LineNr">770 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L771" class="LineNr">771 </span> <span class="Delimiter">{</span> +<span id="L772" class="LineNr">772 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> +<span id="L773" class="LineNr">773 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? +<span id="L774" class="LineNr">774 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> +<span id="L775" class="LineNr">775 </span> <span class="Delimiter">}</span> +<span id="L776" class="LineNr">776 </span> len:num <span class="Special"><-</span> length *s +<span id="L777" class="LineNr">777 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> +<span id="L778" class="LineNr">778 </span> <span class="Delimiter">{</span> +<span id="L779" class="LineNr">779 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal i, len +<span id="L780" class="LineNr">780 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? +<span id="L781" class="LineNr">781 </span> <span class="Conceal">¦</span> c:char <span class="Special"><-</span> index *s, i +<span id="L782" class="LineNr">782 </span> <span class="Conceal">¦</span> print <a href='081print.mu.html#L4'>screen</a>, c, color, bg-color +<span id="L783" class="LineNr">783 </span> <span class="Conceal">¦</span> i <span class="Special"><-</span> add i,<span class="Constant"> 1</span> +<span id="L784" class="LineNr">784 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> +<span id="L785" class="LineNr">785 </span> <span class="Delimiter">}</span> +<span id="L786" class="LineNr">786 </span>] +<span id="L787" class="LineNr">787 </span> +<span id="L788" class="LineNr">788 </span><span class="muScenario">scenario</span> print-text-wraps-past-right-margin [ +<span id="L789" class="LineNr">789 </span> <span class="Constant">local-scope</span> +<span id="L790" class="LineNr">790 </span> fake-screen:&:<a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='081print.mu.html#L19'>new-fake-screen</a> <span class="Constant">3/width</span>, <span class="Constant">2/height</span> +<span id="L791" class="LineNr">791 </span> run [ +<span id="L792" class="LineNr">792 </span> <span class="Conceal">¦</span> fake-screen <span class="Special"><-</span> print fake-screen, <span class="Constant">[abcd]</span> +<span id="L793" class="LineNr">793 </span> <span class="Conceal">¦</span> 5:num/<span class="Special">raw</span> <span class="Special"><-</span> get *fake-screen, <span class="Constant">cursor-row:offset</span> +<span id="L794" class="LineNr">794 </span> <span class="Conceal">¦</span> 6:num/<span class="Special">raw</span> <span class="Special"><-</span> get *fake-screen, <span class="Constant">cursor-column:offset</span> +<span id="L795" class="LineNr">795 </span> <span class="Conceal">¦</span> 7:num/<span class="Special">raw</span> <span class="Special"><-</span> get *fake-screen, <span class="Constant">top-idx:offset</span> +<span id="L796" class="LineNr">796 </span> <span class="Conceal">¦</span> cell:&:@:<a href='081print.mu.html#L14'>screen-cell</a> <span class="Special"><-</span> get *fake-screen, <span class="Constant">data:offset</span> +<span id="L797" class="LineNr">797 </span> <span class="Conceal">¦</span> 10:@:<a href='081print.mu.html#L14'>screen-cell</a>/<span class="Special">raw</span> <span class="Special"><-</span> copy *cell +<span id="L798" class="LineNr">798 </span> ] +<span id="L799" class="LineNr">799 </span> memory-should-contain [ +<span id="L800" class="LineNr">800 </span> <span class="Conceal">¦</span><span class="Constant"> 5</span> <span class="Special"><-</span><span class="Constant"> 1</span> <span class="Comment"># cursor-row</span> +<span id="L801" class="LineNr">801 </span> <span class="Conceal">¦</span><span class="Constant"> 6</span> <span class="Special"><-</span><span class="Constant"> 1</span> <span class="Comment"># cursor-column</span> +<span id="L802" class="LineNr">802 </span> <span class="Conceal">¦</span><span class="Constant"> 7</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># top-idx</span> +<span id="L803" class="LineNr">803 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 6</span> <span class="Comment"># width*height</span> +<span id="L804" class="LineNr">804 </span> <span class="Conceal">¦</span><span class="Constant"> 11</span> <span class="Special"><-</span><span class="Constant"> 97</span> <span class="Comment"># 'a'</span> +<span id="L805" class="LineNr">805 </span> <span class="Conceal">¦</span><span class="Constant"> 12</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L806" class="LineNr">806 </span> <span class="Conceal">¦</span><span class="Constant"> 13</span> <span class="Special"><-</span><span class="Constant"> 98</span> <span class="Comment"># 'b'</span> +<span id="L807" class="LineNr">807 </span> <span class="Conceal">¦</span><span class="Constant"> 14</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L808" class="LineNr">808 </span> <span class="Conceal">¦</span><span class="Constant"> 15</span> <span class="Special"><-</span><span class="Constant"> 99</span> <span class="Comment"># 'c'</span> +<span id="L809" class="LineNr">809 </span> <span class="Conceal">¦</span><span class="Constant"> 16</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L810" class="LineNr">810 </span> <span class="Conceal">¦</span><span class="Constant"> 17</span> <span class="Special"><-</span><span class="Constant"> 100</span> <span class="Comment"># 'd'</span> +<span id="L811" class="LineNr">811 </span> <span class="Conceal">¦</span><span class="Constant"> 18</span> <span class="Special"><-</span><span class="Constant"> 7</span> <span class="Comment"># white</span> +<span id="L812" class="LineNr">812 </span> <span class="Conceal">¦</span> <span class="Comment"># rest of screen is empty</span> +<span id="L813" class="LineNr">813 </span> <span class="Conceal">¦</span><span class="Constant"> 19</span> <span class="Special"><-</span><span class="Constant"> 0</span> +<span id="L814" class="LineNr">814 </span> ] +<span id="L815" class="LineNr">815 </span>] +<span id="L816" class="LineNr">816 </span> +<span id="L817" class="LineNr">817 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, n:num<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L818" class="LineNr">818 </span> <span class="Constant">local-scope</span> +<span id="L819" class="LineNr">819 </span> <span class="Constant">load-ingredients</span> +<span id="L820" class="LineNr">820 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L821" class="LineNr">821 </span> <span class="Delimiter">{</span> +<span id="L822" class="LineNr">822 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> +<span id="L823" class="LineNr">823 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? +<span id="L824" class="LineNr">824 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> +<span id="L825" class="LineNr">825 </span> <span class="Delimiter">}</span> +<span id="L826" class="LineNr">826 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L827" class="LineNr">827 </span> <span class="Delimiter">{</span> +<span id="L828" class="LineNr">828 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> +<span id="L829" class="LineNr">829 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? +<span id="L830" class="LineNr">830 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> +<span id="L831" class="LineNr">831 </span> <span class="Delimiter">}</span> +<span id="L832" class="LineNr">832 </span> <span class="Comment"># todo: other bases besides decimal</span> +<span id="L833" class="LineNr">833 </span> s:text <span class="Special"><-</span> to-text n +<span id="L834" class="LineNr">834 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> print <a href='081print.mu.html#L4'>screen</a>, s, color, bg-color +<span id="L835" class="LineNr">835 </span>] +<span id="L836" class="LineNr">836 </span> +<span id="L837" class="LineNr">837 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, n:bool<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L838" class="LineNr">838 </span> <span class="Constant">local-scope</span> +<span id="L839" class="LineNr">839 </span> <span class="Constant">load-ingredients</span> +<span id="L840" class="LineNr">840 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L841" class="LineNr">841 </span> <span class="Delimiter">{</span> +<span id="L842" class="LineNr">842 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> +<span id="L843" class="LineNr">843 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? +<span id="L844" class="LineNr">844 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> +<span id="L845" class="LineNr">845 </span> <span class="Delimiter">}</span> +<span id="L846" class="LineNr">846 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L847" class="LineNr">847 </span> <span class="Delimiter">{</span> +<span id="L848" class="LineNr">848 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> +<span id="L849" class="LineNr">849 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? +<span id="L850" class="LineNr">850 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> +<span id="L851" class="LineNr">851 </span> <span class="Delimiter">}</span> +<span id="L852" class="LineNr">852 </span> n2:num <span class="Special"><-</span> copy n +<span id="L853" class="LineNr">853 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> print <a href='081print.mu.html#L4'>screen</a>, n2, color, bg-color +<span id="L854" class="LineNr">854 </span>] +<span id="L855" class="LineNr">855 </span> +<span id="L856" class="LineNr">856 </span><span class="muRecipe">def</span> print <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a>, n:&:_elem<span class="muRecipe"> -> </span><a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L857" class="LineNr">857 </span> <span class="Constant">local-scope</span> +<span id="L858" class="LineNr">858 </span> <span class="Constant">load-ingredients</span> +<span id="L859" class="LineNr">859 </span> color:num, color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L860" class="LineNr">860 </span> <span class="Delimiter">{</span> +<span id="L861" class="LineNr">861 </span> <span class="Conceal">¦</span> <span class="Comment"># default color to white</span> +<span id="L862" class="LineNr">862 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> color-found? +<span id="L863" class="LineNr">863 </span> <span class="Conceal">¦</span> color <span class="Special"><-</span> copy <span class="Constant">7/white</span> +<span id="L864" class="LineNr">864 </span> <span class="Delimiter">}</span> +<span id="L865" class="LineNr">865 </span> bg-color:num, bg-color-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L866" class="LineNr">866 </span> <span class="Delimiter">{</span> +<span id="L867" class="LineNr">867 </span> <span class="Conceal">¦</span> <span class="Comment"># default bg-color to black</span> +<span id="L868" class="LineNr">868 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> bg-color-found? +<span id="L869" class="LineNr">869 </span> <span class="Conceal">¦</span> bg-color <span class="Special"><-</span> copy <span class="Constant">0/black</span> +<span id="L870" class="LineNr">870 </span> <span class="Delimiter">}</span> +<span id="L871" class="LineNr">871 </span> n2:num <span class="Special"><-</span> copy n +<span id="L872" class="LineNr">872 </span> <a href='081print.mu.html#L4'>screen</a> <span class="Special"><-</span> print <a href='081print.mu.html#L4'>screen</a>, n2, color, bg-color +<span id="L873" class="LineNr">873 </span>] </pre> </body> </html> |