feat: wrap diff review comments by default
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
- [x] syntax highlighting for Honey (honeylang)
|
- [x] syntax highlighting for Honey (honeylang)
|
||||||
- honeylang treesitter project located at `/Users/valdemar/Developer/Personal/Languages/tree-sitter-honey`.
|
- honeylang treesitter project located at `/Users/valdemar/Developer/Personal/Languages/tree-sitter-honey`.
|
||||||
- [x] bug: `x` cut action does not copy the hovered character if not in selection mode, though should always copy.
|
- [x] bug: `x` cut action does not copy the hovered character if not in selection mode, though should always copy.
|
||||||
|
- [x] make diff comments word wrap / line wrap by default
|
||||||
|
- [ ] currently, a review comment seems to be attached even if the user doesn't "save" or write the comment buffer (e.g. using `:w`). just closing it with escape still seems to write it to the db.
|
||||||
|
- comments should be discardable
|
||||||
- [ ] diff view: GitHub code review integration after the local review UX is usable.
|
- [ ] diff view: GitHub code review integration after the local review UX is usable.
|
||||||
- publish local reviews explicitly: general PR comments, inline line/range comments, review summaries, approval, and requests for changes.
|
- publish local reviews explicitly: general PR comments, inline line/range comments, review summaries, approval, and requests for changes.
|
||||||
- preserve explicit PR identity and reviewed commit IDs; validate anchors against GitHub's PR diff and recheck the PR head before submission.
|
- preserve explicit PR identity and reviewed commit IDs; validate anchors against GitHub's PR diff and recheck the PR head before submission.
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ Rust tests live under [`tests/`](../tests/). Private unit tests are in [`tests/u
|
|||||||
- Editor checks cover Unicode editing, multi-target state, undo/redo, saving failures, and modal paste acceptance and rejection atomicity.
|
- Editor checks cover Unicode editing, multi-target state, undo/redo, saving failures, and modal paste acceptance and rejection atomicity.
|
||||||
- Visual-command checks preserve directed characterwise/linewise ranges and multiple carets through command cancellation and plugin dispatch, exercise remapped command entry, and submit `:diff.comment` on either historical side. Live PTY smoke selects lines, cancels a prompt, then runs `:diff.comment` directly and verifies the saved original range without using the palette.
|
- Visual-command checks preserve directed characterwise/linewise ranges and multiple carets through command cancellation and plugin dispatch, exercise remapped command entry, and submit `:diff.comment` on either historical side. Live PTY smoke selects lines, cancels a prompt, then runs `:diff.comment` directly and verifies the saved original range without using the palette.
|
||||||
- Presentation regressions render retained characterwise/linewise highlights during command entry in ordinary, split-diff, and unified views. Floating-review checks preserve source rectangles and the workspace layout, place the caret inside the overlay, retain dismissed drafts across tab switches, and restore source focus on Escape or pane close. Live PTY smoke edits, dismisses, reopens, and saves a floating comment and summary before returning to the unchanged diff.
|
- Presentation regressions render retained characterwise/linewise highlights during command entry in ordinary, split-diff, and unified views. Floating-review checks preserve source rectangles and the workspace layout, place the caret inside the overlay, retain dismissed drafts across tab switches, and restore source focus on Escape or pane close. Live PTY smoke edits, dismisses, reopens, and saves a floating comment and summary before returning to the unchanged diff.
|
||||||
|
- Review prose checks render long comments and summaries with wrapping enabled by default in split/unified views, preserve exact single-line text and source wrapping, and retain an explicit wrap toggle on reopening. Live PTY smoke displays a long comment across continuation rows, saves it, verifies exact text through the review CLI, and reopens it still wrapped.
|
||||||
- Precise-range checks cover forward/reversed characterwise and partial-multiline selections on both sides, linewise and caret/empty-line fallbacks, source-column navigation, Unicode grapheme bounds, invalid schemas, and preserved save-conflict checks. Render checks cover exact text/newline cells, wrapping, horizontal clipping, shared unified context, stale suppression, and native Visual precedence. Live PTY smoke saves and reopens a selection containing a wide and combining grapheme.
|
- Precise-range checks cover forward/reversed characterwise and partial-multiline selections on both sides, linewise and caret/empty-line fallbacks, source-column navigation, Unicode grapheme bounds, invalid schemas, and preserved save-conflict checks. Render checks cover exact text/newline cells, wrapping, horizontal clipping, shared unified context, stale suppression, and native Visual precedence. Live PTY smoke saves and reopens a selection containing a wide and combining grapheme.
|
||||||
- Markdown navigation checks cover inline/reference destinations, escaped/percent-encoded paths, heading markup and duplicates, same-document fragments, dirty target reuse, failed navigation atomicity, primary-only following, and `gf` prefix cancellation/configuration overrides.
|
- Markdown navigation checks cover inline/reference destinations, escaped/percent-encoded paths, heading markup and duplicates, same-document fragments, dirty target reuse, failed navigation atomicity, primary-only following, and `gf` prefix cancellation/configuration overrides.
|
||||||
- Jump-history checks cover cross-buffer/same-document navigation, search and picker recording, counts and repeated visits, bounded history, branch truncation, closed buffers, edited-coordinate clamping, dirty text/undo preservation, independent Ctrl+i/Tab bindings, and custom bindings. Diff checks exercise Ctrl+i on either side in split/unified views, both control-letter and modified-Tab terminal events, and plain Tab pane cycling. Real LSP fixtures cover definition round-trips and delayed replies after leaving and returning to the same source location.
|
- Jump-history checks cover cross-buffer/same-document navigation, search and picker recording, counts and repeated visits, bounded history, branch truncation, closed buffers, edited-coordinate clamping, dirty text/undo preservation, independent Ctrl+i/Tab bindings, and custom bindings. Diff checks exercise Ctrl+i on either side in split/unified views, both control-letter and modified-Tab terminal events, and plain Tab pane cycling. Real LSP fixtures cover definition round-trips and delayed replies after leaving and returning to the same source location.
|
||||||
|
|||||||
+3
-1
@@ -240,7 +240,7 @@ Vertical wheel input over a hover popup or floating/docked file explorer scrolls
|
|||||||
|
|
||||||
## Word wrap
|
## Word wrap
|
||||||
|
|
||||||
Use `:word_wrap.toggle`, the **Toggle word wrap** palette action, or `config.core.word_wrap.toggle` in a custom binding. Wrapping defaults to **off** for new buffers and has **no default keybinding**. Each ordinary pane retains its own setting for each buffer; toggling does not edit text or enter undo history.
|
Use `:word_wrap.toggle`, the **Toggle word wrap** palette action, or `config.core.word_wrap.toggle` in a custom binding. Wrapping defaults to **off** for new source buffers and **on** for local review buffers, with **no default keybinding**. Each ordinary pane retains its own setting for each buffer; toggling does not edit text or enter undo history.
|
||||||
|
|
||||||
Toggling preserves the source caret and anchors a visible caret to its previous screen row in ordinary and diff buffers. File boundaries clamp the anchor when there are not enough preceding rows. Horizontal position follows the reflowed text.
|
Toggling preserves the source caret and anchors a visible caret to its previous screen row in ordinary and diff buffers. File boundaries clamp the anchor when there are not enough preceding rows. Horizontal position follows the reflowed text.
|
||||||
|
|
||||||
@@ -458,6 +458,8 @@ Review marks belong only to the open comparison and survive filtering, file navi
|
|||||||
|
|
||||||
Comments, summaries, and the review overview open in a focused floating editor over the whole diff text workspace, not a source-side split. The source layout, file explorer, and viewports stay unchanged. Normal editing, selections, and undo/redo work in editable review buffers. Escape in Normal mode or `:pane.close` dismisses the window and returns to the diff; drafts remain available for reopening and saving. Insert/Visual/Command Escape first retains its usual modal behavior. Source rows are never replaced with comment text. Magenta **`○`** gutter markers identify comment ranges; **`●`** identifies the selected comment. Its exact current text range has a magenta background, including wrapped continuations and selected newline cells; native Visual selections take precedence. Stale comments have neither markers nor text highlighting. Markers preserve addition/deletion signs, appear only on the first wrapped segment, and also work in unified view.
|
Comments, summaries, and the review overview open in a focused floating editor over the whole diff text workspace, not a source-side split. The source layout, file explorer, and viewports stay unchanged. Normal editing, selections, and undo/redo work in editable review buffers. Escape in Normal mode or `:pane.close` dismisses the window and returns to the diff; drafts remain available for reopening and saving. Insert/Visual/Command Escape first retains its usual modal behavior. Source rows are never replaced with comment text. Magenta **`○`** gutter markers identify comment ranges; **`●`** identifies the selected comment. Its exact current text range has a magenta background, including wrapped continuations and selected newline cells; native Visual selections take precedence. Stale comments have neither markers nor text highlighting. Markers preserve addition/deletion signs, appear only on the first wrapped segment, and also work in unified view.
|
||||||
|
|
||||||
|
Local review buffers (comments, summaries, overview, and stored-review selector) soft-wrap by default without inserting newlines into saved text. Use `:word_wrap.toggle` to disable wrapping for the focused review buffer; reopening it retains that choice for the session. Source diff wrapping remains independent.
|
||||||
|
|
||||||
| Command | Effect |
|
| Command | Effect |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `:diff.comment` | Add a comment on the current line or exact selected text range, on the focused side |
|
| `:diff.comment` | Add a comment on the current line or exact selected text range, on the focused side |
|
||||||
|
|||||||
@@ -863,6 +863,7 @@ impl Editor {
|
|||||||
title,
|
title,
|
||||||
});
|
});
|
||||||
buffer.resolver_readonly = matches!(kind, ReviewText::Overview | ReviewText::Reviews);
|
buffer.resolver_readonly = matches!(kind, ReviewText::Overview | ReviewText::Reviews);
|
||||||
|
buffer.view.word_wrap = true;
|
||||||
self.add_buffer(buffer);
|
self.add_buffer(buffer);
|
||||||
}
|
}
|
||||||
self.set_message(if self.review_directory.is_some() {
|
self.set_message(if self.review_directory.is_some() {
|
||||||
|
|||||||
@@ -8030,6 +8030,58 @@ fn review_editor_floats_over_the_diff_without_changing_workspace_layout() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn review_prose_wraps_by_default_without_changing_text_or_source_wrapping() {
|
||||||
|
for unified in [false, true] {
|
||||||
|
let mut editor = readonly_diff_editor(syntax_diff_file("file.txt", "old", "new"));
|
||||||
|
if unified {
|
||||||
|
editor.execute("diff.view.toggle");
|
||||||
|
}
|
||||||
|
editor.handle(Input::Char('\t'));
|
||||||
|
let text = format!("{}wrapped_tail", "prose ".repeat(20));
|
||||||
|
let mut terminal = Terminal::new(ratatui::backend::TestBackend::new(80, 30)).unwrap();
|
||||||
|
let mut views = BufferViewports::default();
|
||||||
|
for command in ["diff.comment", "diff.review.summary"] {
|
||||||
|
editor.execute(command);
|
||||||
|
editor.handle(Input::Char('i'));
|
||||||
|
editor.handle(Input::Paste(text.clone()));
|
||||||
|
editor.handle(Input::Escape);
|
||||||
|
editor.handle(Input::Home);
|
||||||
|
terminal
|
||||||
|
.draw(|frame| views.draw(frame, &mut editor))
|
||||||
|
.unwrap();
|
||||||
|
let screen = screen_text(&terminal);
|
||||||
|
let first = screen
|
||||||
|
.lines()
|
||||||
|
.position(|line| line.contains("prose"))
|
||||||
|
.unwrap();
|
||||||
|
let tail = screen
|
||||||
|
.lines()
|
||||||
|
.position(|line| line.contains("wrapped_tail"))
|
||||||
|
.expect("comment tail must be visible without horizontal scrolling");
|
||||||
|
assert!(tail > first, "{command}: {screen}");
|
||||||
|
assert_eq!(editor.context().text, text);
|
||||||
|
editor.handle(Input::Escape);
|
||||||
|
assert!(!editor.word_wrap());
|
||||||
|
}
|
||||||
|
editor.execute("diff.review.overview");
|
||||||
|
assert!(editor.word_wrap());
|
||||||
|
editor.handle(Input::Escape);
|
||||||
|
editor.execute("diff.review.edit 1");
|
||||||
|
editor.execute("word_wrap.toggle");
|
||||||
|
assert!(!editor.word_wrap());
|
||||||
|
editor.handle(Input::Escape);
|
||||||
|
editor.execute("diff.review.edit 1");
|
||||||
|
assert!(
|
||||||
|
!editor.word_wrap(),
|
||||||
|
"reopening must retain the user's toggle"
|
||||||
|
);
|
||||||
|
assert_eq!(editor.context().text, text);
|
||||||
|
editor.handle(Input::Escape);
|
||||||
|
assert!(!editor.word_wrap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn scope_projection_keeps_unified_wrapped_caret_and_selection_source_only() {
|
fn scope_projection_keeps_unified_wrapped_caret_and_selection_source_only() {
|
||||||
let before = format!(
|
let before = format!(
|
||||||
|
|||||||
Reference in New Issue
Block a user