editor: extend diff hunk range for custom transform blocks. (#4012)
Reported by Mikayla:  Note how the line with rust analyzer error does not have a git diff hunk. vs:  Release Notes: - N/A
This commit is contained in:
parent
31689c09e5
commit
0db7559e96
1 changed files with 8 additions and 3 deletions
|
@ -809,13 +809,18 @@ impl EditorElement {
|
||||||
// the hunk might include the rows of that header.
|
// the hunk might include the rows of that header.
|
||||||
// Making the range inclusive doesn't quite cut it, as we rely on the exclusivity for the soft wrap.
|
// Making the range inclusive doesn't quite cut it, as we rely on the exclusivity for the soft wrap.
|
||||||
// Instead, we simply check whether the range we're dealing with includes
|
// Instead, we simply check whether the range we're dealing with includes
|
||||||
// any custom elements and if so, we stop painting the diff hunk on the first row of that custom element.
|
// any excerpt headers and if so, we stop painting the diff hunk on the first row of that header.
|
||||||
let end_row_in_current_excerpt = layout
|
let end_row_in_current_excerpt = layout
|
||||||
.position_map
|
.position_map
|
||||||
.snapshot
|
.snapshot
|
||||||
.blocks_in_range(start_row..end_row)
|
.blocks_in_range(start_row..end_row)
|
||||||
.next()
|
.find_map(|(start_row, block)| {
|
||||||
.map(|(start_row, _)| start_row)
|
if matches!(block, TransformBlock::ExcerptHeader { .. }) {
|
||||||
|
Some(start_row)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
.unwrap_or(end_row);
|
.unwrap_or(end_row);
|
||||||
|
|
||||||
let start_y = start_row as f32 * line_height - scroll_top;
|
let start_y = start_row as f32 * line_height - scroll_top;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue