First pass on fixes
This commit is contained in:
parent
5826d89b97
commit
2f3be75fc7
269 changed files with 1593 additions and 2574 deletions
|
@ -76,8 +76,8 @@ impl Anchor {
|
|||
if text_cmp.is_ne() {
|
||||
return text_cmp;
|
||||
}
|
||||
if self.diff_base_anchor.is_some() || other.diff_base_anchor.is_some() {
|
||||
if let Some(base_text) = snapshot
|
||||
if (self.diff_base_anchor.is_some() || other.diff_base_anchor.is_some())
|
||||
&& let Some(base_text) = snapshot
|
||||
.diffs
|
||||
.get(&excerpt.buffer_id)
|
||||
.map(|diff| diff.base_text())
|
||||
|
@ -97,7 +97,6 @@ impl Anchor {
|
|||
(None, None) => Ordering::Equal,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Ordering::Equal
|
||||
}
|
||||
|
@ -107,8 +106,8 @@ impl Anchor {
|
|||
}
|
||||
|
||||
pub fn bias_left(&self, snapshot: &MultiBufferSnapshot) -> Anchor {
|
||||
if self.text_anchor.bias != Bias::Left {
|
||||
if let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
|
||||
if self.text_anchor.bias != Bias::Left
|
||||
&& let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
|
||||
return Self {
|
||||
buffer_id: self.buffer_id,
|
||||
excerpt_id: self.excerpt_id,
|
||||
|
@ -118,22 +117,19 @@ impl Anchor {
|
|||
.diffs
|
||||
.get(&excerpt.buffer_id)
|
||||
.map(|diff| diff.base_text())
|
||||
{
|
||||
if a.buffer_id == Some(base_text.remote_id()) {
|
||||
&& a.buffer_id == Some(base_text.remote_id()) {
|
||||
return a.bias_left(base_text);
|
||||
}
|
||||
}
|
||||
a
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
*self
|
||||
}
|
||||
|
||||
pub fn bias_right(&self, snapshot: &MultiBufferSnapshot) -> Anchor {
|
||||
if self.text_anchor.bias != Bias::Right {
|
||||
if let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
|
||||
if self.text_anchor.bias != Bias::Right
|
||||
&& let Some(excerpt) = snapshot.excerpt(self.excerpt_id) {
|
||||
return Self {
|
||||
buffer_id: self.buffer_id,
|
||||
excerpt_id: self.excerpt_id,
|
||||
|
@ -143,16 +139,13 @@ impl Anchor {
|
|||
.diffs
|
||||
.get(&excerpt.buffer_id)
|
||||
.map(|diff| diff.base_text())
|
||||
{
|
||||
if a.buffer_id == Some(base_text.remote_id()) {
|
||||
&& a.buffer_id == Some(base_text.remote_id()) {
|
||||
return a.bias_right(base_text);
|
||||
}
|
||||
}
|
||||
a
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
*self
|
||||
}
|
||||
|
||||
|
|
|
@ -1082,12 +1082,11 @@ impl MultiBuffer {
|
|||
|
||||
let mut ranges: Vec<Range<usize>> = Vec::new();
|
||||
for edit in edits {
|
||||
if let Some(last_range) = ranges.last_mut() {
|
||||
if edit.range.start <= last_range.end {
|
||||
if let Some(last_range) = ranges.last_mut()
|
||||
&& edit.range.start <= last_range.end {
|
||||
last_range.end = last_range.end.max(edit.range.end);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ranges.push(edit.range);
|
||||
}
|
||||
|
||||
|
@ -1212,8 +1211,8 @@ impl MultiBuffer {
|
|||
for range in buffer.edited_ranges_for_transaction_id::<D>(*buffer_transaction) {
|
||||
for excerpt_id in &buffer_state.excerpts {
|
||||
cursor.seek(excerpt_id, Bias::Left);
|
||||
if let Some(excerpt) = cursor.item() {
|
||||
if excerpt.locator == *excerpt_id {
|
||||
if let Some(excerpt) = cursor.item()
|
||||
&& excerpt.locator == *excerpt_id {
|
||||
let excerpt_buffer_start =
|
||||
excerpt.range.context.start.summary::<D>(buffer);
|
||||
let excerpt_buffer_end = excerpt.range.context.end.summary::<D>(buffer);
|
||||
|
@ -1232,7 +1231,6 @@ impl MultiBuffer {
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1251,8 +1249,8 @@ impl MultiBuffer {
|
|||
buffer.update(cx, |buffer, _| {
|
||||
buffer.merge_transactions(transaction, destination)
|
||||
});
|
||||
} else if let Some(transaction) = self.history.forget(transaction) {
|
||||
if let Some(destination) = self.history.transaction_mut(destination) {
|
||||
} else if let Some(transaction) = self.history.forget(transaction)
|
||||
&& let Some(destination) = self.history.transaction_mut(destination) {
|
||||
for (buffer_id, buffer_transaction_id) in transaction.buffer_transactions {
|
||||
if let Some(destination_buffer_transaction_id) =
|
||||
destination.buffer_transactions.get(&buffer_id)
|
||||
|
@ -1272,7 +1270,6 @@ impl MultiBuffer {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn finalize_last_transaction(&mut self, cx: &mut Context<Self>) {
|
||||
|
@ -1562,12 +1559,11 @@ impl MultiBuffer {
|
|||
});
|
||||
let mut merged_ranges: Vec<ExcerptRange<Point>> = Vec::new();
|
||||
for range in expanded_ranges {
|
||||
if let Some(last_range) = merged_ranges.last_mut() {
|
||||
if last_range.context.end >= range.context.start {
|
||||
if let Some(last_range) = merged_ranges.last_mut()
|
||||
&& last_range.context.end >= range.context.start {
|
||||
last_range.context.end = range.context.end;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
merged_ranges.push(range)
|
||||
}
|
||||
let Some(excerpt_id) = excerpt_ids.first() else {
|
||||
|
@ -1794,16 +1790,15 @@ impl MultiBuffer {
|
|||
};
|
||||
|
||||
if let Some((last_id, last)) = to_insert.last_mut() {
|
||||
if let Some(new) = new {
|
||||
if last.context.end >= new.context.start {
|
||||
if let Some(new) = new
|
||||
&& last.context.end >= new.context.start {
|
||||
last.context.end = last.context.end.max(new.context.end);
|
||||
excerpt_ids.push(*last_id);
|
||||
new_iter.next();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if let Some((existing_id, existing_range)) = &existing {
|
||||
if last.context.end >= existing_range.start {
|
||||
if let Some((existing_id, existing_range)) = &existing
|
||||
&& last.context.end >= existing_range.start {
|
||||
last.context.end = last.context.end.max(existing_range.end);
|
||||
to_remove.push(*existing_id);
|
||||
self.snapshot
|
||||
|
@ -1813,7 +1808,6 @@ impl MultiBuffer {
|
|||
existing_iter.next();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match (new, existing) {
|
||||
|
@ -2105,11 +2099,10 @@ impl MultiBuffer {
|
|||
.flatten()
|
||||
{
|
||||
cursor.seek_forward(&Some(locator), Bias::Left);
|
||||
if let Some(excerpt) = cursor.item() {
|
||||
if excerpt.locator == *locator {
|
||||
if let Some(excerpt) = cursor.item()
|
||||
&& excerpt.locator == *locator {
|
||||
excerpts.push((excerpt.id, excerpt.range.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
excerpts
|
||||
|
@ -2132,8 +2125,8 @@ impl MultiBuffer {
|
|||
let mut result = Vec::new();
|
||||
for locator in locators {
|
||||
excerpts.seek_forward(&Some(locator), Bias::Left);
|
||||
if let Some(excerpt) = excerpts.item() {
|
||||
if excerpt.locator == *locator {
|
||||
if let Some(excerpt) = excerpts.item()
|
||||
&& excerpt.locator == *locator {
|
||||
let excerpt_start = excerpts.start().1.clone();
|
||||
let excerpt_end =
|
||||
ExcerptDimension(excerpt_start.0 + excerpt.text_summary.lines);
|
||||
|
@ -2148,7 +2141,6 @@ impl MultiBuffer {
|
|||
|
||||
result.push(start..end)
|
||||
}
|
||||
}
|
||||
}
|
||||
result
|
||||
}
|
||||
|
@ -2316,13 +2308,12 @@ impl MultiBuffer {
|
|||
// Skip over any subsequent excerpts that are also removed.
|
||||
if let Some(&next_excerpt_id) = excerpt_ids.peek() {
|
||||
let next_locator = snapshot.excerpt_locator_for_id(next_excerpt_id);
|
||||
if let Some(next_excerpt) = cursor.item() {
|
||||
if next_excerpt.locator == *next_locator {
|
||||
if let Some(next_excerpt) = cursor.item()
|
||||
&& next_excerpt.locator == *next_locator {
|
||||
excerpt_ids.next();
|
||||
excerpt = next_excerpt;
|
||||
continue 'remove_excerpts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -2494,8 +2485,8 @@ impl MultiBuffer {
|
|||
.excerpts
|
||||
.cursor::<Dimensions<Option<&Locator>, ExcerptOffset>>(&());
|
||||
cursor.seek_forward(&Some(locator), Bias::Left);
|
||||
if let Some(excerpt) = cursor.item() {
|
||||
if excerpt.locator == *locator {
|
||||
if let Some(excerpt) = cursor.item()
|
||||
&& excerpt.locator == *locator {
|
||||
let excerpt_buffer_range = excerpt.range.context.to_offset(&excerpt.buffer);
|
||||
if diff_change_range.end < excerpt_buffer_range.start
|
||||
|| diff_change_range.start > excerpt_buffer_range.end
|
||||
|
@ -2521,7 +2512,6 @@ impl MultiBuffer {
|
|||
new: edit_start..edit_end,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.sync_diff_transforms(
|
||||
|
@ -3155,14 +3145,13 @@ impl MultiBuffer {
|
|||
at_transform_boundary = false;
|
||||
let transforms_before_edit = old_diff_transforms.slice(&edit.old.start, Bias::Left);
|
||||
self.append_diff_transforms(&mut new_diff_transforms, transforms_before_edit);
|
||||
if let Some(transform) = old_diff_transforms.item() {
|
||||
if old_diff_transforms.end().0 == edit.old.start
|
||||
if let Some(transform) = old_diff_transforms.item()
|
||||
&& old_diff_transforms.end().0 == edit.old.start
|
||||
&& old_diff_transforms.start().0 < edit.old.start
|
||||
{
|
||||
self.push_diff_transform(&mut new_diff_transforms, transform.clone());
|
||||
old_diff_transforms.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the start of the edit in output coordinates.
|
||||
|
@ -3431,8 +3420,7 @@ impl MultiBuffer {
|
|||
inserted_hunk_info,
|
||||
summary,
|
||||
}) = subtree.first()
|
||||
{
|
||||
if self.extend_last_buffer_content_transform(
|
||||
&& self.extend_last_buffer_content_transform(
|
||||
new_transforms,
|
||||
*inserted_hunk_info,
|
||||
*summary,
|
||||
|
@ -3443,7 +3431,6 @@ impl MultiBuffer {
|
|||
new_transforms.append(cursor.suffix(), &());
|
||||
return;
|
||||
}
|
||||
}
|
||||
new_transforms.append(subtree, &());
|
||||
}
|
||||
|
||||
|
@ -3456,15 +3443,13 @@ impl MultiBuffer {
|
|||
inserted_hunk_info: inserted_hunk_anchor,
|
||||
summary,
|
||||
} = transform
|
||||
{
|
||||
if self.extend_last_buffer_content_transform(
|
||||
&& self.extend_last_buffer_content_transform(
|
||||
new_transforms,
|
||||
inserted_hunk_anchor,
|
||||
summary,
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
new_transforms.push(transform, &());
|
||||
}
|
||||
|
||||
|
@ -3518,12 +3503,10 @@ impl MultiBuffer {
|
|||
summary,
|
||||
inserted_hunk_info: inserted_hunk_anchor,
|
||||
} = last_transform
|
||||
{
|
||||
if *inserted_hunk_anchor == new_inserted_hunk_info {
|
||||
&& *inserted_hunk_anchor == new_inserted_hunk_info {
|
||||
*summary += summary_to_add;
|
||||
did_extend = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
&(),
|
||||
);
|
||||
|
@ -4037,11 +4020,10 @@ impl MultiBufferSnapshot {
|
|||
|
||||
cursor.seek(&query_range.start);
|
||||
|
||||
if let Some(region) = cursor.region().filter(|region| !region.is_main_buffer) {
|
||||
if region.range.start > D::zero(&()) {
|
||||
if let Some(region) = cursor.region().filter(|region| !region.is_main_buffer)
|
||||
&& region.range.start > D::zero(&()) {
|
||||
cursor.prev()
|
||||
}
|
||||
}
|
||||
|
||||
iter::from_fn(move || {
|
||||
loop {
|
||||
|
@ -4070,11 +4052,10 @@ impl MultiBufferSnapshot {
|
|||
buffer_start = cursor.main_buffer_position()?;
|
||||
};
|
||||
let mut buffer_end = excerpt.range.context.end.summary::<D>(&excerpt.buffer);
|
||||
if let Some((end_excerpt_id, end_buffer_offset)) = range_end {
|
||||
if excerpt.id == end_excerpt_id {
|
||||
if let Some((end_excerpt_id, end_buffer_offset)) = range_end
|
||||
&& excerpt.id == end_excerpt_id {
|
||||
buffer_end = buffer_end.min(end_buffer_offset);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(iterator) =
|
||||
get_buffer_metadata(&excerpt.buffer, buffer_start..buffer_end)
|
||||
|
@ -4144,11 +4125,10 @@ impl MultiBufferSnapshot {
|
|||
// When there are no more metadata items for this excerpt, move to the next excerpt.
|
||||
else {
|
||||
current_excerpt_metadata.take();
|
||||
if let Some((end_excerpt_id, _)) = range_end {
|
||||
if excerpt.id == end_excerpt_id {
|
||||
if let Some((end_excerpt_id, _)) = range_end
|
||||
&& excerpt.id == end_excerpt_id {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
cursor.next_excerpt();
|
||||
}
|
||||
}
|
||||
|
@ -4622,8 +4602,8 @@ impl MultiBufferSnapshot {
|
|||
pub fn indent_and_comment_for_line(&self, row: MultiBufferRow, cx: &App) -> String {
|
||||
let mut indent = self.indent_size_for_line(row).chars().collect::<String>();
|
||||
|
||||
if self.language_settings(cx).extend_comment_on_newline {
|
||||
if let Some(language_scope) = self.language_scope_at(Point::new(row.0, 0)) {
|
||||
if self.language_settings(cx).extend_comment_on_newline
|
||||
&& let Some(language_scope) = self.language_scope_at(Point::new(row.0, 0)) {
|
||||
let delimiters = language_scope.line_comment_prefixes();
|
||||
for delimiter in delimiters {
|
||||
if *self
|
||||
|
@ -4638,7 +4618,6 @@ impl MultiBufferSnapshot {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
indent
|
||||
}
|
||||
|
@ -4893,11 +4872,10 @@ impl MultiBufferSnapshot {
|
|||
base_text_byte_range,
|
||||
..
|
||||
}) => {
|
||||
if let Some(diff_base_anchor) = &anchor.diff_base_anchor {
|
||||
if let Some(base_text) =
|
||||
if let Some(diff_base_anchor) = &anchor.diff_base_anchor
|
||||
&& let Some(base_text) =
|
||||
self.diffs.get(buffer_id).map(|diff| diff.base_text())
|
||||
{
|
||||
if base_text.can_resolve(diff_base_anchor) {
|
||||
&& base_text.can_resolve(diff_base_anchor) {
|
||||
let base_text_offset = diff_base_anchor.to_offset(base_text);
|
||||
if base_text_offset >= base_text_byte_range.start
|
||||
&& base_text_offset <= base_text_byte_range.end
|
||||
|
@ -4912,8 +4890,6 @@ impl MultiBufferSnapshot {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
if at_transform_end && anchor.diff_base_anchor.is_some() {
|
||||
|
@ -4941,8 +4917,8 @@ impl MultiBufferSnapshot {
|
|||
}
|
||||
|
||||
let mut position = cursor.start().1;
|
||||
if let Some(excerpt) = cursor.item() {
|
||||
if excerpt.id == anchor.excerpt_id {
|
||||
if let Some(excerpt) = cursor.item()
|
||||
&& excerpt.id == anchor.excerpt_id {
|
||||
let excerpt_buffer_start = excerpt
|
||||
.buffer
|
||||
.offset_for_anchor(&excerpt.range.context.start);
|
||||
|
@ -4956,7 +4932,6 @@ impl MultiBufferSnapshot {
|
|||
position.value += buffer_position - excerpt_buffer_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
position
|
||||
}
|
||||
|
||||
|
@ -5211,8 +5186,8 @@ impl MultiBufferSnapshot {
|
|||
.cursor::<Dimensions<usize, ExcerptOffset>>(&());
|
||||
diff_transforms.seek(&offset, Bias::Right);
|
||||
|
||||
if offset == diff_transforms.start().0 && bias == Bias::Left {
|
||||
if let Some(prev_item) = diff_transforms.prev_item() {
|
||||
if offset == diff_transforms.start().0 && bias == Bias::Left
|
||||
&& let Some(prev_item) = diff_transforms.prev_item() {
|
||||
match prev_item {
|
||||
DiffTransform::DeletedHunk { .. } => {
|
||||
diff_transforms.prev();
|
||||
|
@ -5220,7 +5195,6 @@ impl MultiBufferSnapshot {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
let offset_in_transform = offset - diff_transforms.start().0;
|
||||
let mut excerpt_offset = diff_transforms.start().1;
|
||||
let mut diff_base_anchor = None;
|
||||
|
@ -5296,8 +5270,8 @@ impl MultiBufferSnapshot {
|
|||
let locator = self.excerpt_locator_for_id(excerpt_id);
|
||||
let mut cursor = self.excerpts.cursor::<Option<&Locator>>(&());
|
||||
cursor.seek(locator, Bias::Left);
|
||||
if let Some(excerpt) = cursor.item() {
|
||||
if excerpt.id == excerpt_id {
|
||||
if let Some(excerpt) = cursor.item()
|
||||
&& excerpt.id == excerpt_id {
|
||||
let text_anchor = excerpt.clip_anchor(text_anchor);
|
||||
drop(cursor);
|
||||
return Some(Anchor {
|
||||
|
@ -5307,7 +5281,6 @@ impl MultiBufferSnapshot {
|
|||
diff_base_anchor: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -5860,11 +5833,10 @@ impl MultiBufferSnapshot {
|
|||
let current_depth = indent_stack.len() as u32;
|
||||
|
||||
// Avoid retrieving the language settings repeatedly for every buffer row.
|
||||
if let Some((prev_buffer_id, _)) = &prev_settings {
|
||||
if prev_buffer_id != &buffer.remote_id() {
|
||||
if let Some((prev_buffer_id, _)) = &prev_settings
|
||||
&& prev_buffer_id != &buffer.remote_id() {
|
||||
prev_settings.take();
|
||||
}
|
||||
}
|
||||
let settings = &prev_settings
|
||||
.get_or_insert_with(|| {
|
||||
(
|
||||
|
@ -6192,11 +6164,10 @@ impl MultiBufferSnapshot {
|
|||
} else {
|
||||
let mut cursor = self.excerpt_ids.cursor::<ExcerptId>(&());
|
||||
cursor.seek(&id, Bias::Left);
|
||||
if let Some(entry) = cursor.item() {
|
||||
if entry.id == id {
|
||||
if let Some(entry) = cursor.item()
|
||||
&& entry.id == id {
|
||||
return &entry.locator;
|
||||
}
|
||||
}
|
||||
panic!("invalid excerpt id {id:?}")
|
||||
}
|
||||
}
|
||||
|
@ -6272,11 +6243,10 @@ impl MultiBufferSnapshot {
|
|||
pub fn buffer_range_for_excerpt(&self, excerpt_id: ExcerptId) -> Option<Range<text::Anchor>> {
|
||||
let mut cursor = self.excerpts.cursor::<Option<&Locator>>(&());
|
||||
let locator = self.excerpt_locator_for_id(excerpt_id);
|
||||
if cursor.seek(&Some(locator), Bias::Left) {
|
||||
if let Some(excerpt) = cursor.item() {
|
||||
if cursor.seek(&Some(locator), Bias::Left)
|
||||
&& let Some(excerpt) = cursor.item() {
|
||||
return Some(excerpt.range.context.clone());
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -6284,11 +6254,10 @@ impl MultiBufferSnapshot {
|
|||
let mut cursor = self.excerpts.cursor::<Option<&Locator>>(&());
|
||||
let locator = self.excerpt_locator_for_id(excerpt_id);
|
||||
cursor.seek(&Some(locator), Bias::Left);
|
||||
if let Some(excerpt) = cursor.item() {
|
||||
if excerpt.id == excerpt_id {
|
||||
if let Some(excerpt) = cursor.item()
|
||||
&& excerpt.id == excerpt_id {
|
||||
return Some(excerpt);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -6446,14 +6415,12 @@ impl MultiBufferSnapshot {
|
|||
inserted_hunk_info: prev_inserted_hunk_info,
|
||||
..
|
||||
}) = prev_transform
|
||||
{
|
||||
if *inserted_hunk_info == *prev_inserted_hunk_info {
|
||||
&& *inserted_hunk_info == *prev_inserted_hunk_info {
|
||||
panic!(
|
||||
"multiple adjacent buffer content transforms with is_inserted_hunk = {inserted_hunk_info:?}. transforms: {:+?}",
|
||||
self.diff_transforms.items(&())
|
||||
);
|
||||
}
|
||||
}
|
||||
if summary.len == 0 && !self.is_empty() {
|
||||
panic!("empty buffer content transform");
|
||||
}
|
||||
|
@ -6552,15 +6519,13 @@ where
|
|||
self.excerpts.next();
|
||||
} else if let Some(DiffTransform::DeletedHunk { hunk_info, .. }) =
|
||||
self.diff_transforms.item()
|
||||
{
|
||||
if self
|
||||
&& self
|
||||
.excerpts
|
||||
.item()
|
||||
.map_or(false, |excerpt| excerpt.id != hunk_info.excerpt_id)
|
||||
{
|
||||
self.excerpts.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7855,11 +7820,10 @@ impl io::Read for ReversedMultiBufferBytes<'_> {
|
|||
if len > 0 {
|
||||
self.range.end -= len;
|
||||
self.chunk = &self.chunk[..self.chunk.len() - len];
|
||||
if !self.range.is_empty() && self.chunk.is_empty() {
|
||||
if let Some(chunk) = self.chunks.next() {
|
||||
if !self.range.is_empty() && self.chunk.is_empty()
|
||||
&& let Some(chunk) = self.chunks.next() {
|
||||
self.chunk = chunk.as_bytes();
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(len)
|
||||
}
|
||||
|
|
|
@ -3592,9 +3592,9 @@ fn assert_position_translation(snapshot: &MultiBufferSnapshot) {
|
|||
|
||||
for (anchors, bias) in [(&left_anchors, Bias::Left), (&right_anchors, Bias::Right)] {
|
||||
for (ix, (offset, anchor)) in offsets.iter().zip(anchors).enumerate() {
|
||||
if ix > 0 {
|
||||
if *offset == 252 {
|
||||
if offset > &offsets[ix - 1] {
|
||||
if ix > 0
|
||||
&& *offset == 252
|
||||
&& offset > &offsets[ix - 1] {
|
||||
let prev_anchor = left_anchors[ix - 1];
|
||||
assert!(
|
||||
anchor.cmp(&prev_anchor, snapshot).is_gt(),
|
||||
|
@ -3609,8 +3609,6 @@ fn assert_position_translation(snapshot: &MultiBufferSnapshot) {
|
|||
offsets[ix],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue