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

Symbol rename fixes for extended utf8 chars

This commit is contained in:
Brian Fiete 2022-03-19 07:01:45 -07:00
parent 0672f43d74
commit 332bebe4ff
3 changed files with 34 additions and 5 deletions

View file

@ -896,6 +896,7 @@ namespace IDE.ui
{
if (mClosed)
return;
mClosed = true;
mSourceViewPanel.CancelResolve(.GetSymbolInfo);
@ -1018,6 +1019,16 @@ namespace IDE.ui
return;
}
uint8 curTypeNum = 0;
uint8 curFlags = sourceEditWidgetContent.mInsertDisplayFlags;
sourceEditWidgetContent.GetInsertFlags(index, ref curTypeNum, ref curFlags);
if ((curFlags & (uint8)(SourceElementFlags.SymbolReference)) == 0)
{
// The last char was non-extending
Close();
return;
}
// Close if insert is outside match area
if ((index > 0) && (index < sourceEditWidgetContent.mData.mTextLength) &&
((sourceEditWidgetContent.mData.mText[index - 1].mDisplayFlags & (uint8)(SourceElementFlags.SymbolReference)) == 0) &&
@ -1064,7 +1075,7 @@ namespace IDE.ui
if (mIgnoreTextChanges)
return;
int left = index;
while (left > 0)
{
@ -1077,7 +1088,9 @@ namespace IDE.ui
while (right < sourceEditWidgetContent.mData.mTextLength)
{
if ((sourceEditWidgetContent.mData.mText[right].mDisplayFlags & (uint8)(SourceElementFlags.SymbolReference)) == 0)
{
break;
}
right++;
}

View file

@ -4572,21 +4572,28 @@ namespace IDE.ui
base.Redo();
}
public bool IsSymbolChar(char8 c)
public bool IsWordBreakChar(char8 c)
{
return (c.IsLetterOrDigit) || (c == '_');
if (c < '0')
return true;
switch (c)
{
case '<', '>', '@', '^', '`', '{', '|', '}', '~':
return true;
}
return false;
}
public override void GetInsertFlags(int index, ref uint8 typeId, ref uint8 flags)
{
if ((index > 0) && (IsSymbolChar((char8)mData.mText[index - 1].mChar)))
if ((index > 0) && (!IsWordBreakChar((char8)mData.mText[index - 1].mChar)))
{
typeId = mData.mText[index - 1].mDisplayTypeId; // Copy attr from prev attr
flags = (uint8)(mData.mText[index - 1].mDisplayFlags & mExtendDisplayFlags) | mInsertDisplayFlags;
}
else if (index < mData.mTextLength - 1)
{
if (IsSymbolChar((char8)mData.mText[index].mChar))
if (!IsWordBreakChar((char8)mData.mText[index].mChar))
{
typeId = mData.mText[index].mDisplayTypeId; // Copy attr from prev attr
flags = (uint8)(mData.mText[index].mDisplayFlags & mExtendDisplayFlags) | mInsertDisplayFlags;

View file

@ -3264,6 +3264,11 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
case UTF8PROC_CATEGORY_LM:
case UTF8PROC_CATEGORY_LO:
case UTF8PROC_CATEGORY_NL:
case UTF8PROC_CATEGORY_SM:
case UTF8PROC_CATEGORY_SC:
case UTF8PROC_CATEGORY_SK:
case UTF8PROC_CATEGORY_SO:
allowChar = true;
default: break;
}
@ -3305,6 +3310,10 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
case UTF8PROC_CATEGORY_LM:
case UTF8PROC_CATEGORY_LO:
case UTF8PROC_CATEGORY_NL:
case UTF8PROC_CATEGORY_SM:
case UTF8PROC_CATEGORY_SC:
case UTF8PROC_CATEGORY_SK:
case UTF8PROC_CATEGORY_SO:
case UTF8PROC_CATEGORY_MN:
case UTF8PROC_CATEGORY_MC: