{"schemaVersion":1,"contentVersion":"3.4.0","id":"intermediate.12","languages":{"javascript":{"id":"intermediate.12","title":"Select when a shape needs inspection","moduleName":"Repeat, select and compose","tips":"","concept":"<p class=\"lead\">Select text with v or V, adjust the selection, then choose what to do with it.</p><p><strong>Before this lesson:</strong> Operators and movement.</p><p>v selects characters and V selects whole lines. Move to grow or shrink the selection, then press d to delete it, y to copy it or c to change it. p puts what you copied in place of the selection, so you don't have to delete the old text first and keep your copy safe. Esc cancels, and gv selects the same text again. When you know the boundary, a text object is often clearer.</p><h3>Example</h3><p>Copy the new sentence with yf., then go to the old one. v then f. selects it up to its full stop, and p puts the copy in its place. V then j selects two whole lines in the same way.</p><p>Use Start over to try again.</p>","teaches":["visual:v","visual:V"],"introduces":["v","V","gv","d","y","c","e","j","k"],"constraints":[],"drills":[{"task":"Make the empty wishlist end the way the empty cart does. Replace <code>Come back later!</code> with <code>Browse the new arrivals to get started.</code>","hint":"Copy the new wording first. Then select the words it replaces with v and press p to put the copy in their place.","mode":"jsx","start":"// English strings for the storefront. Keys are grouped by page.\nexport const strings = {\n  \"cart.title\": \"Your cart\",\n  \"cart.empty\": \"Your cart is empty. Browse the new arrivals to get started.\",\n  \"cart.checkout\": \"Go to checkout\",\n  \"wishlist.title\": \"Saved for later\",\n  \"wishlist.empty\": \"Nothing saved yet. Come back later!\",\n  \"wishlist.move\": \"Move to cart\",\n  \"orders.title\": \"Your orders\",\n  \"orders.empty\": \"You haven't ordered anything yet.\",\n};","startCursor":{"line":2,"ch":16},"paths":[{"keys":["j","f","B","y","t","\"","3","j","f","C","v","t","\"","p"],"tier":"idiomatic","technique":"visual:v","core":["visual:v","put:p"],"note":"p over a selection puts your copy in its place, so you don't have to delete first and protect the copy."}],"target":"// English strings for the storefront. Keys are grouped by page.\nexport const strings = {\n  \"cart.title\": \"Your cart\",\n  \"cart.empty\": \"Your cart is empty. Browse the new arrivals to get started.\",\n  \"cart.checkout\": \"Go to checkout\",\n  \"wishlist.title\": \"Saved for later\",\n  \"wishlist.empty\": \"Nothing saved yet. Browse the new arrivals to get started.\",\n  \"wishlist.move\": \"Move to cart\",\n  \"orders.title\": \"Your orders\",\n  \"orders.empty\": \"You haven't ordered anything yet.\",\n};","language":"javascript","evidence":"guided","canonicalKey":"intermediate.12#0","canonicalFingerprint":"13c7k2k"},{"task":"The second test still builds its cart the old way. Replace its first two lines with the two setup lines from the first test.","hint":"Copy the new lines first. Then select the old ones with V and press p to put the copy in their place.","mode":"jsx","start":"import { createCart } from \"./cart\";\n\ntest(\"adds an item\", () => {\n  const cart = createCart();\n  cart.add({ sku: \"MUG-01\", quantity: 1 });\n  expect(cart.count()).toBe(1);\n});\n\ntest(\"removes an item\", () => {\n  const cart = new Cart([]);\n  cart.items.push({ sku: \"MUG-01\", quantity: 1 });\n  cart.remove(\"MUG-01\");\n  expect(cart.count()).toBe(0);\n});","startCursor":{"line":2,"ch":0},"paths":[{"keys":["j","y","j","6","j","V","j","p"],"tier":"idiomatic","technique":"visual:V","core":["visual:V","put:p"],"note":"V selects whole lines, and p puts the copied lines in their place."}],"target":"import { createCart } from \"./cart\";\n\ntest(\"adds an item\", () => {\n  const cart = createCart();\n  cart.add({ sku: \"MUG-01\", quantity: 1 });\n  expect(cart.count()).toBe(1);\n});\n\ntest(\"removes an item\", () => {\n  const cart = createCart();\n  cart.add({ sku: \"MUG-01\", quantity: 1 });\n  cart.remove(\"MUG-01\");\n  expect(cart.count()).toBe(0);\n});","language":"javascript","evidence":"guided","canonicalKey":"intermediate.12#1","canonicalFingerprint":"1bhs964"}]},"python":{"id":"intermediate.12","title":"Select when a shape needs inspection","moduleName":"Repeat, select and compose","tips":"","concept":"<p class=\"lead\">Select text with v or V, adjust the selection, then choose what to do with it.</p><p><strong>Before this lesson:</strong> Operators and movement.</p><p>v selects characters and V selects whole lines. Move to grow or shrink the selection, then press d to delete it, y to copy it or c to change it. p puts what you copied in place of the selection, so you don't have to delete the old text first and keep your copy safe. Esc cancels, and gv selects the same text again. When you know the boundary, a text object is often clearer.</p><h3>Example</h3><p>Copy the new sentence with yf., then go to the old one. v then f. selects it up to its full stop, and p puts the copy in its place. V then j selects two whole lines in the same way.</p><p>Use Start over to try again.</p>","teaches":["visual:v","visual:V"],"introduces":["v","V","gv","d","y","c","e","j","k"],"constraints":[],"drills":[{"task":"Make the empty wishlist end the way the empty cart does. Replace <code>Come back later!</code> with <code>Browse the new arrivals to get started.</code>","hint":"Copy the new wording first. Then select the words it replaces with v and press p to put the copy in their place.","mode":"python","start":"\"\"\"Messages shown on the storefront. The templates look them up by name.\"\"\"\nfrom shop.i18n import lazy as _\n\nCART_TITLE = _(\"Your cart\")\nCART_EMPTY = _(\"Your cart is empty. Browse the new arrivals to get started.\")\nCART_CHECKOUT = _(\"Go to checkout\")\nWISHLIST_TITLE = _(\"Saved for later\")\nWISHLIST_EMPTY = _(\"Nothing saved yet. Come back later!\")\nWISHLIST_MOVE = _(\"Move to cart\")","startCursor":{"line":3,"ch":0},"paths":[{"keys":["j","f","B","y","t","\"","3","j","f","C","v","t","\"","p"],"tier":"idiomatic","technique":"visual:v","core":["visual:v","put:p"],"note":"p over a selection puts your copy in its place, so you don't have to delete first and protect the copy."}],"target":"\"\"\"Messages shown on the storefront. The templates look them up by name.\"\"\"\nfrom shop.i18n import lazy as _\n\nCART_TITLE = _(\"Your cart\")\nCART_EMPTY = _(\"Your cart is empty. Browse the new arrivals to get started.\")\nCART_CHECKOUT = _(\"Go to checkout\")\nWISHLIST_TITLE = _(\"Saved for later\")\nWISHLIST_EMPTY = _(\"Nothing saved yet. Browse the new arrivals to get started.\")\nWISHLIST_MOVE = _(\"Move to cart\")","language":"python","evidence":"guided","canonicalKey":"intermediate.12#0","canonicalFingerprint":"13c7k2k"},{"task":"The second test still builds its cart the old way. Replace its first two lines with the two setup lines from the first test.","hint":"Copy the new lines first. Then select the old ones with V and press p to put the copy in their place.","mode":"python","start":"from shop.cart import Cart, create_cart\n\n\ndef test_adds_an_item():\n    cart = create_cart()\n    cart.add(sku=\"MUG-01\", quantity=1)\n    assert cart.count() == 1\n\n\ndef test_removes_an_item():\n    cart = Cart(lines=[])\n    cart.lines.append({\"sku\": \"MUG-01\", \"quantity\": 1})\n    cart.remove(\"MUG-01\")\n    assert cart.count() == 0","startCursor":{"line":3,"ch":0},"paths":[{"keys":["j","y","j","6","j","V","j","p"],"tier":"idiomatic","technique":"visual:V","core":["visual:V","put:p"],"note":"V selects whole lines, and p puts the copied lines in their place."}],"target":"from shop.cart import Cart, create_cart\n\n\ndef test_adds_an_item():\n    cart = create_cart()\n    cart.add(sku=\"MUG-01\", quantity=1)\n    assert cart.count() == 1\n\n\ndef test_removes_an_item():\n    cart = create_cart()\n    cart.add(sku=\"MUG-01\", quantity=1)\n    cart.remove(\"MUG-01\")\n    assert cart.count() == 0","language":"python","evidence":"guided","canonicalKey":"intermediate.12#1","canonicalFingerprint":"1bhs964"}]},"text":{"id":"intermediate.12","title":"Select when a shape needs inspection","moduleName":"Repeat, select and compose","tips":"","concept":"<p class=\"lead\">Select text with v or V, adjust the selection, then choose what to do with it.</p><p><strong>Before this lesson:</strong> Operators and movement.</p><p>v selects characters and V selects whole lines. Move to grow or shrink the selection, then press d to delete it, y to copy it or c to change it. p puts what you copied in place of the selection, so you don't have to delete the old text first and keep your copy safe. Esc cancels, and gv selects the same text again. When you know the boundary, a text object is often clearer.</p><h3>Example</h3><p>Copy the new sentence with yf., then go to the old one. v then f. selects it up to its full stop, and p puts the copy in its place. V then j selects two whole lines in the same way.</p><p>Use Start over to try again.</p>","teaches":["visual:v","visual:V"],"introduces":["v","V","gv","d","y","c","e","j","k"],"constraints":[],"drills":[{"task":"Use the apology from the shipping email. Replace <code>Sorry about that!</code> with <code>We're sorry for the wait, and thanks for your patience.</code>","hint":"Copy the new wording first. Then select the words it replaces with v and press p to put the copy in their place.","mode":"text/plain","start":"Subject: Your order is running late\n\nHi Dana,\n\nOrder 1042 left our warehouse a day late. Sorry about that! It should arrive by Friday.\nThe tracking link in your shipping email still works.\n\nThe Northwind delivery team\n\nFrom the shipping email: We're sorry for the wait, and thanks for your patience.","startCursor":{"line":7,"ch":0},"paths":[{"keys":["2","j","f","W","y","$","5","k","f","S","v","f","!","p"],"tier":"idiomatic","technique":"visual:v","core":["visual:v","put:p"],"note":"p over a selection puts your copy in its place, so you don't have to delete first and protect the copy."}],"target":"Subject: Your order is running late\n\nHi Dana,\n\nOrder 1042 left our warehouse a day late. We're sorry for the wait, and thanks for your patience. It should arrive by Friday.\nThe tracking link in your shipping email still works.\n\nThe Northwind delivery team\n\nFrom the shipping email: We're sorry for the wait, and thanks for your patience.","language":"text","evidence":"guided","canonicalKey":"intermediate.12#0","canonicalFingerprint":"13c7k2k"},{"task":"The setup steps still start the old way. Replace their first two lines with the two install lines from Quick start.","hint":"Copy the new lines first. Then select the old ones with V and press p to put the copy in their place.","mode":"text/plain","start":"# Northwind storefront\n\n## Quick start\n    npm ci\n    npm run db:setup\n    npm run dev\n\nThe shop opens at http://localhost:5173.\n\n## Setup for a new laptop\n    npm install --legacy-peer-deps\n    node scripts/create-db.js\n    npm run dev\n\nAsk Dana for the Stripe test keys and put them in .env.","startCursor":{"line":2,"ch":0},"paths":[{"keys":["j","y","j","7","j","V","j","p"],"tier":"idiomatic","technique":"visual:V","core":["visual:V","put:p"],"note":"V selects whole lines, and p puts the copied lines in their place."}],"target":"# Northwind storefront\n\n## Quick start\n    npm ci\n    npm run db:setup\n    npm run dev\n\nThe shop opens at http://localhost:5173.\n\n## Setup for a new laptop\n    npm ci\n    npm run db:setup\n    npm run dev\n\nAsk Dana for the Stripe test keys and put them in .env.","language":"text","evidence":"guided","canonicalKey":"intermediate.12#1","canonicalFingerprint":"1bhs964"}]}},"concepts":{"javascript":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Operators and movement.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Select text with v or V, adjust the selection, then choose what to do with it.</p><p>v selects characters and V selects whole lines. Move to grow or shrink the selection, then press d to delete it, y to copy it or c to change it. p puts what you copied in place of the selection, so you don't have to delete the old text first and keep your copy safe. Esc cancels, and gv selects the same text again. When you know the boundary, a text object is often clearer.</p><h2 class=\"prose-subhead\">Example</h2><p>Copy the new sentence with yf., then go to the old one. v then f. selects it up to its full stop, and p puts the copy in its place. V then j selects two whole lines in the same way.</p><p>Use Start over to try again.</p></div></details>"},"python":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Operators and movement.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Select text with v or V, adjust the selection, then choose what to do with it.</p><p>v selects characters and V selects whole lines. Move to grow or shrink the selection, then press d to delete it, y to copy it or c to change it. p puts what you copied in place of the selection, so you don't have to delete the old text first and keep your copy safe. Esc cancels, and gv selects the same text again. When you know the boundary, a text object is often clearer.</p><h2 class=\"prose-subhead\">Example</h2><p>Copy the new sentence with yf., then go to the old one. v then f. selects it up to its full stop, and p puts the copy in its place. V then j selects two whole lines in the same way.</p><p>Use Start over to try again.</p></div></details>"},"text":{"lead":"","reminder":"<p class=\"lesson-prereq\"><strong>Before this lesson:</strong> Operators and movement.</p>","more":"<details class=\"lesson-more\"><summary>More about this lesson</summary><div class=\"lesson-more-body prose\"><p class=\"lead\">Select text with v or V, adjust the selection, then choose what to do with it.</p><p>v selects characters and V selects whole lines. Move to grow or shrink the selection, then press d to delete it, y to copy it or c to change it. p puts what you copied in place of the selection, so you don't have to delete the old text first and keep your copy safe. Esc cancels, and gv selects the same text again. When you know the boundary, a text object is often clearer.</p><h2 class=\"prose-subhead\">Example</h2><p>Copy the new sentence with yf., then go to the old one. v then f. selects it up to its full stop, and p puts the copy in its place. V then j selects two whole lines in the same way.</p><p>Use Start over to try again.</p></div></details>"}}}