1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-27 12:08:00 +02:00

InsertCharPair fix for start-of-line insertions

This commit is contained in:
Brian Fiete 2024-02-24 08:54:57 -05:00
parent fa019f03bf
commit 59f2451cf9

View file

@ -3781,8 +3781,8 @@ namespace IDE.ui
void InsertCharPair(String charPair) void InsertCharPair(String charPair)
{ {
mCurParenPairIdSet.Add(mData.mNextCharId);
base.InsertCharPair(charPair); base.InsertCharPair(charPair);
mCurParenPairIdSet.Add(mData.mNextCharId - 2);
} }
public override void KeyChar(char32 keyChar) public override void KeyChar(char32 keyChar)
@ -4156,20 +4156,20 @@ namespace IDE.ui
if (prevElementType != SourceElementType.Comment) if (prevElementType != SourceElementType.Comment)
{ {
doChar = false; doChar = false;
char8 char8UnderCursor = (char8)0; char8 charUnderCursor = (char8)0;
bool cursorInOpenSpace = false; bool cursorInOpenSpace = false;
//int cursorTextPos = CursorTextPos; //int cursorTextPos = CursorTextPos;
if (cursorTextPos < mData.mTextLength) if (cursorTextPos < mData.mTextLength)
{ {
char8UnderCursor = (char8)mData.mText[cursorTextPos].mChar; charUnderCursor = (char8)mData.mText[cursorTextPos].mChar;
cursorInOpenSpace = ((char8UnderCursor == ')') || (char8UnderCursor == ']') || (char8UnderCursor == ';') || (char8UnderCursor == (char8)0) || (char8UnderCursor.IsWhiteSpace)); cursorInOpenSpace = ((charUnderCursor == ')') || (charUnderCursor == ']') || (charUnderCursor == ';') || (charUnderCursor == (char8)0) || (charUnderCursor.IsWhiteSpace));
if (((keyChar == '(') && (char8UnderCursor == ')')) || if (((keyChar == '(') && (charUnderCursor == ')')) ||
((keyChar == '[') && (char8UnderCursor == ']'))) ((keyChar == '[') && (charUnderCursor == ']')))
cursorInOpenSpace = IsCurrentPairClosing(cursorTextPos); cursorInOpenSpace = IsCurrentPairClosing(cursorTextPos);
if ((char8UnderCursor == keyChar) && (!HasSelection())) if ((charUnderCursor == keyChar) && (!HasSelection()))
{ {
var wantElementType = SourceElementType.Normal; var wantElementType = SourceElementType.Normal;