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

Merge pull request #2132 from m910q/fix_auto_closing_tags_in_string_literal

Don't consider cursor in open space when in literal
This commit is contained in:
Brian Fiete 2025-02-15 14:36:59 -08:00 committed by GitHub
commit 856490755e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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;
} }
} }