Repository navigation
feat(markdown): render tables and follow links in the editor - #424
Conversation
Keep tables rendered in Normal mode and reveal their original Markdown for editing and selection. Preserve buffer bytes, source positions, and undo history, with a per-window source toggle and a configuration opt-out. Share projected geometry across rendering, cursor movement, and mouse hit testing. Cover incremental redraws, wrapped cells, borders and padding, and wide-character restoration after overlays.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a7d5fe06f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| start_col, | ||
| end_col, | ||
| start_grapheme: 0, | ||
| end_grapheme: text.graphemes(true).count(), |
There was a problem hiding this comment.
Count source graphemes once per table row
For a table containing a long cell, project_row calls this function once per wrapped display row, and each call recounts the graphemes in the entire source line. This makes layout quadratic in the cell length at a fixed viewport width: a valid table with a roughly 1 MiB cell, still below the document-size limit, entails billions of grapheme visits during synchronous layout and can freeze the editor on opening or resizing the file. Compute the source grapheme count once before constructing the projected segments and reuse it.
Useful? React with 👍 / 👎.
Markdown reports are difficult to read as raw pipe tables, and inspecting their source references repeatedly replaces the document. This adds readable tables, inline and list styling, and link navigation directly in the main editor while preserving the Markdown source and editing coordinates.
:markdown-tablestoggles the current pane;markdown_tables = falsechanges the default.gTand Toggle task change the current task's state as one undoable edit, preserving the cursor. Dot repeat remains intact across keyboard undo/redo.gx: relative files, line/column references, headings, reference links, and autolinks, including links in rendered tables. Reuse unsaved buffers and supportCtrl-o/Ctrl-i. Web and email links use the external opener; invalid local targets leave the editor in place.Ctrl-w x/ Open link in split to create a destination that subsequent links from that source pane reuse. Each source pane owns its association and the destination has independent jump history. Focus stays in the source by default;markdown_link_split_focus = "target"changes it after restart. Clear link destination, closing either pane, or changing the source document releases the association. Associations last for the session.Table rendering, link indexing, and task toggling are bounded to Markdown documents up to 2 MiB. Unsupported table shapes retain their source representation. List styling retains existing characters and indentation. The accepted split design and focus comparison are retained under
docs/markdown-link-split/anddocs/MARKDOWN_LINK_SPLIT_PLAN.md.How to Test
Create
target.mdwith at least three lines. Beside it, createreport.mdwith:Run
cargo run -- report.md. Check the grid and inline/list styles. Navigate the table with the mouse andh/j/k/l, including its leading pipe. Enter Insert or Visual mode, then Escape: source should appear and the grid should return without dirtying the file. Resize to exercise wrapped cells.Press
gxon each table link. It should open the specified target line;Ctrl-oshould return to the exact source cursor. Repeat the open/return sequence. Thenoteslink should jump to its heading.From the report, press
Ctrl-w xonfirst, thengxonsecond. One right-hand destination should be reused while focus stays in the report. Switch to the destination and useCtrl-o/Ctrl-ito walk the two references. Repeat withmarkdown_link_split_focus = "target"after restarting to check destination focus.On the first task, press
gT,u, Ctrl-r, move to the second task, and press.. The second task should toggle, with each toggle undoable independently. Try Toggle task from the command palette and a nested task. The inline code example must not toggle.Follow
missingwith bothgxandCtrl-w x: expect an error without a new buffer, pane, or jump. Use Clear link destination and confirm the pane stays open and ordinarygxopens in the source pane again.Validation
RUST_MIN_STACK=8388608 cargo test -p redfor the existing default-thread-stack limitation. All 18 focused dot-repeat tests passed, including the unchanged explicit 2 MiB stack regression.6a7d5fe0, eight retained tmux scenarios passed: dark/light terminal styling, mouse/keyboard source navigation, task undo/redo/repeat, palette execution, nested/quoted/wrapped tasks, non-task rejection, mode changes, and a table-link round trip with exact source-byte restoration.25cefdd4covered both focus settings, destination reuse/history/lifecycle, unsaved buffers, and the report workflow. Current-head automated tests cover those cases; the final task-focused smoke did not repeat every split scenario or launch external browser/mail applications.