Fix panic in rename selections (#11033)
cc @someonetoignore Release Notes: - Fixed a panic when renaming with a selection (preview only)
This commit is contained in:
parent
5c2f27a501
commit
03d0b68f0c
1 changed files with 7 additions and 3 deletions
|
@ -8206,9 +8206,13 @@ impl Editor {
|
||||||
cursor_offset_in_rename_range_end..cursor_offset_in_rename_range
|
cursor_offset_in_rename_range_end..cursor_offset_in_rename_range
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if rename_selection_range.end > old_name.len() {
|
||||||
|
editor.select_all(&SelectAll, cx);
|
||||||
|
} else {
|
||||||
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
|
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
|
||||||
s.select_ranges([rename_selection_range]);
|
s.select_ranges([rename_selection_range]);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
editor
|
editor
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue