Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 3e725d7

Browse files
maxijabaseHexer10
andcommitted
finished closing brace placing fix
Co-Authored-By: Mattia <[email protected]>
1 parent 5416307 commit 3e725d7

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

UI/Components/EditorElement/EditorElement.xaml.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -497,19 +497,13 @@ private void TextArea_TextEntering(object sender, TextCompositionEventArgs e)
497497
case "}":
498498
if (Program.OptionsObject.Editor_AutoCloseBrackets)
499499
{
500-
if (editor.TextArea.Caret.Offset + 1 < editor.Document.TextLength)
500+
if (editor.TextArea.Caret.Offset < editor.Document.TextLength &&
501+
BracketHelpers.CheckForClosingBracket(editor.Document, editor.TextArea.Caret.Offset, e.Text))
501502
{
502-
if (BracketHelpers.CheckForClosingBracket(editor.Document, editor.TextArea.Caret.Offset, e.Text))
503-
{
504-
e.Handled = true;
505-
var newCaretPos = editor.TextArea.Caret.Offset + 1;
506-
var docLength = editor.Document.TextLength;
507-
editor.TextArea.Caret.Offset = newCaretPos > docLength ? docLength : newCaretPos;
508-
}
509-
}
510-
else
511-
{
512-
503+
e.Handled = true;
504+
var newCaretPos = editor.TextArea.Caret.Offset + 1;
505+
var docLength = editor.Document.TextLength;
506+
editor.TextArea.Caret.Offset = newCaretPos > docLength ? docLength : newCaretPos;
513507
}
514508
}
515509

0 commit comments

Comments
 (0)