editor: Fix typing closing bracket skips it even when use_autoclose is disabled (#27960)
Closes #27769 When adding snippet we were not respecting autoclose setting, before creating AutocloseRegion. This leads to cursor to skip over instead of typing that character. This PR fixes it. Release Notes: - Fixed certain case where typing closing bracket would skip it when auto close setting is turned off.
This commit is contained in:
@@ -7876,13 +7876,18 @@ impl Editor {
|
||||
}
|
||||
}
|
||||
if let Some(pair) = bracket_pair {
|
||||
let start = snapshot.anchor_after(selection_head);
|
||||
let end = snapshot.anchor_after(selection_head);
|
||||
self.autoclose_regions.push(AutocloseRegion {
|
||||
selection_id: selection.id,
|
||||
range: start..end,
|
||||
pair,
|
||||
});
|
||||
let snapshot_settings = snapshot.language_settings_at(selection_head, cx);
|
||||
let autoclose_enabled =
|
||||
self.use_autoclose && snapshot_settings.use_autoclose;
|
||||
if autoclose_enabled {
|
||||
let start = snapshot.anchor_after(selection_head);
|
||||
let end = snapshot.anchor_after(selection_head);
|
||||
self.autoclose_regions.push(AutocloseRegion {
|
||||
selection_id: selection.id,
|
||||
range: start..end,
|
||||
pair,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user