parent
68ec1d724c
commit
3f4d4af080
1 changed files with 3 additions and 3 deletions
|
@ -4737,8 +4737,8 @@ impl Editor {
|
||||||
let lookahead = replace_range
|
let lookahead = replace_range
|
||||||
.end
|
.end
|
||||||
.saturating_sub(newest_anchor.end.text_anchor.to_offset(buffer));
|
.saturating_sub(newest_anchor.end.text_anchor.to_offset(buffer));
|
||||||
let prefix = &old_text[..old_text.len() - lookahead];
|
let prefix = &old_text[..old_text.len().saturating_sub(lookahead)];
|
||||||
let suffix = &old_text[lookbehind..];
|
let suffix = &old_text[lookbehind.min(old_text.len())..];
|
||||||
|
|
||||||
let selections = self.selections.all::<usize>(cx);
|
let selections = self.selections.all::<usize>(cx);
|
||||||
let mut edits = Vec::new();
|
let mut edits = Vec::new();
|
||||||
|
@ -4753,7 +4753,7 @@ impl Editor {
|
||||||
|
|
||||||
// if prefix is present, don't duplicate it
|
// if prefix is present, don't duplicate it
|
||||||
if snapshot.contains_str_at(range.start.saturating_sub(lookbehind), prefix) {
|
if snapshot.contains_str_at(range.start.saturating_sub(lookbehind), prefix) {
|
||||||
text = &new_text[lookbehind..];
|
text = &new_text[lookbehind.min(new_text.len())..];
|
||||||
|
|
||||||
// if suffix is also present, mimic the newest cursor and replace it
|
// if suffix is also present, mimic the newest cursor and replace it
|
||||||
if selection.id != newest_anchor.id
|
if selection.id != newest_anchor.id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue