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:
@@ -4098,8 +4098,10 @@ impl Editor {
|
||||
|
||||
if buffer.contains_str_at(selection.start, &pair.end) {
|
||||
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.end += pair.end.len();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user