From f0c55e6b97edf8971ce4adad3ee53cbfa406b7ef Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 27 Dec 2017 20:38:53 -0800 Subject: 4165 --- html/edit/003-shortcuts.mu.html | 124 ++++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'html/edit/003-shortcuts.mu.html') diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index 89d573d7..ce5f7289 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -120,7 +120,7 @@ if ('onhashchange' in window) { 58 ¦ insert-at-cursor editor, 32/space, screen 59 ¦ go-render? <- insert-at-cursor editor, 32/space, screen 60 ¦ <end-insert-character> - 61 ¦ return + 61 ¦ return 62 } 63 ] 64 @@ -161,7 +161,7 @@ if ('onhashchange' in window) { 99 ¦ <begin-backspace-character> 100 ¦ go-render?:bool, backspaced-cell:&:duplex-list:char <- delete-before-cursor editor, screen 101 ¦ <end-backspace-character> - 102 ¦ return + 102 ¦ return 103 } 104 ] 105 @@ -207,7 +207,7 @@ if ('onhashchange' in window) { 145 ¦ screen <- print screen, currc 146 ¦ curr-column <- add curr-column, 1 147 ¦ curr <- next curr - 148 ¦ loop + 148 ¦ loop 149 } 150 # we're guaranteed not to be at the right margin 151 space:char <- copy 32/space @@ -230,7 +230,7 @@ if ('onhashchange' in window) { 168 ¦ trace 10, [app], [decrementing cursor column] 169 ¦ cursor-column <- subtract cursor-column, 1 170 ¦ *editor <- put *editor, cursor-column:offset, cursor-column - 171 ¦ return + 171 ¦ return 172 } 173 # if at left margin, we must move to previous row: 174 top-of-screen?:bool <- equal cursor-row, 1 # exclude menu bar @@ -267,7 +267,7 @@ if ('onhashchange' in window) { 205 ¦ ¦ cursor-column <- add left, end-of-line 206 ¦ ¦ *editor <- put *editor, cursor-column:offset, cursor-column 207 ¦ } - 208 ¦ return + 208 ¦ return 209 } 210 # case 2: if previous-character was not newline, we're just at a wrapped line 211 trace 10, [app], [wrapping to previous line] @@ -294,7 +294,7 @@ if ('onhashchange' in window) { 232 ¦ at-newline?:bool <- equal c, 10/newline 233 ¦ break-if at-newline? 234 ¦ result <- add result, 1 - 235 ¦ loop + 235 ¦ loop 236 } 237 ] 238 @@ -428,7 +428,7 @@ if ('onhashchange' in window) { 366 ¦ <begin-delete-character> 367 ¦ go-render?:bool, deleted-cell:&:duplex-list:char <- delete-at-cursor editor, screen 368 ¦ <end-delete-character> - 369 ¦ return + 369 ¦ return 370 } 371 ] 372 @@ -461,7 +461,7 @@ if ('onhashchange' in window) { 399 ¦ screen <- print screen, currc 400 ¦ curr-column <- add curr-column, 1 401 ¦ curr <- next curr - 402 ¦ loop + 402 ¦ loop 403 } 404 # we're guaranteed not to be at the right margin 405 space:char <- copy 32/space @@ -508,7 +508,7 @@ if ('onhashchange' in window) { 446 ¦ screen <- move-cursor screen, cursor-row, cursor-column 447 ¦ undo-coalesce-tag:num <- copy 2/right-arrow 448 ¦ <end-move-cursor> - 449 ¦ return + 449 ¦ return 450 } 451 ] 452 @@ -534,7 +534,7 @@ if ('onhashchange' in window) { 472 ¦ <scroll-down> 473 ¦ cursor-row <- subtract cursor-row, 1 # bring back into screen range 474 ¦ *editor <- put *editor, cursor-row:offset, cursor-row - 475 ¦ return 1/go-render + 475 ¦ return 1/go-render 476 } 477 # if the line wraps, move cursor to start of next row 478 { @@ -557,7 +557,7 @@ if ('onhashchange' in window) { 495 ¦ <scroll-down> 496 ¦ cursor-row <- subtract cursor-row, 1 # bring back into screen range 497 ¦ *editor <- put *editor, cursor-row:offset, cursor-row - 498 ¦ return 1/go-render + 498 ¦ return 1/go-render 499 } 500 # otherwise move cursor one character right 501 cursor-column <- add cursor-column, 1 @@ -791,7 +791,7 @@ if ('onhashchange' in window) { 729 ¦ *editor <- put *editor, before-cursor:offset, before-cursor 730 ¦ undo-coalesce-tag:num <- copy 1/left-arrow 731 ¦ <end-move-cursor> - 732 ¦ return + 732 ¦ return 733 } 734 ] 735 @@ -1055,7 +1055,7 @@ if ('onhashchange' in window) { 993 ¦ go-render? <- move-to-previous-line editor 994 ¦ undo-coalesce-tag:num <- copy 3/up-arrow 995 ¦ <end-move-cursor> - 996 ¦ return + 996 ¦ return 997 } 998 ] 999 @@ -1110,15 +1110,15 @@ if ('onhashchange' in window) { 1048 ¦ ¦ *editor <- put *editor, before-cursor:offset, before-cursor 1049 ¦ ¦ cursor-column <- add cursor-column, 1 1050 ¦ ¦ *editor <- put *editor, cursor-column:offset, cursor-column -1051 ¦ ¦ loop +1051 ¦ ¦ loop 1052 ¦ } -1053 ¦ return +1053 ¦ return 1054 } 1055 { 1056 ¦ # if cursor already at top, scroll up 1057 ¦ break-unless already-at-top? 1058 ¦ <scroll-up> -1059 ¦ return 1/go-render +1059 ¦ return 1/go-render 1060 } 1061 ] 1062 @@ -1409,7 +1409,7 @@ if ('onhashchange' in window) { 1347 ¦ go-render? <- move-to-next-line editor, screen-height 1348 ¦ undo-coalesce-tag:num <- copy 4/down-arrow 1349 ¦ <end-move-cursor> -1350 ¦ return +1350 ¦ return 1351 } 1352 ] 1353 @@ -1428,11 +1428,11 @@ if ('onhashchange' in window) { 1366 ¦ break-if before-cursor 1367 ¦ { 1368 ¦ ¦ break-if at-bottom-of-screen? -1369 ¦ ¦ return 0/don't-render +1369 ¦ ¦ return 0/don't-render 1370 ¦ } 1371 ¦ { 1372 ¦ ¦ break-unless at-bottom-of-screen? -1373 ¦ ¦ jump +try-to-scroll +1373 ¦ ¦ jump +try-to-scroll 1374 ¦ } 1375 } 1376 next:&:duplex-list:char <- next before-cursor @@ -1440,11 +1440,11 @@ if ('onhashchange' in window) { 1378 ¦ break-if next 1379 ¦ { 1380 ¦ ¦ break-if at-bottom-of-screen? -1381 ¦ ¦ return 0/don't-render +1381 ¦ ¦ return 0/don't-render 1382 ¦ } 1383 ¦ { 1384 ¦ ¦ break-unless at-bottom-of-screen? -1385 ¦ ¦ jump +try-to-scroll +1385 ¦ ¦ jump +try-to-scroll 1386 ¦ } 1387 } 1388 already-at-bottom?:bool <- greater-or-equal cursor-row, last-line @@ -1463,17 +1463,17 @@ if ('onhashchange' in window) { 1401 ¦ ¦ c:char <- get *next, value:offset 1402 ¦ ¦ at-newline?:bool <- equal c, 10/newline 1403 ¦ ¦ break-if at-newline? -1404 ¦ ¦ loop +1404 ¦ ¦ loop 1405 ¦ } 1406 ¦ { 1407 ¦ ¦ break-if next 1408 ¦ ¦ { 1409 ¦ ¦ ¦ break-if at-bottom-of-screen? -1410 ¦ ¦ ¦ return 0/don't-render +1410 ¦ ¦ ¦ return 0/don't-render 1411 ¦ ¦ } 1412 ¦ ¦ { 1413 ¦ ¦ ¦ break-unless at-bottom-of-screen? -1414 ¦ ¦ ¦ jump +try-to-scroll +1414 ¦ ¦ ¦ jump +try-to-scroll 1415 ¦ ¦ } 1416 ¦ } 1417 ¦ cursor-row <- add cursor-row, 1 @@ -1488,12 +1488,12 @@ if ('onhashchange' in window) { 1426 ¦ ¦ break-if done? 1427 ¦ ¦ cursor-column <- add cursor-column, 1 1428 ¦ ¦ before-cursor <- copy next -1429 ¦ ¦ loop +1429 ¦ ¦ loop 1430 ¦ } 1431 ¦ *editor <- put *editor, before-cursor:offset, before-cursor 1432 ¦ *editor <- put *editor, cursor-column:offset, cursor-column 1433 ¦ *editor <- put *editor, cursor-row:offset, cursor-row -1434 ¦ return 0/don't-render +1434 ¦ return 0/don't-render 1435 } 1436 +try-to-scroll 1437 <scroll-down> @@ -1606,7 +1606,7 @@ if ('onhashchange' in window) { 1544 ¦ move-to-start-of-screen-line editor 1545 ¦ undo-coalesce-tag:num <- copy 0/never 1546 ¦ <end-move-cursor> -1547 ¦ return 0/don't-render +1547 ¦ return 0/don't-render 1548 } 1549 ] 1550 @@ -1618,7 +1618,7 @@ if ('onhashchange' in window) { 1556 ¦ move-to-start-of-screen-line editor 1557 ¦ undo-coalesce-tag:num <- copy 0/never 1558 ¦ <end-move-cursor> -1559 ¦ return 0/don't-render +1559 ¦ return 0/don't-render 1560 } 1561 ] 1562 @@ -1639,7 +1639,7 @@ if ('onhashchange' in window) { 1577 ¦ assert curr, [move-to-start-of-line tried to move before start of text] 1578 ¦ curr <- prev curr 1579 ¦ col <- subtract col, 1 -1580 ¦ loop +1580 ¦ loop 1581 } 1582 *editor <- put *editor, cursor-column:offset, col 1583 *editor <- put *editor, before-cursor:offset, curr @@ -1831,7 +1831,7 @@ if ('onhashchange' in window) { 1769 ¦ move-to-end-of-line editor 1770 ¦ undo-coalesce-tag:num <- copy 0/never 1771 ¦ <end-move-cursor> -1772 ¦ return 0/don't-render +1772 ¦ return 0/don't-render 1773 } 1774 ] 1775 @@ -1843,7 +1843,7 @@ if ('onhashchange' in window) { 1781 ¦ move-to-end-of-line editor 1782 ¦ undo-coalesce-tag:num <- copy 0/never 1783 ¦ <end-move-cursor> -1784 ¦ return 0/don't-render +1784 ¦ return 0/don't-render 1785 } 1786 ] 1787 @@ -1866,7 +1866,7 @@ if ('onhashchange' in window) { 1804 ¦ *editor <- put *editor, cursor-column:offset, cursor-column 1805 ¦ before-cursor <- copy next 1806 ¦ *editor <- put *editor, before-cursor:offset, before-cursor -1807 ¦ loop +1807 ¦ loop 1808 } 1809 ] 1810 @@ -2026,7 +2026,7 @@ if ('onhashchange' in window) { 1964 ¦ deleted-cells:&:duplex-list:char <- delete-to-start-of-line editor 1965 ¦ <end-delete-to-start-of-line> 1966 ¦ go-render?:bool <- minimal-render-for-ctrl-u screen, editor, deleted-cells -1967 ¦ return +1967 ¦ return 1968 } 1969 ] 1970 @@ -2050,7 +2050,7 @@ if ('onhashchange' in window) { 1988 ¦ break-if b 1989 ¦ buf <- append buf, c 1990 ¦ i <- add i, 1 -1991 ¦ loop +1991 ¦ loop 1992 } 1993 # if the line used to be wrapped, give up and render the whole screen 1994 num-deleted-cells:num <- length deleted-cells @@ -2062,7 +2062,7 @@ if ('onhashchange' in window) { 2000 curr-line:text <- buffer-to-array buf 2001 curr-row:num <- get *editor, cursor-row:offset 2002 render-code screen, curr-line, curr-column, right, curr-row -2003 return 0/dont-render +2003 return 0/dont-render 2004 ] 2005 2006 def delete-to-start-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ @@ -2086,7 +2086,7 @@ if ('onhashchange' in window) { 2024 ¦ update-top-of-screen?:bool <- or update-top-of-screen?, at-top-of-screen? 2025 ¦ start <- prev start 2026 ¦ assert start, [delete-to-start-of-line tried to move before start of text] -2027 ¦ loop +2027 ¦ loop 2028 } 2029 # snip it out 2030 result:&:duplex-list:char <- next start @@ -2150,13 +2150,13 @@ if ('onhashchange' in window) { 2088 ¦ ¦ ¦ space:char <- copy 32/space 2089 ¦ ¦ ¦ print screen, space 2090 ¦ ¦ ¦ column <- add column, 1 -2091 ¦ ¦ ¦ loop +2091 ¦ ¦ ¦ loop 2092 ¦ ¦ } 2093 ¦ ¦ row <- add row, 1 2094 ¦ ¦ column <- copy left 2095 ¦ ¦ screen <- move-cursor screen, row, column 2096 ¦ ¦ i <- add i, 1 -2097 ¦ ¦ loop +next-character +2097 ¦ ¦ loop +next-character 2098 ¦ } 2099 ¦ { 2100 ¦ ¦ # at right? wrap. @@ -2169,12 +2169,12 @@ if ('onhashchange' in window) { 2107 ¦ ¦ row <- add row, 1 2108 ¦ ¦ screen <- move-cursor screen, row, column 2109 ¦ ¦ # don't increment i -2110 ¦ ¦ loop +next-character +2110 ¦ ¦ loop +next-character 2111 ¦ } 2112 ¦ i <- add i, 1 2113 ¦ print screen, c, color 2114 ¦ column <- add column, 1 -2115 ¦ loop +2115 ¦ loop 2116 } 2117 was-at-left?:bool <- equal column, left 2118 clear-line-until screen, right @@ -2604,7 +2604,7 @@ if ('onhashchange' in window) { 2542 ¦ <end-delete-to-end-of-line> 2543 ¦ # checks if we can do a minimal render and if we can it will do a minimal render 2544 ¦ go-render?:bool <- minimal-render-for-ctrl-k screen, editor, deleted-cells -2545 ¦ return +2545 ¦ return 2546 } 2547 ] 2548 @@ -2623,7 +2623,7 @@ if ('onhashchange' in window) { 2561 wrap?:bool <- greater-or-equal old-row-len, end 2562 return-if wrap?, 1/go-render 2563 clear-line-until screen, right -2564 return 0/dont-render +2564 return 0/dont-render 2565 ] 2566 2567 def delete-to-end-of-line editor:&:editor -> result:&:duplex-list:char, editor:&:editor [ @@ -2639,7 +2639,7 @@ if ('onhashchange' in window) { 2577 ¦ at-end-of-line?:bool <- equal curr, 10/newline 2578 ¦ break-if at-end-of-line? 2579 ¦ end <- next end -2580 ¦ loop +2580 ¦ loop 2581 } 2582 # snip it out 2583 result <- next start @@ -2885,10 +2885,10 @@ if ('onhashchange' in window) { 2823 ¦ break-if at-newline? 2824 ¦ curr <- next curr 2825 ¦ count <- add count, 1 -2826 ¦ loop +2826 ¦ loop 2827 } 2828 return-unless curr, original -2829 return curr +2829 return curr 2830 ] 2831 2832 scenario editor-scrolls-down-past-wrapped-line-using-arrow-keys [ @@ -3252,7 +3252,7 @@ if ('onhashchange' in window) { 3190 ¦ # empty line; just skip this newline 3191 ¦ prev:&:duplex-list:char <- prev curr 3192 ¦ return-unless prev, curr -3193 ¦ return prev +3193 ¦ return prev 3194 } 3195 _, max:num <- divide-with-remainder len, max-line-length 3196 # remainder 0 => scan one width-worth @@ -3270,9 +3270,9 @@ if ('onhashchange' in window) { 3208 ¦ break-unless prev 3209 ¦ curr <- copy prev 3210 ¦ count <- add count, 1 -3211 ¦ loop +3211 ¦ loop 3212 } -3213 return curr +3213 return curr 3214 ] 3215 3216 scenario editor-scrolls-up-past-wrapped-line-using-arrow-keys [ @@ -3635,7 +3635,7 @@ if ('onhashchange' in window) { 3573 ¦ <end-move-cursor> 3574 ¦ top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset 3575 ¦ movement?:bool <- not-equal top-of-screen, old-top -3576 ¦ return movement?/go-render +3576 ¦ return movement?/go-render 3577 } 3578 ] 3579 @@ -3650,7 +3650,7 @@ if ('onhashchange' in window) { 3588 ¦ <end-move-cursor> 3589 ¦ top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset 3590 ¦ movement?:bool <- not-equal top-of-screen, old-top -3591 ¦ return movement?/go-render +3591 ¦ return movement?/go-render 3592 } 3593 ] 3594 @@ -3701,7 +3701,7 @@ if ('onhashchange' in window) { 3639 ¦ before-cursor <- prev before-cursor 3640 ¦ *editor <- put *editor, before-cursor:offset, before-cursor 3641 ¦ assert before-cursor, [move-to-start-of-line tried to move before start of text] -3642 ¦ loop +3642 ¦ loop 3643 } 3644 ] 3645 @@ -3859,7 +3859,7 @@ if ('onhashchange' in window) { 3797 ¦ <end-move-cursor> 3798 ¦ top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset 3799 ¦ movement?:bool <- not-equal top-of-screen, old-top -3800 ¦ return movement?/go-render +3800 ¦ return movement?/go-render 3801 } 3802 ] 3803 @@ -3875,7 +3875,7 @@ if ('onhashchange' in window) { 3813 ¦ top-of-screen:&:duplex-list:char <- get *editor, top-of-screen:offset 3814 ¦ movement?:bool <- not-equal top-of-screen, old-top 3815 ¦ # don't bother re-rendering if nothing changed. todo: test this -3816 ¦ return movement?/go-render +3816 ¦ return movement?/go-render 3817 } 3818 ] 3819 @@ -3893,7 +3893,7 @@ if ('onhashchange' in window) { 3831 ¦ top-of-screen <- copy prev 3832 ¦ *editor <- put *editor, top-of-screen:offset, top-of-screen 3833 ¦ count <- add count, 1 -3834 ¦ loop +3834 ¦ loop 3835 } 3836 ] 3837 @@ -4204,7 +4204,7 @@ if ('onhashchange' in window) { 4142 ¦ go-render?:bool, editor <- line-up editor, screen-height 4143 ¦ undo-coalesce-tag:num <- copy 5/line-up 4144 ¦ <end-move-cursor> -4145 ¦ return go-render? +4145 ¦ return go-render? 4146 } 4147 ] 4148 @@ -4221,7 +4221,7 @@ if ('onhashchange' in window) { 4159 ¦ break-unless movement? 4160 ¦ *editor <- put *editor, top-of-screen:offset, new-top 4161 } -4162 return movement? +4162 return movement? 4163 ] 4164 4165 # ctrl-x - scroll down by one line @@ -4235,7 +4235,7 @@ if ('onhashchange' in window) { 4173 ¦ go-render?:bool, editor <- line-down editor, screen-height 4174 ¦ undo-coalesce-tag:num <- copy 6/line-down 4175 ¦ <end-move-cursor> -4176 ¦ return go-render? +4176 ¦ return go-render? 4177 } 4178 ] 4179 @@ -4249,7 +4249,7 @@ if ('onhashchange' in window) { 4187 ¦ break-unless movement? 4188 ¦ *editor <- put *editor, top-of-screen:offset, new-top 4189 } -4190 return movement? +4190 return movement? 4191 ] 4192 4193 # ctrl-t - move current line to top of screen @@ -4269,7 +4269,7 @@ if ('onhashchange' in window) { 4207 ¦ go-render?:bool <- not-equal new-top, old-top 4208 ¦ undo-coalesce-tag:num <- copy 0/never 4209 ¦ <end-move-cursor> -4210 ¦ return go-render? +4210 ¦ return go-render? 4211 } 4212 ] 4213 @@ -4302,7 +4302,7 @@ if ('onhashchange' in window) { 4240 ¦ ¦ go-render? <- render-line-from-start screen, editor, 0 4241 ¦ } 4242 ¦ <end-insert-character> -4243 ¦ return +4243 ¦ return 4244 } 4245 ] 4246 @@ -4333,10 +4333,10 @@ if ('onhashchange' in window) { 4271 ¦ print screen, c, color 4272 ¦ curr <- next curr 4273 ¦ i <- add i, 1 -4274 ¦ loop +4274 ¦ loop 4275 } 4276 clear-line-until screen, right -4277 return 0/dont-render +4277 return 0/dont-render 4278 ] 4279 4280 def before-start-of-screen-line editor:&:editor -> result:&:duplex-list:char [ -- cgit 1.4.1-2-gfad0