From 996ce5f101e597cf70bda0864f964b356a1005a3 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 6 May 2017 15:03:13 -0700 Subject: 3845 --- html/edit/005-sandbox.mu.html | 672 +++++++++++++++++++++--------------------- 1 file changed, 337 insertions(+), 335 deletions(-) (limited to 'html/edit/005-sandbox.mu.html') diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index d5e2f517..cc3613d8 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -75,7 +75,7 @@ if ('onhashchange' in window) { 12 open-console 13 env:&:environment <- new-programming-environment 0/filesystem, 0/screen 14 env <- restore-sandboxes env - 15 render-all 0/screen, env, render + 15 render-all 0/screen, env, render 16 event-loop 0/screen, 0/console, env, 0/filesystem 17 # never gets here 18 ] @@ -185,7 +185,7 @@ if ('onhashchange' in window) { 122 ] 123 ] 124 - 125 after <global-keypress> [ + 125 after <global-keypress> [ 126 # F4? load all code and run all sandboxes. 127 { 128 ¦ do-run?:bool <- equal k, 65532/F4 @@ -193,12 +193,12 @@ if ('onhashchange' in window) { 130 ¦ screen <- update-status screen, [running... ], 245/grey 131 ¦ error?:bool <- run-sandboxes env, resources, screen 132 ¦ # F4 might update warnings and results on both sides - 133 ¦ screen <- render-all screen, env, render + 133 ¦ screen <- render-all screen, env, render 134 ¦ { 135 ¦ ¦ break-if error? 136 ¦ ¦ screen <- update-status screen, [ ], 245/grey 137 ¦ } - 138 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + 138 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env 139 ¦ loop +next-event 140 } 141 ] @@ -802,7 +802,7 @@ if ('onhashchange' in window) { 739 assume-resources [ 740 ] 741 env:&:environment <- new-programming-environment resources, screen, [] - 742 render-all screen, env, render + 742 render-all screen, env, render 743 assume-console [ 744 ¦ press enter 745 ¦ press down-arrow @@ -825,7 +825,7 @@ if ('onhashchange' in window) { 762 assume-resources [ 763 ] 764 env:&:environment <- new-programming-environment resources, screen, [] - 765 render-all screen, env, render + 765 render-all screen, env, render 766 assume-console [ 767 ¦ press enter 768 ¦ press up-arrow @@ -851,11 +851,11 @@ if ('onhashchange' in window) { 788 recipe-bottom:num 789 ] 790 - 791 after <render-recipe-components-end> [ + 791 after <render-recipe-components-end> [ 792 *env <- put *env, recipe-bottom:offset, row 793 ] 794 - 795 after <global-keypress> [ + 795 after <global-keypress> [ 796 { 797 ¦ break-if sandbox-in-focus? 798 ¦ down-arrow?:bool <- equal k, 65516/down-arrow @@ -879,7 +879,7 @@ if ('onhashchange' in window) { 816 } 817 ] 818 - 819 after <global-type> [ + 819 after <global-type> [ 820 { 821 ¦ break-if sandbox-in-focus? 822 ¦ page-down?:bool <- equal k, 6/ctrl-f @@ -905,7 +905,7 @@ if ('onhashchange' in window) { 842 assume-resources [ 843 ] 844 env:&:environment <- new-programming-environment resources, screen, [] - 845 render-all screen, env, render + 845 render-all screen, env, render 846 assume-console [ 847 ¦ # add a line 848 ¦ press enter @@ -933,7 +933,7 @@ if ('onhashchange' in window) { 870 ] 871 env:&:environment <- new-programming-environment resources, screen, [ab 872 cd] - 873 render-all screen, env, render + 873 render-all screen, env, render 874 assume-console [ 875 ¦ # add a line 876 ¦ press enter @@ -965,7 +965,7 @@ if ('onhashchange' in window) { 902 assume-resources [ 903 ] 904 env:&:environment <- new-programming-environment resources, screen, [add 2, 2] - 905 render-all screen, env, render + 905 render-all screen, env, render 906 assume-console [ 907 ¦ # create a sandbox 908 ¦ press F4 @@ -1017,7 +1017,7 @@ if ('onhashchange' in window) { 954 ] 955 956 # page-down on sandbox side updates render-from to scroll sandboxes - 957 after <global-keypress> [ + 957 after <global-keypress> [ 958 { 959 ¦ break-unless sandbox-in-focus? 960 ¦ page-down?:bool <- equal k, 65518/page-down @@ -1030,333 +1030,335 @@ if ('onhashchange' in window) { 967 ¦ ¦ number-of-sandboxes:num <- get *env, number-of-sandboxes:offset 968 ¦ ¦ max:num <- subtract number-of-sandboxes, 1 969 ¦ ¦ at-end?:bool <- greater-or-equal render-from, max - 970 ¦ ¦ jump-if at-end?, +finish-event # render nothing + 970 ¦ ¦ loop-if at-end?, +next-event # render nothing 971 ¦ ¦ render-from <- add render-from, 1 972 ¦ ¦ *env <- put *env, render-from:offset, render-from 973 ¦ } 974 ¦ screen <- render-sandbox-side screen, env, render - 975 ¦ jump +finish-event - 976 } - 977 ] - 978 - 979 # update-cursor takes render-from into account - 980 after <update-cursor-special-cases> [ - 981 { - 982 ¦ break-unless sandbox-in-focus? - 983 ¦ render-from:num <- get *env, render-from:offset - 984 ¦ scrolling?:bool <- greater-or-equal render-from, 0 - 985 ¦ break-unless scrolling? - 986 ¦ cursor-column:num <- get *current-sandbox, left:offset - 987 ¦ screen <- move-cursor screen, 2/row, cursor-column # highlighted sandbox will always start at row 2 - 988 ¦ return - 989 } - 990 ] - 991 - 992 # 'page-up' on sandbox side is like 'page-down': updates render-from when necessary - 993 after <global-keypress> [ - 994 { - 995 ¦ break-unless sandbox-in-focus? - 996 ¦ page-up?:bool <- equal k, 65519/page-up - 997 ¦ break-unless page-up? - 998 ¦ render-from:num <- get *env, render-from:offset - 999 ¦ at-beginning?:bool <- equal render-from, -1 -1000 ¦ break-if at-beginning? -1001 ¦ render-from <- subtract render-from, 1 -1002 ¦ *env <- put *env, render-from:offset, render-from -1003 ¦ screen <- render-sandbox-side screen, env, render -1004 ¦ jump +finish-event -1005 } -1006 ] -1007 -1008 # sandbox belonging to 'env' whose next-sandbox is 'in' -1009 # return 0 if there's no such sandbox, either because 'in' doesn't exist in 'env', or because it's the first sandbox -1010 def previous-sandbox env:&:environment, in:&:sandbox -> out:&:sandbox [ -1011 local-scope -1012 load-ingredients -1013 curr:&:sandbox <- get *env, sandbox:offset -1014 return-unless curr, 0/nil -1015 next:&:sandbox <- get *curr, next-sandbox:offset -1016 { -1017 ¦ return-unless next, 0/nil -1018 ¦ found?:bool <- equal next, in -1019 ¦ break-if found? -1020 ¦ curr <- copy next -1021 ¦ next <- get *curr, next-sandbox:offset -1022 ¦ loop -1023 } -1024 return curr -1025 ] -1026 -1027 scenario scrolling-down-past-bottom-on-recipe-side [ -1028 local-scope -1029 trace-until 100/app # trace too long -1030 assume-screen 100/width, 10/height -1031 # initialize sandbox side and create a sandbox -1032 assume-resources [ -1033 ¦ [lesson/recipes.mu] <- [ -1034 ¦ ¦ || # file containing just a newline -1035 ¦ ] -1036 ] -1037 # create a sandbox -1038 env:&:environment <- new-programming-environment resources, screen, [add 2, 2] -1039 render-all screen, env, render -1040 assume-console [ -1041 ¦ press F4 -1042 ] -1043 event-loop screen, console, env, resources -1044 # hit 'down' in recipe editor -1045 assume-console [ -1046 ¦ press page-down -1047 ] -1048 run [ -1049 ¦ event-loop screen, console, env, resources -1050 ¦ cursor:char <- copy 9251/␣ -1051 ¦ print screen, cursor -1052 ] -1053 # cursor doesn't move when the end is already on-screen -1054 screen-should-contain [ -1055 ¦ . run (F4) . -1056 ¦ .␣ ╎ . -1057 ¦ . ╎─────────────────────────────────────────────────. -1058 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎0 edit copy delete . -1059 ¦ . ╎add 2, 2 . -1060 ] -1061 ] -1062 -1063 scenario scrolling-through-multiple-sandboxes [ -1064 local-scope -1065 trace-until 100/app # trace too long -1066 assume-screen 100/width, 10/height -1067 # initialize environment -1068 assume-resources [ -1069 ] -1070 env:&:environment <- new-programming-environment resources, screen, [] -1071 render-all screen, env, render -1072 # create 2 sandboxes -1073 assume-console [ -1074 ¦ press ctrl-n -1075 ¦ type [add 2, 2] -1076 ¦ press F4 -1077 ¦ type [add 1, 1] + 975 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env + 976 ¦ loop +next-event + 977 } + 978 ] + 979 + 980 # update-cursor takes render-from into account + 981 after <update-cursor-special-cases> [ + 982 { + 983 ¦ break-unless sandbox-in-focus? + 984 ¦ render-from:num <- get *env, render-from:offset + 985 ¦ scrolling?:bool <- greater-or-equal render-from, 0 + 986 ¦ break-unless scrolling? + 987 ¦ cursor-column:num <- get *current-sandbox, left:offset + 988 ¦ screen <- move-cursor screen, 2/row, cursor-column # highlighted sandbox will always start at row 2 + 989 ¦ return + 990 } + 991 ] + 992 + 993 # 'page-up' on sandbox side is like 'page-down': updates render-from when necessary + 994 after <global-keypress> [ + 995 { + 996 ¦ break-unless sandbox-in-focus? + 997 ¦ page-up?:bool <- equal k, 65519/page-up + 998 ¦ break-unless page-up? + 999 ¦ render-from:num <- get *env, render-from:offset +1000 ¦ at-beginning?:bool <- equal render-from, -1 +1001 ¦ break-if at-beginning? +1002 ¦ render-from <- subtract render-from, 1 +1003 ¦ *env <- put *env, render-from:offset, render-from +1004 ¦ screen <- render-sandbox-side screen, env, render +1005 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env +1006 ¦ loop +next-event +1007 } +1008 ] +1009 +1010 # sandbox belonging to 'env' whose next-sandbox is 'in' +1011 # return 0 if there's no such sandbox, either because 'in' doesn't exist in 'env', or because it's the first sandbox +1012 def previous-sandbox env:&:environment, in:&:sandbox -> out:&:sandbox [ +1013 local-scope +1014 load-ingredients +1015 curr:&:sandbox <- get *env, sandbox:offset +1016 return-unless curr, 0/nil +1017 next:&:sandbox <- get *curr, next-sandbox:offset +1018 { +1019 ¦ return-unless next, 0/nil +1020 ¦ found?:bool <- equal next, in +1021 ¦ break-if found? +1022 ¦ curr <- copy next +1023 ¦ next <- get *curr, next-sandbox:offset +1024 ¦ loop +1025 } +1026 return curr +1027 ] +1028 +1029 scenario scrolling-down-past-bottom-on-recipe-side [ +1030 local-scope +1031 trace-until 100/app # trace too long +1032 assume-screen 100/width, 10/height +1033 # initialize sandbox side and create a sandbox +1034 assume-resources [ +1035 ¦ [lesson/recipes.mu] <- [ +1036 ¦ ¦ || # file containing just a newline +1037 ¦ ] +1038 ] +1039 # create a sandbox +1040 env:&:environment <- new-programming-environment resources, screen, [add 2, 2] +1041 render-all screen, env, render +1042 assume-console [ +1043 ¦ press F4 +1044 ] +1045 event-loop screen, console, env, resources +1046 # hit 'down' in recipe editor +1047 assume-console [ +1048 ¦ press page-down +1049 ] +1050 run [ +1051 ¦ event-loop screen, console, env, resources +1052 ¦ cursor:char <- copy 9251/␣ +1053 ¦ print screen, cursor +1054 ] +1055 # cursor doesn't move when the end is already on-screen +1056 screen-should-contain [ +1057 ¦ . run (F4) . +1058 ¦ .␣ ╎ . +1059 ¦ . ╎─────────────────────────────────────────────────. +1060 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎0 edit copy delete . +1061 ¦ . ╎add 2, 2 . +1062 ] +1063 ] +1064 +1065 scenario scrolling-through-multiple-sandboxes [ +1066 local-scope +1067 trace-until 100/app # trace too long +1068 assume-screen 100/width, 10/height +1069 # initialize environment +1070 assume-resources [ +1071 ] +1072 env:&:environment <- new-programming-environment resources, screen, [] +1073 render-all screen, env, render +1074 # create 2 sandboxes +1075 assume-console [ +1076 ¦ press ctrl-n +1077 ¦ type [add 2, 2] 1078 ¦ press F4 -1079 ] -1080 event-loop screen, console, env, resources -1081 cursor:char <- copy 9251/␣ -1082 print screen, cursor -1083 screen-should-contain [ -1084 ¦ . run (F4) . -1085 ¦ . ╎␣ . -1086 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -1087 ¦ . ╎0 edit copy delete . -1088 ¦ . ╎add 1, 1 . -1089 ¦ . ╎2 . -1090 ¦ . ╎─────────────────────────────────────────────────. -1091 ¦ . ╎1 edit copy delete . -1092 ¦ . ╎add 2, 2 . -1093 ¦ . ╎4 . -1094 ] -1095 # hit 'page-down' -1096 assume-console [ -1097 ¦ press page-down -1098 ] -1099 run [ -1100 ¦ event-loop screen, console, env, resources -1101 ¦ cursor:char <- copy 9251/␣ -1102 ¦ print screen, cursor -1103 ] -1104 # sandbox editor hidden; first sandbox displayed -1105 # cursor moves to first sandbox -1106 screen-should-contain [ -1107 ¦ . run (F4) . -1108 ¦ . ╎─────────────────────────────────────────────────. -1109 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎␣ edit copy delete . -1110 ¦ . ╎add 1, 1 . -1111 ¦ . ╎2 . -1112 ¦ . ╎─────────────────────────────────────────────────. -1113 ¦ . ╎1 edit copy delete . -1114 ¦ . ╎add 2, 2 . -1115 ¦ . ╎4 . -1116 ] -1117 # hit 'page-down' again -1118 assume-console [ -1119 ¦ press page-down -1120 ] -1121 run [ -1122 ¦ event-loop screen, console, env, resources -1123 ] -1124 # just second sandbox displayed -1125 screen-should-contain [ -1126 ¦ . run (F4) . -1127 ¦ . ╎─────────────────────────────────────────────────. -1128 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎1 edit copy delete . -1129 ¦ . ╎add 2, 2 . -1130 ¦ . ╎4 . -1131 ¦ . ╎─────────────────────────────────────────────────. -1132 ¦ . ╎ . -1133 ] -1134 # hit 'page-down' again -1135 assume-console [ -1136 ¦ press page-down -1137 ] -1138 run [ -1139 ¦ event-loop screen, console, env, resources -1140 ] -1141 # no change -1142 screen-should-contain [ -1143 ¦ . run (F4) . -1144 ¦ . ╎─────────────────────────────────────────────────. -1145 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎1 edit copy delete . -1146 ¦ . ╎add 2, 2 . -1147 ¦ . ╎4 . -1148 ¦ . ╎─────────────────────────────────────────────────. -1149 ¦ . ╎ . -1150 ] -1151 # hit 'page-up' -1152 assume-console [ -1153 ¦ press page-up -1154 ] -1155 run [ -1156 ¦ event-loop screen, console, env, resources -1157 ] -1158 # back to displaying both sandboxes without editor -1159 screen-should-contain [ -1160 ¦ . run (F4) . -1161 ¦ . ╎─────────────────────────────────────────────────. -1162 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎0 edit copy delete . -1163 ¦ . ╎add 1, 1 . -1164 ¦ . ╎2 . -1165 ¦ . ╎─────────────────────────────────────────────────. -1166 ¦ . ╎1 edit copy delete . -1167 ¦ . ╎add 2, 2 . -1168 ¦ . ╎4 . -1169 ] -1170 # hit 'page-up' again -1171 assume-console [ -1172 ¦ press page-up -1173 ] -1174 run [ -1175 ¦ event-loop screen, console, env, resources -1176 ¦ cursor:char <- copy 9251/␣ -1177 ¦ print screen, cursor -1178 ] -1179 # back to displaying both sandboxes as well as editor -1180 screen-should-contain [ -1181 ¦ . run (F4) . -1182 ¦ . ╎␣ . -1183 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -1184 ¦ . ╎0 edit copy delete . -1185 ¦ . ╎add 1, 1 . -1186 ¦ . ╎2 . -1187 ¦ . ╎─────────────────────────────────────────────────. -1188 ¦ . ╎1 edit copy delete . -1189 ¦ . ╎add 2, 2 . -1190 ¦ . ╎4 . -1191 ] -1192 # hit 'page-up' again -1193 assume-console [ -1194 ¦ press page-up -1195 ] -1196 run [ -1197 ¦ event-loop screen, console, env, resources -1198 ¦ cursor:char <- copy 9251/␣ -1199 ¦ print screen, cursor -1200 ] -1201 # no change -1202 screen-should-contain [ -1203 ¦ . run (F4) . -1204 ¦ . ╎␣ . -1205 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -1206 ¦ . ╎0 edit copy delete . -1207 ¦ . ╎add 1, 1 . -1208 ¦ . ╎2 . -1209 ¦ . ╎─────────────────────────────────────────────────. -1210 ¦ . ╎1 edit copy delete . -1211 ¦ . ╎add 2, 2 . -1212 ¦ . ╎4 . -1213 ] -1214 ] -1215 -1216 scenario scrolling-manages-sandbox-index-correctly [ -1217 local-scope -1218 trace-until 100/app # trace too long -1219 assume-screen 100/width, 10/height -1220 # initialize environment -1221 assume-resources [ -1222 ] -1223 env:&:environment <- new-programming-environment resources, screen, [] -1224 render-all screen, env, render -1225 # create a sandbox -1226 assume-console [ -1227 ¦ press ctrl-n -1228 ¦ type [add 1, 1] -1229 ¦ press F4 -1230 ] -1231 event-loop screen, console, env, resources -1232 screen-should-contain [ -1233 ¦ . run (F4) . -1234 ¦ . ╎ . -1235 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -1236 ¦ . ╎0 edit copy delete . -1237 ¦ . ╎add 1, 1 . -1238 ¦ . ╎2 . -1239 ¦ . ╎─────────────────────────────────────────────────. -1240 ¦ . ╎ . -1241 ] -1242 # hit 'page-down' and 'page-up' a couple of times. sandbox index should be stable -1243 assume-console [ -1244 ¦ press page-down -1245 ] -1246 run [ -1247 ¦ event-loop screen, console, env, resources -1248 ] -1249 # sandbox editor hidden; first sandbox displayed -1250 # cursor moves to first sandbox -1251 screen-should-contain [ -1252 ¦ . run (F4) . -1253 ¦ . ╎─────────────────────────────────────────────────. -1254 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎0 edit copy delete . -1255 ¦ . ╎add 1, 1 . -1256 ¦ . ╎2 . -1257 ¦ . ╎─────────────────────────────────────────────────. -1258 ¦ . ╎ . -1259 ] -1260 # hit 'page-up' again -1261 assume-console [ -1262 ¦ press page-up -1263 ] -1264 run [ -1265 ¦ event-loop screen, console, env, resources -1266 ] -1267 # back to displaying both sandboxes as well as editor -1268 screen-should-contain [ -1269 ¦ . run (F4) . -1270 ¦ . ╎ . -1271 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -1272 ¦ . ╎0 edit copy delete . -1273 ¦ . ╎add 1, 1 . -1274 ¦ . ╎2 . -1275 ¦ . ╎─────────────────────────────────────────────────. -1276 ¦ . ╎ . -1277 ] -1278 # hit 'page-down' -1279 assume-console [ -1280 ¦ press page-down -1281 ] -1282 run [ -1283 ¦ event-loop screen, console, env, resources -1284 ] -1285 # sandbox editor hidden; first sandbox displayed -1286 # cursor moves to first sandbox -1287 screen-should-contain [ -1288 ¦ . run (F4) . -1289 ¦ . ╎─────────────────────────────────────────────────. -1290 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎0 edit copy delete . -1291 ¦ . ╎add 1, 1 . -1292 ¦ . ╎2 . -1293 ¦ . ╎─────────────────────────────────────────────────. -1294 ¦ . ╎ . -1295 ] -1296 ] +1079 ¦ type [add 1, 1] +1080 ¦ press F4 +1081 ] +1082 event-loop screen, console, env, resources +1083 cursor:char <- copy 9251/␣ +1084 print screen, cursor +1085 screen-should-contain [ +1086 ¦ . run (F4) . +1087 ¦ . ╎␣ . +1088 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +1089 ¦ . ╎0 edit copy delete . +1090 ¦ . ╎add 1, 1 . +1091 ¦ . ╎2 . +1092 ¦ . ╎─────────────────────────────────────────────────. +1093 ¦ . ╎1 edit copy delete . +1094 ¦ . ╎add 2, 2 . +1095 ¦ . ╎4 . +1096 ] +1097 # hit 'page-down' +1098 assume-console [ +1099 ¦ press page-down +1100 ] +1101 run [ +1102 ¦ event-loop screen, console, env, resources +1103 ¦ cursor:char <- copy 9251/␣ +1104 ¦ print screen, cursor +1105 ] +1106 # sandbox editor hidden; first sandbox displayed +1107 # cursor moves to first sandbox +1108 screen-should-contain [ +1109 ¦ . run (F4) . +1110 ¦ . ╎─────────────────────────────────────────────────. +1111 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎␣ edit copy delete . +1112 ¦ . ╎add 1, 1 . +1113 ¦ . ╎2 . +1114 ¦ . ╎─────────────────────────────────────────────────. +1115 ¦ . ╎1 edit copy delete . +1116 ¦ . ╎add 2, 2 . +1117 ¦ . ╎4 . +1118 ] +1119 # hit 'page-down' again +1120 assume-console [ +1121 ¦ press page-down +1122 ] +1123 run [ +1124 ¦ event-loop screen, console, env, resources +1125 ] +1126 # just second sandbox displayed +1127 screen-should-contain [ +1128 ¦ . run (F4) . +1129 ¦ . ╎─────────────────────────────────────────────────. +1130 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎1 edit copy delete . +1131 ¦ . ╎add 2, 2 . +1132 ¦ . ╎4 . +1133 ¦ . ╎─────────────────────────────────────────────────. +1134 ¦ . ╎ . +1135 ] +1136 # hit 'page-down' again +1137 assume-console [ +1138 ¦ press page-down +1139 ] +1140 run [ +1141 ¦ event-loop screen, console, env, resources +1142 ] +1143 # no change +1144 screen-should-contain [ +1145 ¦ . run (F4) . +1146 ¦ . ╎─────────────────────────────────────────────────. +1147 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎1 edit copy delete . +1148 ¦ . ╎add 2, 2 . +1149 ¦ . ╎4 . +1150 ¦ . ╎─────────────────────────────────────────────────. +1151 ¦ . ╎ . +1152 ] +1153 # hit 'page-up' +1154 assume-console [ +1155 ¦ press page-up +1156 ] +1157 run [ +1158 ¦ event-loop screen, console, env, resources +1159 ] +1160 # back to displaying both sandboxes without editor +1161 screen-should-contain [ +1162 ¦ . run (F4) . +1163 ¦ . ╎─────────────────────────────────────────────────. +1164 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎0 edit copy delete . +1165 ¦ . ╎add 1, 1 . +1166 ¦ . ╎2 . +1167 ¦ . ╎─────────────────────────────────────────────────. +1168 ¦ . ╎1 edit copy delete . +1169 ¦ . ╎add 2, 2 . +1170 ¦ . ╎4 . +1171 ] +1172 # hit 'page-up' again +1173 assume-console [ +1174 ¦ press page-up +1175 ] +1176 run [ +1177 ¦ event-loop screen, console, env, resources +1178 ¦ cursor:char <- copy 9251/␣ +1179 ¦ print screen, cursor +1180 ] +1181 # back to displaying both sandboxes as well as editor +1182 screen-should-contain [ +1183 ¦ . run (F4) . +1184 ¦ . ╎␣ . +1185 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +1186 ¦ . ╎0 edit copy delete . +1187 ¦ . ╎add 1, 1 . +1188 ¦ . ╎2 . +1189 ¦ . ╎─────────────────────────────────────────────────. +1190 ¦ . ╎1 edit copy delete . +1191 ¦ . ╎add 2, 2 . +1192 ¦ . ╎4 . +1193 ] +1194 # hit 'page-up' again +1195 assume-console [ +1196 ¦ press page-up +1197 ] +1198 run [ +1199 ¦ event-loop screen, console, env, resources +1200 ¦ cursor:char <- copy 9251/␣ +1201 ¦ print screen, cursor +1202 ] +1203 # no change +1204 screen-should-contain [ +1205 ¦ . run (F4) . +1206 ¦ . ╎␣ . +1207 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +1208 ¦ . ╎0 edit copy delete . +1209 ¦ . ╎add 1, 1 . +1210 ¦ . ╎2 . +1211 ¦ . ╎─────────────────────────────────────────────────. +1212 ¦ . ╎1 edit copy delete . +1213 ¦ . ╎add 2, 2 . +1214 ¦ . ╎4 . +1215 ] +1216 ] +1217 +1218 scenario scrolling-manages-sandbox-index-correctly [ +1219 local-scope +1220 trace-until 100/app # trace too long +1221 assume-screen 100/width, 10/height +1222 # initialize environment +1223 assume-resources [ +1224 ] +1225 env:&:environment <- new-programming-environment resources, screen, [] +1226 render-all screen, env, render +1227 # create a sandbox +1228 assume-console [ +1229 ¦ press ctrl-n +1230 ¦ type [add 1, 1] +1231 ¦ press F4 +1232 ] +1233 event-loop screen, console, env, resources +1234 screen-should-contain [ +1235 ¦ . run (F4) . +1236 ¦ . ╎ . +1237 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +1238 ¦ . ╎0 edit copy delete . +1239 ¦ . ╎add 1, 1 . +1240 ¦ . ╎2 . +1241 ¦ . ╎─────────────────────────────────────────────────. +1242 ¦ . ╎ . +1243 ] +1244 # hit 'page-down' and 'page-up' a couple of times. sandbox index should be stable +1245 assume-console [ +1246 ¦ press page-down +1247 ] +1248 run [ +1249 ¦ event-loop screen, console, env, resources +1250 ] +1251 # sandbox editor hidden; first sandbox displayed +1252 # cursor moves to first sandbox +1253 screen-should-contain [ +1254 ¦ . run (F4) . +1255 ¦ . ╎─────────────────────────────────────────────────. +1256 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎0 edit copy delete . +1257 ¦ . ╎add 1, 1 . +1258 ¦ . ╎2 . +1259 ¦ . ╎─────────────────────────────────────────────────. +1260 ¦ . ╎ . +1261 ] +1262 # hit 'page-up' again +1263 assume-console [ +1264 ¦ press page-up +1265 ] +1266 run [ +1267 ¦ event-loop screen, console, env, resources +1268 ] +1269 # back to displaying both sandboxes as well as editor +1270 screen-should-contain [ +1271 ¦ . run (F4) . +1272 ¦ . ╎ . +1273 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +1274 ¦ . ╎0 edit copy delete . +1275 ¦ . ╎add 1, 1 . +1276 ¦ . ╎2 . +1277 ¦ . ╎─────────────────────────────────────────────────. +1278 ¦ . ╎ . +1279 ] +1280 # hit 'page-down' +1281 assume-console [ +1282 ¦ press page-down +1283 ] +1284 run [ +1285 ¦ event-loop screen, console, env, resources +1286 ] +1287 # sandbox editor hidden; first sandbox displayed +1288 # cursor moves to first sandbox +1289 screen-should-contain [ +1290 ¦ . run (F4) . +1291 ¦ . ╎─────────────────────────────────────────────────. +1292 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎0 edit copy delete . +1293 ¦ . ╎add 1, 1 . +1294 ¦ . ╎2 . +1295 ¦ . ╎─────────────────────────────────────────────────. +1296 ¦ . ╎ . +1297 ] +1298 ] -- cgit 1.4.1-2-gfad0