Repository navigation
feat(review): draw notes in the diff, in boxes under their lines - #208
Merged
Merged
Conversation
A Notes setting (panel, inline, both; [review] notes, the settings menu after Wrap, remembered) draws each note in a box under the last line it is about, over its side of a split diff, the file's notes under its heading. The cursor stops on a box: enter or e edits it over the box, delete removes it; a click picks its note. Boxes never move the line the cursor is on. Uses the insets of diffs-rs (plannotator/diffs-rs#23).
… its first row only
… spans Boxes over one side sit side by side under their row; a narrow side or a file's note spans both. Widths come from the viewer before drawing, so the hand-built split geometry and the opening workaround go. Suggested code loses its shared indentation and breaks after punctuation; a new comment lines up with the boxes; on a box, h/l move to the box beside.
…ooter and edit fixes - U takes back the last note removed (from its box or the panel) as well as the last finish: the note goes back where it was, as sent as it was; the footer says "note removed · U undo" and the review menu's row "Undo remove". - The key help lists the box keys only while notes show in the diff, as two rows whose keys fit the key column. - The footer counts no notes in the whole file; a pane under 10 rows shows no boxes and says "pane too small for inline notes". - A note being edited leaves its box's rows blank under the comment box. - Tabs in a box take the comment box's four columns. - c or s on a box comments on the lines it hangs under, on its side. - A note saved on the pane's last row says "note saved · below, ↓ shows it".
…e and saved-below footers
…ks and resizes, and the cursor's side past a box On diffs-rs feat/insets dc407e5.
…n a file box; undo kept per review; help fits 40 rows - c on a file note's box opens the new file note under the heading's boxes, lined up with them, as a line's comment box opens under its boxes. - s there says a suggestion needs lines of code and c adds a file comment. - Each review's undo history is kept for the session: back on a review after picking another, U still takes back what was done there. - The key help's U row joins the review menu's (m U), so the help fits 40 rows again with the notes panel's keys on screen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notes can now be drawn in the diff, each in a box under the lines it is about, the way a pull request shows its comments.
Depends on plannotator/diffs-rs#23 (insets). Until that is published,
Cargo.tomltakes diffs-rs, diffs-syntect and diffs-two-face from itsfeat/insetsbranch through[patch.crates-io]; that section goes away once a release has insets.What changes
panel(default, unchanged),inline(boxes in the diff) orboth. It is a row in the settings menu after Wrap,[review] notes = "panel" | "inline" | "both"in the config, remembered like the other settings, and Reset clears it.comment · L40–45,suggestion · L42,… old), the author when it is not you,sentonce sent, and at most six lines of text. A suggestion shows its code as-/+lines.Wand notes in files the filter hides. The footer counts them (2 notes not shown inline · z) and the panel lists them.enteroreedits the note in place over the box.deleteremoves it.xstill marks the file viewed. The footer hints change while the cursor is on a box. Clicking a box selects its note, in the panel too. A press on a box never starts a selection, and a drag across a box selects only code.inlinethe panel starts hidden;zopens it for this session only.bothkeeps the panel's usual rule.Tests
review/tests/inline_flow.rs: the behaviour above, including thatpaneldraws exactly as before and 300 notes.review/tests/inline_view.rs: the view checks, run in unified, split 50:50 and split 30:70, with wrap on and off, the cursor at the top, the middle and the last page, and with 0, 1 or several notes. Every frame checks that each box is inside its rows, covers no code, sits under its own note's line and shows that note's text.