From b7fc9d3b5c4da25af0b919e65996b5dc0c3cf9f5 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 26 May 2017 23:50:50 -0700 Subject: 3879 --- html/065duplex_list.mu.html | 110 ++++++++++++++++++-------------------- html/edit/003-shortcuts.mu.html | 4 +- html/edit/012-editor-undo.mu.html | 8 +-- 3 files changed, 58 insertions(+), 64 deletions(-) (limited to 'html') 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) { 493 ] 494 ] 495 -496 # insert list beginning at 'new' after 'in' -497 def insert-range in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ +496 # insert list beginning at 'start' after 'in' +497 def splice in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ 498 local-scope 499 load-ingredients 500 return-unless in 501 return-unless start -502 end:&:duplex-list:_elem <- copy start -503 { -504 ¦ next:&:duplex-list:_elem <- next end/insert-range +502 end:&:duplex-list:_elem <- last start +503 next:&:duplex-list:_elem <- next in +504 { 505 ¦ break-unless next -506 ¦ end <- copy next -507 ¦ loop +506 ¦ *end <- put *end, next:offset, next +507 ¦ *next <- put *next, prev:offset, end 508 } -509 next:&:duplex-list:_elem <- next in -510 *end <- put *end, next:offset, next -511 { -512 ¦ break-unless next -513 ¦ *next <- put *next, prev:offset, end -514 } -515 *in <- put *in, next:offset, start -516 *start <- put *start, prev:offset, in -517 ] -518 -519 def append in:&:duplex-list:_elem, new:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ -520 local-scope -521 load-ingredients -522 last:&:duplex-list:_elem <- last in -523 *last <- put *last, next:offset, new -524 return-unless new -525 *new <- put *new, prev:offset, last -526 ] -527 -528 def last in:&:duplex-list:_elem -> result:&:duplex-list:_elem [ -529 local-scope -530 load-ingredients -531 result <- copy in -532 { -533 ¦ next:&:duplex-list:_elem <- next result -534 ¦ break-unless next -535 ¦ result <- copy next -536 ¦ loop -537 } -538 ] -539 -540 # helper for debugging -541 def dump-from x:&:duplex-list:_elem [ -542 local-scope -543 load-ingredients -544 $print x, [: ] -545 { -546 ¦ break-unless x -547 ¦ c:_elem <- get *x, value:offset -548 ¦ $print c, [ ] -549 ¦ x <- next x -550 ¦ { -551 ¦ ¦ is-newline?:bool <- equal c, 10/newline -552 ¦ ¦ break-unless is-newline? -553 ¦ ¦ $print 10/newline -554 ¦ ¦ $print x, [: ] -555 ¦ } -556 ¦ loop -557 } -558 $print 10/newline, [---], 10/newline -559 ] +509 *in <- put *in, next:offset, start +510 *start <- put *start, prev:offset, in +511 ] +512 +513 def append in:&:duplex-list:_elem, new:&:duplex-list:_elem/contained-in:in -> in:&:duplex-list:_elem [ +514 local-scope +515 load-ingredients +516 last:&:duplex-list:_elem <- last in +517 *last <- put *last, next:offset, new +518 return-unless new +519 *new <- put *new, prev:offset, last +520 ] +521 +522 def last in:&:duplex-list:_elem -> result:&:duplex-list:_elem [ +523 local-scope +524 load-ingredients +525 result <- copy in +526 { +527 ¦ next:&:duplex-list:_elem <- next result +528 ¦ break-unless next +529 ¦ result <- copy next +530 ¦ loop +531 } +532 ] +533 +534 # helper for debugging +535 def dump-from x:&:duplex-list:_elem [ +536 local-scope +537 load-ingredients +538 $print x, [: ] +539 { +540 ¦ break-unless x +541 ¦ c:_elem <- get *x, value:offset +542 ¦ $print c, [ ] +543 ¦ x <- next x +544 ¦ { +545 ¦ ¦ is-newline?:bool <- equal c, 10/newline +546 ¦ ¦ break-unless is-newline? +547 ¦ ¦ $print 10/newline +548 ¦ ¦ $print x, [: ] +549 ¦ } +550 ¦ loop +551 } +552 $print 10/newline, [---], 10/newline +553 ] 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) { 2990 *editor <- put *editor, before-cursor:offset, before-cursor 2991 # keep one line in common with previous page 2992 { -2993 ¦ last:char <- get *before-cursor, value:offset -2994 ¦ newline?:bool <- equal last, 10/newline +2993 ¦ last:char <- get *before-cursor, value:offset +2994 ¦ newline?:bool <- equal last, 10/newline 2995 ¦ break-unless newline?:bool 2996 ¦ before-cursor <- prev before-cursor 2997 ¦ *editor <- put *editor, before-cursor:offset, 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) { 415 ¦ before-cursor <- get *editor, before-cursor:offset 416 ¦ insert-from:&:duplex-list:char <- get typing, insert-from:offset # ignore insert-to because it's already been spliced away 417 ¦ # assert insert-to matches next(before-cursor) - 418 ¦ insert-range before-cursor, insert-from + 418 ¦ splice before-cursor, insert-from 419 ¦ # assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen 420 ¦ cursor-row <- get typing, after-row:offset 421 ¦ *editor <- put *editor, cursor-row:offset, cursor-row @@ -1699,7 +1699,7 @@ if ('onhashchange' in window) { 1636 ¦ ¦ break-unless coalesce? 1637 ¦ ¦ deletion <- put deletion, delete-from:offset, before-cursor 1638 ¦ ¦ backspaced-so-far:&:duplex-list:char <- get deletion, deleted-text:offset -1639 ¦ ¦ insert-range backspaced-cell, backspaced-so-far +1639 ¦ ¦ splice backspaced-cell, backspaced-so-far 1640 ¦ ¦ deletion <- put deletion, deleted-text:offset, backspaced-cell 1641 ¦ ¦ deletion <- put deletion, after-row:offset, cursor-row 1642 ¦ ¦ deletion <- put deletion, after-column:offset, cursor-column @@ -1723,8 +1723,8 @@ if ('onhashchange' in window) { 1660 ¦ anchor:&:duplex-list:char <- get deletion, delete-from:offset 1661 ¦ break-unless anchor 1662 ¦ deleted:&:duplex-list:char <- get deletion, deleted-text:offset -1663 ¦ old-cursor:&:duplex-list:char <- last deleted -1664 ¦ insert-range anchor, deleted +1663 ¦ old-cursor:&:duplex-list:char <- last deleted +1664 ¦ splice anchor, deleted 1665 ¦ # assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen 1666 ¦ before-cursor <- copy old-cursor 1667 ¦ cursor-row <- get deletion, before-row:offset -- cgit 1.4.1-2-gfad0