Title: id(web): Go to Line miscounts and cannot navigate outside a single raw code_block — textContent has no block separators and position mapping hard-codes +2 · Issue #745 · developing-today/code · GitHub
Open Graph Title: id(web): Go to Line miscounts and cannot navigate outside a single raw code_block — textContent has no block separators and position mapping hard-codes +2 · Issue #745 · developing-today/code
X Title: id(web): Go to Line miscounts and cannot navigate outside a single raw code_block — textContent has no block separators and position mapping hard-codes +2 · Issue #745 · developing-today/code
Description: Problem Go to Line (Ctrl+G / Cmd+G) only works for a document that is a single raw-mode code_block. In every other mode the plugin is installed in, it miscounts lines and cannot navigate: The plugin is added unconditionally for all modes...
Open Graph Description: Problem Go to Line (Ctrl+G / Cmd+G) only works for a document that is a single raw-mode code_block. In every other mode the plugin is installed in, it miscounts lines and cannot navigate: The plugi...
X Description: Problem Go to Line (Ctrl+G / Cmd+G) only works for a document that is a single raw-mode code_block. In every other mode the plugin is installed in, it miscounts lines and cannot navigate: The plugi...
Opengraph URL: https://github.com/developing-today/code/issues/745
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web): Go to Line miscounts and cannot navigate outside a single raw code_block — textContent has no block separators and position mapping hard-codes +2","articleBody":"## Problem\n\nGo to Line (Ctrl+G / Cmd+G) only works for a document that is a single raw-mode `code_block`. In every other mode the plugin is installed in, it miscounts lines and cannot navigate:\n\n- The plugin is added unconditionally for all modes in `pkgs/id/web/src/editor.ts` (`createGotoLinePlugin()` in the shared plugin list, after the raw/rich branch), so rich, markdown and plain documents all get it. Those modes use `richSchema` (paragraphs, headings, list items, code blocks as separate textblocks).\n- `getLineCount` (`pkgs/id/web/src/goto-line.ts:19-27`) counts `\\n` characters in `doc.textContent`. ProseMirror's `textContent` concatenates textblocks with **no separator**, so block boundaries are invisible: a document of three paragraphs has `textContent === \"alphabetagamma\"` and counts as **1 line**.\n- `getLineStartPos` (`pkgs/id/web/src/goto-line.ts:30-61`) maps a text offset to a document position with a hard-coded `pos + 2`, with a comment claiming rich mode is handled \"via resolve\" — there is no resolve; the +2 is only correct for `doc > code_block > text` with a single block. Each additional textblock adds its own position overhead, so even a correct count would land at the wrong position.\n\n## Evidence (verified on main d7f99733 with a temporary vitest probe driving the real plugin, removed after)\n\nRich schema, doc = three paragraphs `alpha` / `beta` / `gamma`:\n\n- `doc.textContent` is `\"alphabetagamma\"` (no newlines).\n- Opening the dialog shows placeholder `Line # (1–1)` and `max=1` for a three-line document.\n- Entering `2` and pressing Enter does nothing: the #712 strict validation rejects it as out of range, the dialog stays open and the selection does not move. Go to Line is effectively dead in rich/markdown/plain mode.\n\nRaw schema, doc = two `code_block`s (`a\\nb` and `c\\nd`, four lines total):\n\n- `textContent` is `\"a\\nbc\\nd\"` — the last line of the first block and the first line of the second are merged — and the dialog reports 3 lines instead of 4.\n\nDedup: #712 (closed) fixed invalid/out-of-range input handling for the single-block case; #718 (closed) fixed the dialog singleton across editor recreation. Neither touches line counting/position mapping outside a single code block. No open issue covers this.\n\n## Why it matters\n\nCtrl+G is installed and advertised in every editable mode, but outside a single raw code block it tells the user their document has one line (or merges block-boundary lines) and refuses every jump past it. Plain-text and markdown files — primary id use cases — are exactly the affected modes.\n\n## Acceptance criteria\n\n- Line counting and line-start positions are computed from the document structure (walking textblocks and their positions), not from `doc.textContent` offsets plus a constant.\n- A defined line semantics for non-raw modes (e.g. one line per textblock, plus `\\n`-split lines inside code blocks) is implemented and documented in the module comment.\n- Regression tests: rich doc of several paragraphs (dialog range matches, Enter on line N moves the cursor to the start of the Nth paragraph); mixed doc (paragraph + multi-line code_block + paragraph); raw doc with two code_blocks counts all lines; existing single-code_block tests and the #712 invalid-input tests still pass.\n- Or, if Go to Line is deliberately raw-only, the plugin is not installed (or cleanly no-ops with feedback) in rich/markdown/plain modes, and that restriction is tested — silently offering a broken dialog is the unacceptable part.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-24T10:39:29Z","url":"https://github.com/developing-today/code/issues/745"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3b5f0cd2-a8a0-0cd3-a64a-3a2173935b3c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C4E8:3C2607:85BE71:AC9F3B:6B062C3E |
| html-safe-nonce | e80c1314d6349af086d5309d35005ef813077a2470a83e231cc8a5ccbf6e3c3f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNEU4OjNDMjYwNzo4NUJFNzE6QUM5RjNCOjZCMDYyQzNFIiwidmlzaXRvcl9pZCI6IjIwNTczOTY0MzU4ODQwNTk3MTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 97577d067101021cdaa37773dbb334f7518113305a93a8da43eeb729ea2b6185 |
| hovercard-subject-tag | issue:6012056490 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/745/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8958449df7ca875cbc36b73c583ae8afee065a681b7db1de84c0037f40e115bc/developing-today/code/issues/745 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8958449df7ca875cbc36b73c583ae8afee065a681b7db1de84c0037f40e115bc/developing-today/code/issues/745 |
| og:image:alt | Problem Go to Line (Ctrl+G / Cmd+G) only works for a document that is a single raw-mode code_block. In every other mode the plugin is installed in, it miscounts lines and cannot navigate: The plugi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7f961de5dd5c5d4aca24d33f8b3ffb3fb8b2ef53d0a4f32f01f0a790e512f6d3 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 494ea0bb1e0feef734a83e2628697647755e8864 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width