Fix panic in autoclosing (#21482)
Closes #14961 Release Notes: - Fixed a panic when backspacing at the start of a buffer with `always_treat_brackets_as_autoclosed` enabled.
This commit is contained in:
parent
afb253b406
commit
492ca219d3
1 changed files with 4 additions and 2 deletions
|
@ -4098,8 +4098,10 @@ impl Editor {
|
||||||
|
|
||||||
if buffer.contains_str_at(selection.start, &pair.end) {
|
if buffer.contains_str_at(selection.start, &pair.end) {
|
||||||
let pair_start_len = pair.start.len();
|
let pair_start_len = pair.start.len();
|
||||||
if buffer.contains_str_at(selection.start - pair_start_len, &pair.start)
|
if buffer.contains_str_at(
|
||||||
{
|
selection.start.saturating_sub(pair_start_len),
|
||||||
|
&pair.start,
|
||||||
|
) {
|
||||||
selection.start -= pair_start_len;
|
selection.start -= pair_start_len;
|
||||||
selection.end += pair.end.len();
|
selection.end += pair.end.len();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue