{"version":"2.1.309","anchor":"promptfill-accepts-a-cursor-position","canonical_anchor":"promptfill-accepts-a-cursor-position","heading":"Filling the prompt box can now set the cursor position","tier":"use","area":"Prompt Input","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.309\/e\/promptfill-accepts-a-cursor-position","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.309","markdown":"### Filling the prompt box can now set the cursor position\n\nprompt.fill and the plugin text-injection hook now take an optional cursor value that sets where the caret lands after text is placed\n\n**What**\n\n`$.prompt.fill` lets a plugin (an add-on) or a script place text into the box where you type your prompt. Until now it accepted `mode` and `decorations`. It now also takes an optional `cursor` value, which sets where the text cursor (caret) lands:\n\n- `cursor` must be a whole number of zero or more. It counts positions in the text as UTF-16 units, which for most text means characters.\n\n- A value that is not a whole number is rejected with \"cursor must be an integer\", through the same error path as the other fields.\n\n- If no `cursor` is given, the caret ends after the placed text, as before.\n\n- The plugin hook that injects text into the prompt now passes `cursor` along with `mode` and `decorations`, and the returned result includes `cursor` when one was given.\n\n**Why**\n\nPlugins and scripts that pre-fill the prompt can now leave the cursor in a useful place, such as inside a template where you are meant to type, instead of always at the end.\n\n- Area: Prompt Input\n- Names: `prompt.fill`\n- Tier: Use it now\n- Useful: 3\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: no"}