Make auto_closing_matching_pairs dependent on BufferContent (#2188)

This commit is contained in:
Niklas Sirch 2023-02-28 20:09:02 +01:00 committed by GitHub
parent b92c519e29
commit d64935b972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -37,6 +37,7 @@
- [#2072](https://github.com/lapce/lapce/pull/2072): Fix connection issues from Windows to lapce proxy
- [#2069](https://github.com/lapce/lapce/pull/2045): Fix not finding git repositories in parent path
- [#2131](https://github.com/lapce/lapce/pull/2131): Fix overwriting symlink
- [#2188](https://github.com/lapce/lapce/pull/2188): Fix auto closing matching pairs in inappropriate inputs
## 0.2.5

View File

@ -1372,12 +1372,19 @@ pub fn do_insert(
config: &LapceConfig,
) -> Vec<(RopeDelta, InvalLines, SyntaxEdit)> {
let old_cursor = cursor.mode.clone();
let auto_closing = config.editor.auto_closing_matching_pairs
& match self.content {
BufferContent::File(_) => true,
BufferContent::Local(_) => false,
BufferContent::SettingsValue(_) => false,
BufferContent::Scratch(_, _) => true,
};
let deltas = Editor::insert(
cursor,
&mut self.buffer,
s,
self.syntax.as_ref(),
config.editor.auto_closing_matching_pairs,
auto_closing,
);
// Keep track of the change in the cursor mode for undo/redo
self.buffer_mut().set_cursor_before(old_cursor);