diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-05-26 23:50:50 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-05-26 23:50:50 -0700 |
commit | b7fc9d3b5c4da25af0b919e65996b5dc0c3cf9f5 (patch) | |
tree | 5edcd98f4a593b50f813bf2b72af84fdfbda5668 | |
parent | 5e7f0caab592c636f827d2c7814bc33eb96382d1 (diff) | |
download | mu-b7fc9d3b5c4da25af0b919e65996b5dc0c3cf9f5.tar.gz |
3879
-rw-r--r-- | 065duplex_list.mu | 14 | ||||
-rw-r--r-- | edit/012-editor-undo.mu | 6 | ||||
-rw-r--r-- | html/065duplex_list.mu.html | 110 | ||||
-rw-r--r-- | html/edit/003-shortcuts.mu.html | 4 | ||||
-rw-r--r-- | html/edit/012-editor-undo.mu.html | 8 | ||||
-rw-r--r-- | sandbox/012-editor-undo.mu | 6 |
6 files changed, 68 insertions, 80 deletions
diff --git a/065duplex_list.mu b/065duplex_list.mu index 58b5468e..85683786 100644 --- a/065duplex_list.mu +++ b/065duplex_list.mu @@ -493,23 +493,17 @@ scenario remove-range-to-end [ ] ] -# insert list beginning at 'new' after 'in' -def insert-range in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ +# insert list beginning at 'start' after 'in' +def splice in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ local-scope load-ingredients return-unless in return-unless start - end:&:duplex-list:_elem <- copy start - { - next:&:duplex-list:_elem <- next end/insert-range - break-unless next - end <- copy next - loop - } + end:&:duplex-list:_elem <- last start next:&:duplex-list:_elem <- next in - *end <- put *end, next:offset, next { break-unless next + *end <- put *end, next:offset, next *next <- put *next, prev:offset, end } *in <- put *in, next:offset, start diff --git a/edit/012-editor-undo.mu b/edit/012-editor-undo.mu index c2f6bca3..69e1c22b 100644 --- a/edit/012-editor-undo.mu +++ b/edit/012-editor-undo.mu @@ -415,7 +415,7 @@ after <handle-redo> [ before-cursor <- get *editor, before-cursor:offset insert-from:&:duplex-list:char <- get typing, insert-from:offset # ignore insert-to because it's already been spliced away # assert insert-to matches next(before-cursor) - insert-range before-cursor, insert-from + splice before-cursor, insert-from # assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen cursor-row <- get typing, after-row:offset *editor <- put *editor, cursor-row:offset, cursor-row @@ -1636,7 +1636,7 @@ before <backspace-character-end> [ break-unless coalesce? deletion <- put deletion, delete-from:offset, before-cursor backspaced-so-far:&:duplex-list:char <- get deletion, deleted-text:offset - insert-range backspaced-cell, backspaced-so-far + splice backspaced-cell, backspaced-so-far deletion <- put deletion, deleted-text:offset, backspaced-cell deletion <- put deletion, after-row:offset, cursor-row deletion <- put deletion, after-column:offset, cursor-column @@ -1661,7 +1661,7 @@ after <handle-undo> [ break-unless anchor deleted:&:duplex-list:char <- get deletion, deleted-text:offset old-cursor:&:duplex-list:char <- last deleted - insert-range anchor, deleted + splice anchor, deleted # assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen before-cursor <- copy old-cursor cursor-row <- get deletion, before-row:offset diff --git a/html/065duplex_list.mu.html b/html/065duplex_list.mu.html index 55bb4707..8f0cf4a8 100644 --- a/html/065duplex_list.mu.html +++ b/html/065duplex_list.mu.html @@ -555,70 +555,64 @@ if ('onhashchange' in window) { <span id="L493" class="LineNr">493 </span> ] <span id="L494" class="LineNr">494 </span>] <span id="L495" class="LineNr">495 </span> -<span id="L496" class="LineNr">496 </span><span class="Comment"># insert list beginning at 'new' after 'in'</span> -<span id="L497" class="LineNr">497 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L497'>insert-range</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ +<span id="L496" class="LineNr">496 </span><span class="Comment"># insert list beginning at 'start' after 'in'</span> +<span id="L497" class="LineNr">497 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L497'>splice</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L498" class="LineNr">498 </span> <span class="Constant">local-scope</span> <span id="L499" class="LineNr">499 </span> <span class="Constant">load-ingredients</span> <span id="L500" class="LineNr">500 </span> <span class="muControl">return-unless</span> in <span id="L501" class="LineNr">501 </span> <span class="muControl">return-unless</span> start -<span id="L502" class="LineNr">502 </span> end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> copy start -<span id="L503" class="LineNr">503 </span> <span class="Delimiter">{</span> -<span id="L504" class="LineNr">504 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> end/insert-range +<span id="L502" class="LineNr">502 </span> end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L522'>last</a> start +<span id="L503" class="LineNr">503 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> in +<span id="L504" class="LineNr">504 </span> <span class="Delimiter">{</span> <span id="L505" class="LineNr">505 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> -<span id="L506" class="LineNr">506 </span> <span class="Conceal">¦</span> end <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L29'>next</a> -<span id="L507" class="LineNr">507 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> +<span id="L506" class="LineNr">506 </span> <span class="Conceal">¦</span> *end <span class="Special"><-</span> put *end, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, <a href='065duplex_list.mu.html#L29'>next</a> +<span id="L507" class="LineNr">507 </span> <span class="Conceal">¦</span> *next <span class="Special"><-</span> put *next, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, end <span id="L508" class="LineNr">508 </span> <span class="Delimiter">}</span> -<span id="L509" class="LineNr">509 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> in -<span id="L510" class="LineNr">510 </span> *end <span class="Special"><-</span> put *end, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, <a href='065duplex_list.mu.html#L29'>next</a> -<span id="L511" class="LineNr">511 </span> <span class="Delimiter">{</span> -<span id="L512" class="LineNr">512 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> -<span id="L513" class="LineNr">513 </span> <span class="Conceal">¦</span> *next <span class="Special"><-</span> put *next, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, end -<span id="L514" class="LineNr">514 </span> <span class="Delimiter">}</span> -<span id="L515" class="LineNr">515 </span> *in <span class="Special"><-</span> put *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, start -<span id="L516" class="LineNr">516 </span> *start <span class="Special"><-</span> put *start, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, in -<span id="L517" class="LineNr">517 </span>] -<span id="L518" class="LineNr">518 </span> -<span id="L519" class="LineNr">519 </span><span class="muRecipe">def</span> append in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, new:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ -<span id="L520" class="LineNr">520 </span> <span class="Constant">local-scope</span> -<span id="L521" class="LineNr">521 </span> <span class="Constant">load-ingredients</span> -<span id="L522" class="LineNr">522 </span> <a href='065duplex_list.mu.html#L528'>last</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L528'>last</a> in -<span id="L523" class="LineNr">523 </span> *last <span class="Special"><-</span> put *last, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, new -<span id="L524" class="LineNr">524 </span> <span class="muControl">return-unless</span> new -<span id="L525" class="LineNr">525 </span> *new <span class="Special"><-</span> put *new, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, <a href='065duplex_list.mu.html#L528'>last</a> -<span id="L526" class="LineNr">526 </span>] -<span id="L527" class="LineNr">527 </span> -<span id="L528" class="LineNr">528 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L528'>last</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ -<span id="L529" class="LineNr">529 </span> <span class="Constant">local-scope</span> -<span id="L530" class="LineNr">530 </span> <span class="Constant">load-ingredients</span> -<span id="L531" class="LineNr">531 </span> result <span class="Special"><-</span> copy in -<span id="L532" class="LineNr">532 </span> <span class="Delimiter">{</span> -<span id="L533" class="LineNr">533 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> result -<span id="L534" class="LineNr">534 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> -<span id="L535" class="LineNr">535 </span> <span class="Conceal">¦</span> result <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L29'>next</a> -<span id="L536" class="LineNr">536 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> -<span id="L537" class="LineNr">537 </span> <span class="Delimiter">}</span> -<span id="L538" class="LineNr">538 </span>] -<span id="L539" class="LineNr">539 </span> -<span id="L540" class="LineNr">540 </span><span class="Comment"># helper for debugging</span> -<span id="L541" class="LineNr">541 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L541'>dump-from</a> x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ -<span id="L542" class="LineNr">542 </span> <span class="Constant">local-scope</span> -<span id="L543" class="LineNr">543 </span> <span class="Constant">load-ingredients</span> -<span id="L544" class="LineNr">544 </span> $print x, <span class="Constant">[: ]</span> -<span id="L545" class="LineNr">545 </span> <span class="Delimiter">{</span> -<span id="L546" class="LineNr">546 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> x -<span id="L547" class="LineNr">547 </span> <span class="Conceal">¦</span> c:_elem <span class="Special"><-</span> get *x, <span class="Constant">value:offset</span> -<span id="L548" class="LineNr">548 </span> <span class="Conceal">¦</span> $print c, <span class="Constant">[ ]</span> -<span id="L549" class="LineNr">549 </span> <span class="Conceal">¦</span> x <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> x -<span id="L550" class="LineNr">550 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> -<span id="L551" class="LineNr">551 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> is-newline?:bool <span class="Special"><-</span> equal c, <span class="Constant">10/newline</span> -<span id="L552" class="LineNr">552 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> is-newline? -<span id="L553" class="LineNr">553 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> $print <span class="Constant">10/newline</span> -<span id="L554" class="LineNr">554 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> $print x, <span class="Constant">[: ]</span> -<span id="L555" class="LineNr">555 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> -<span id="L556" class="LineNr">556 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> -<span id="L557" class="LineNr">557 </span> <span class="Delimiter">}</span> -<span id="L558" class="LineNr">558 </span> $print <span class="Constant">10/newline</span>, <span class="Constant">[---]</span>, <span class="Constant">10/newline</span> -<span id="L559" class="LineNr">559 </span>] +<span id="L509" class="LineNr">509 </span> *in <span class="Special"><-</span> put *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, start +<span id="L510" class="LineNr">510 </span> *start <span class="Special"><-</span> put *start, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, in +<span id="L511" class="LineNr">511 </span>] +<span id="L512" class="LineNr">512 </span> +<span id="L513" class="LineNr">513 </span><span class="muRecipe">def</span> append in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, new:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ +<span id="L514" class="LineNr">514 </span> <span class="Constant">local-scope</span> +<span id="L515" class="LineNr">515 </span> <span class="Constant">load-ingredients</span> +<span id="L516" class="LineNr">516 </span> <a href='065duplex_list.mu.html#L522'>last</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L522'>last</a> in +<span id="L517" class="LineNr">517 </span> *last <span class="Special"><-</span> put *last, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, new +<span id="L518" class="LineNr">518 </span> <span class="muControl">return-unless</span> new +<span id="L519" class="LineNr">519 </span> *new <span class="Special"><-</span> put *new, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, <a href='065duplex_list.mu.html#L522'>last</a> +<span id="L520" class="LineNr">520 </span>] +<span id="L521" class="LineNr">521 </span> +<span id="L522" class="LineNr">522 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L522'>last</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ +<span id="L523" class="LineNr">523 </span> <span class="Constant">local-scope</span> +<span id="L524" class="LineNr">524 </span> <span class="Constant">load-ingredients</span> +<span id="L525" class="LineNr">525 </span> result <span class="Special"><-</span> copy in +<span id="L526" class="LineNr">526 </span> <span class="Delimiter">{</span> +<span id="L527" class="LineNr">527 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> result +<span id="L528" class="LineNr">528 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> +<span id="L529" class="LineNr">529 </span> <span class="Conceal">¦</span> result <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L29'>next</a> +<span id="L530" class="LineNr">530 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> +<span id="L531" class="LineNr">531 </span> <span class="Delimiter">}</span> +<span id="L532" class="LineNr">532 </span>] +<span id="L533" class="LineNr">533 </span> +<span id="L534" class="LineNr">534 </span><span class="Comment"># helper for debugging</span> +<span id="L535" class="LineNr">535 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L535'>dump-from</a> x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ +<span id="L536" class="LineNr">536 </span> <span class="Constant">local-scope</span> +<span id="L537" class="LineNr">537 </span> <span class="Constant">load-ingredients</span> +<span id="L538" class="LineNr">538 </span> $print x, <span class="Constant">[: ]</span> +<span id="L539" class="LineNr">539 </span> <span class="Delimiter">{</span> +<span id="L540" class="LineNr">540 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> x +<span id="L541" class="LineNr">541 </span> <span class="Conceal">¦</span> c:_elem <span class="Special"><-</span> get *x, <span class="Constant">value:offset</span> +<span id="L542" class="LineNr">542 </span> <span class="Conceal">¦</span> $print c, <span class="Constant">[ ]</span> +<span id="L543" class="LineNr">543 </span> <span class="Conceal">¦</span> x <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> x +<span id="L544" class="LineNr">544 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> +<span id="L545" class="LineNr">545 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> is-newline?:bool <span class="Special"><-</span> equal c, <span class="Constant">10/newline</span> +<span id="L546" class="LineNr">546 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> is-newline? +<span id="L547" class="LineNr">547 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> $print <span class="Constant">10/newline</span> +<span id="L548" class="LineNr">548 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> $print x, <span class="Constant">[: ]</span> +<span id="L549" class="LineNr">549 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> +<span id="L550" class="LineNr">550 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> +<span id="L551" class="LineNr">551 </span> <span class="Delimiter">}</span> +<span id="L552" class="LineNr">552 </span> $print <span class="Constant">10/newline</span>, <span class="Constant">[---]</span>, <span class="Constant">10/newline</span> +<span id="L553" class="LineNr">553 </span>] </pre> </body> </html> diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index 3ad4d89e..bf5f463c 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -3052,8 +3052,8 @@ if ('onhashchange' in window) { <span id="L2990" class="LineNr">2990 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor <span id="L2991" class="LineNr">2991 </span> <span class="Comment"># keep one line in common with previous page</span> <span id="L2992" class="LineNr">2992 </span> <span class="Delimiter">{</span> -<span id="L2993" class="LineNr">2993 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L528'>last</a>:char <span class="Special"><-</span> get *before-cursor, <span class="Constant">value:offset</span> -<span id="L2994" class="LineNr">2994 </span> <span class="Conceal">¦</span> newline?:bool <span class="Special"><-</span> equal <a href='../065duplex_list.mu.html#L528'>last</a>, <span class="Constant">10/newline</span> +<span id="L2993" class="LineNr">2993 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L522'>last</a>:char <span class="Special"><-</span> get *before-cursor, <span class="Constant">value:offset</span> +<span id="L2994" class="LineNr">2994 </span> <span class="Conceal">¦</span> newline?:bool <span class="Special"><-</span> equal <a href='../065duplex_list.mu.html#L522'>last</a>, <span class="Constant">10/newline</span> <span id="L2995" class="LineNr">2995 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> newline?:bool <span id="L2996" class="LineNr">2996 </span> <span class="Conceal">¦</span> before-cursor <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> before-cursor <span id="L2997" class="LineNr">2997 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index af9e02dd..2eb92fd0 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -478,7 +478,7 @@ if ('onhashchange' in window) { <span id="L415" class="LineNr"> 415 </span> <span class="Conceal">¦</span> before-cursor <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L416" class="LineNr"> 416 </span> <span class="Conceal">¦</span> insert-from:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get typing, <span class="Constant">insert-from:offset</span> <span class="Comment"># ignore insert-to because it's already been spliced away</span> <span id="L417" class="LineNr"> 417 </span> <span class="Conceal">¦</span> <span class="Comment"># assert insert-to matches next(before-cursor)</span> -<span id="L418" class="LineNr"> 418 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>insert-range</a> before-cursor, insert-from +<span id="L418" class="LineNr"> 418 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>splice</a> before-cursor, insert-from <span id="L419" class="LineNr"> 419 </span> <span class="Conceal">¦</span> <span class="Comment"># assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen</span> <span id="L420" class="LineNr"> 420 </span> <span class="Conceal">¦</span> cursor-row <span class="Special"><-</span> get typing, <span class="Constant">after-row:offset</span> <span id="L421" class="LineNr"> 421 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row @@ -1699,7 +1699,7 @@ if ('onhashchange' in window) { <span id="L1636" class="LineNr">1636 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> coalesce? <span id="L1637" class="LineNr">1637 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">delete-from:offset</span>, before-cursor <span id="L1638" class="LineNr">1638 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> backspaced-so-far:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">deleted-text:offset</span> -<span id="L1639" class="LineNr">1639 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>insert-range</a> backspaced-cell, backspaced-so-far +<span id="L1639" class="LineNr">1639 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>splice</a> backspaced-cell, backspaced-so-far <span id="L1640" class="LineNr">1640 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">deleted-text:offset</span>, backspaced-cell <span id="L1641" class="LineNr">1641 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">after-row:offset</span>, cursor-row <span id="L1642" class="LineNr">1642 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">after-column:offset</span>, cursor-column @@ -1723,8 +1723,8 @@ if ('onhashchange' in window) { <span id="L1660" class="LineNr">1660 </span> <span class="Conceal">¦</span> anchor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">delete-from:offset</span> <span id="L1661" class="LineNr">1661 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> anchor <span id="L1662" class="LineNr">1662 </span> <span class="Conceal">¦</span> deleted:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">deleted-text:offset</span> -<span id="L1663" class="LineNr">1663 </span> <span class="Conceal">¦</span> old-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L528'>last</a> deleted -<span id="L1664" class="LineNr">1664 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>insert-range</a> anchor, deleted +<span id="L1663" class="LineNr">1663 </span> <span class="Conceal">¦</span> old-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L522'>last</a> deleted +<span id="L1664" class="LineNr">1664 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>splice</a> anchor, deleted <span id="L1665" class="LineNr">1665 </span> <span class="Conceal">¦</span> <span class="Comment"># assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen</span> <span id="L1666" class="LineNr">1666 </span> <span class="Conceal">¦</span> before-cursor <span class="Special"><-</span> copy old-cursor <span id="L1667" class="LineNr">1667 </span> <span class="Conceal">¦</span> cursor-row <span class="Special"><-</span> get deletion, <span class="Constant">before-row:offset</span> diff --git a/sandbox/012-editor-undo.mu b/sandbox/012-editor-undo.mu index bf64cd75..a64b40d4 100644 --- a/sandbox/012-editor-undo.mu +++ b/sandbox/012-editor-undo.mu @@ -415,7 +415,7 @@ after <handle-redo> [ before-cursor <- get *editor, before-cursor:offset insert-from:&:duplex-list:char <- get typing, insert-from:offset # ignore insert-to because it's already been spliced away # assert insert-to matches next(before-cursor) - insert-range before-cursor, insert-from + splice before-cursor, insert-from # assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen cursor-row <- get typing, after-row:offset *editor <- put *editor, cursor-row:offset, cursor-row @@ -1434,7 +1434,7 @@ before <backspace-character-end> [ break-unless coalesce? deletion <- put deletion, delete-from:offset, before-cursor backspaced-so-far:&:duplex-list:char <- get deletion, deleted-text:offset - insert-range backspaced-cell, backspaced-so-far + splice backspaced-cell, backspaced-so-far deletion <- put deletion, deleted-text:offset, backspaced-cell deletion <- put deletion, after-row:offset, cursor-row deletion <- put deletion, after-column:offset, cursor-column @@ -1459,7 +1459,7 @@ after <handle-undo> [ break-unless anchor deleted:&:duplex-list:char <- get deletion, deleted-text:offset old-cursor:&:duplex-list:char <- last deleted - insert-range anchor, deleted + splice anchor, deleted # assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen before-cursor <- copy old-cursor cursor-row <- get deletion, before-row:offset |