Repository navigation
feat(review): the comment box opens next to the lines it is about - #195
Merged
Merged
Conversation
A drag past the diff pane's top or bottom moved the cursor a line for every mouse report, with no limit on the rate and no stop at the hunk the selection is kept in. Terminals in a window can report every pixel the pointer moves, so a drag that touched the footer row scrolled hundreds of lines in a moment, through the other files to the end of the diff. Several reports also arrive between two frames, and each click after a scroll was hit-tested against the stale frame, so a burst ended on other lines than the same reports one per frame. Now a report for the cell already reported does nothing, only a line of code takes the drag's click, and no report scrolls. Held past an edge, the view scrolls a line per 50 ms on the event loop's tick, and only while the anchor's hunk has lines that way.
…sense mouse reports are ignored The document screen scrolled one row for every drag report past the text's top or bottom, so a terminal that reports each pixel raced the document to its end. It now follows the review: a report for the cell already reported does nothing, no report scrolls, and held past an edge the document scrolls a row per 50 ms on the loop's tick until it ends. The edge timer moves to ui::drag, shared by both screens. Both screens now ignore a mouse report for a cell outside the terminal (pixel positions, a broken encoding) instead of reading it as the pointer past the bottom. A release there still ends a drag, at the nearest cell.
The box for a comment or a suggestion opens right under the selected lines, or above them at the bottom of the diff, over their side of a split diff, and never over them while there is room. A file note opens under the file's heading, a note on the whole change in the middle, an edit under the note's lines. It grows on the side it opened on and scrolls inside. While it is open a click on its text moves the text cursor and every other mouse report does nothing, so a stray click keeps the draft and the wheel keeps the lines under the box.
…nt-near-selection
…ide, a suggestion keeps its code The box keeps the row it scrolled to while the cursor stays in view, so a click or an arrow inside it no longer shifts the text. A box too short for its borders draws its text alone, inside its rectangle. A suggestion keeps its code exactly (carriage returns, tabs, trailing spaces), losing only a new line typed after the last one, and tabs draw as four columns.
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.
What changes
The comment box in
plannotator-tui reviewopened along the bottom of the diff, centred and up to 84 columns wide, wherever the lines were. Now it opens next to what it is about, as a document's comment box does.c,s, the toolbar after a drag,eon a line note in the rail): directly under the last row that shows the lines. In a split diff it sits over the lines' side, as wide as that pane (at most 84). It never covers the lines while there is room, and they stay shaded while you type.C: under the file's heading (its own heading, or the one kept on the top row), else at the top of the pane.M: centred in the diff pane.The view stays still
Mouse while the box is open
Compose::click).Notes
commentborder colour on both themes.Tests
review/tests/compose_near.rs(placement) andreview/tests/compose_still.rs(view, cursor, mouse), against the real Screen:CandM; editing from the railFixes from review