From d64935b972f02d1c0eb1505d590d2d174e318a34 Mon Sep 17 00:00:00 2001 From: Niklas Sirch <80269156+SirNiklax@users.noreply.github.com> Date: Tue, 28 Feb 2023 20:09:02 +0100 Subject: [PATCH] Make auto_closing_matching_pairs dependent on BufferContent (#2188) --- CHANGELOG.md | 1 + lapce-data/src/document.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34b85692..a4295aea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lapce-data/src/document.rs b/lapce-data/src/document.rs index 2eb6b259..7ba57fa3 100644 --- a/lapce-data/src/document.rs +++ b/lapce-data/src/document.rs @@ -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);