1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-13 05:44:11 +02:00

Don't consider cursor in open space when in literal

This commit is contained in:
ESH 2025-02-07 13:00:12 +01:00
parent 60988fda8f
commit 7d8d6296ce

View file

@ -4193,8 +4193,10 @@ namespace IDE.ui
//int cursorTextPos = CursorTextPos; //int cursorTextPos = CursorTextPos;
if (cursorTextPos < mData.mTextLength) if (cursorTextPos < mData.mTextLength)
{ {
charUnderCursor = (char8)mData.mText[cursorTextPos].mChar; let charData = mData.mText[cursorTextPos];
cursorInOpenSpace = ((charUnderCursor == ')') || (charUnderCursor == ']') || (charUnderCursor == ';') || (charUnderCursor == (char8)0) || (charUnderCursor.IsWhiteSpace)); let cursorInLiteral = (SourceElementType)charData.mDisplayTypeId == .Literal;
charUnderCursor = (char8)charData.mChar;
cursorInOpenSpace = ((!cursorInLiteral) && ((charUnderCursor == ')') || (charUnderCursor == ']') || (charUnderCursor == ';') || (charUnderCursor == (char8)0) || (charUnderCursor.IsWhiteSpace)));
if (((keyChar == '(') && (charUnderCursor == ')')) || if (((keyChar == '(') && (charUnderCursor == ')')) ||
((keyChar == '[') && (charUnderCursor == ']'))) ((keyChar == '[') && (charUnderCursor == ']')))
@ -4229,7 +4231,7 @@ namespace IDE.ui
} }
else else
{ {
if ((keyChar == '"') || (keyChar == '\'')) if ((!cursorInLiteral) && ((keyChar == '"') || (keyChar == '\'')))
cursorInOpenSpace = true; cursorInOpenSpace = true;
} }
} }