Skip to content

Commit dfb58ef

Browse files
committed
fixes #4629
1 parent e413928 commit dfb58ef

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Rubberduck.Core/AutoComplete/SelfClosingPairs/SelfClosingPairHandler.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Linq;
34
using Rubberduck.Settings;
45
using Rubberduck.VBEditor;
@@ -130,14 +131,21 @@ private bool HandleInternal(AutoCompleteEventArgs e, CodeString original, SelfCl
130131
}
131132

132133
var reprettified = CodePaneHandler.Prettify(e.Module, result);
133-
if (pair.OpeningChar == '(' && e.Character == pair.OpeningChar && !reprettified.Equals(result))
134+
if (pair.OpeningChar == '(' && e.Character == pair.OpeningChar)
134135
{
136+
if (string.Equals(reprettified.Code, result.Code, StringComparison.InvariantCultureIgnoreCase))
137+
{
138+
e.Handled = true;
139+
result = reprettified;
140+
return true;
141+
}
142+
135143
// VBE eats it. bail out but don't swallow the keypress.
136144
e.Handled = false;
137145
result = null;
138146
return false;
139147
}
140-
148+
141149
var currentLine = reprettified.Lines[reprettified.CaretPosition.StartLine];
142150
if (!string.IsNullOrWhiteSpace(currentLine) &&
143151
currentLine.EndsWith(" ") &&

0 commit comments

Comments
 (0)