Disable diff hunks for untracked files, even w/ no newline at eof (#25980)
This fixes an issue where diff hunks were shown for untracked files, but only if the files did not end with a newline. Release Notes: - N/A
This commit is contained in:
parent
11b79d0ab9
commit
563baf682e
4 changed files with 34 additions and 41 deletions
|
@ -3498,17 +3498,12 @@ impl MultiBufferSnapshot {
|
|||
if hunk.is_created_file() && !self.all_diff_hunks_expanded {
|
||||
return None;
|
||||
}
|
||||
Some((
|
||||
Point::new(hunk.row_range.start, 0)..Point::new(hunk.row_range.end, 0),
|
||||
hunk,
|
||||
))
|
||||
Some((hunk.range.clone(), hunk))
|
||||
}),
|
||||
)
|
||||
})
|
||||
.filter_map(move |(range, hunk, excerpt)| {
|
||||
if range.start != range.end
|
||||
&& range.end == query_range.start
|
||||
&& !hunk.row_range.is_empty()
|
||||
if range.start != range.end && range.end == query_range.start && !hunk.range.is_empty()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
@ -3841,12 +3836,12 @@ impl MultiBufferSnapshot {
|
|||
&excerpt.buffer,
|
||||
) {
|
||||
let hunk_range = hunk.buffer_range.to_offset(&excerpt.buffer);
|
||||
if hunk.row_range.end >= buffer_end_row {
|
||||
if hunk.range.end >= Point::new(buffer_end_row, 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let hunk_start = Point::new(hunk.row_range.start, 0);
|
||||
let hunk_end = Point::new(hunk.row_range.end, 0);
|
||||
let hunk_start = hunk.range.start;
|
||||
let hunk_end = hunk.range.end;
|
||||
|
||||
cursor.seek_to_buffer_position_in_current_excerpt(&DimensionPair {
|
||||
key: hunk_range.start,
|
||||
|
|
|
@ -2274,7 +2274,7 @@ impl ReferenceMultibuffer {
|
|||
}
|
||||
|
||||
if !hunk.buffer_range.start.is_valid(&buffer) {
|
||||
log::trace!("skipping hunk with deleted start: {:?}", hunk.row_range);
|
||||
log::trace!("skipping hunk with deleted start: {:?}", hunk.range);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue