mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Symbol rename fixes for extended utf8 chars
This commit is contained in:
parent
0672f43d74
commit
332bebe4ff
3 changed files with 34 additions and 5 deletions
|
@ -896,6 +896,7 @@ namespace IDE.ui
|
||||||
{
|
{
|
||||||
if (mClosed)
|
if (mClosed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mClosed = true;
|
mClosed = true;
|
||||||
|
|
||||||
mSourceViewPanel.CancelResolve(.GetSymbolInfo);
|
mSourceViewPanel.CancelResolve(.GetSymbolInfo);
|
||||||
|
@ -1018,6 +1019,16 @@ namespace IDE.ui
|
||||||
return;
|
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
|
// Close if insert is outside match area
|
||||||
if ((index > 0) && (index < sourceEditWidgetContent.mData.mTextLength) &&
|
if ((index > 0) && (index < sourceEditWidgetContent.mData.mTextLength) &&
|
||||||
((sourceEditWidgetContent.mData.mText[index - 1].mDisplayFlags & (uint8)(SourceElementFlags.SymbolReference)) == 0) &&
|
((sourceEditWidgetContent.mData.mText[index - 1].mDisplayFlags & (uint8)(SourceElementFlags.SymbolReference)) == 0) &&
|
||||||
|
@ -1077,7 +1088,9 @@ namespace IDE.ui
|
||||||
while (right < sourceEditWidgetContent.mData.mTextLength)
|
while (right < sourceEditWidgetContent.mData.mTextLength)
|
||||||
{
|
{
|
||||||
if ((sourceEditWidgetContent.mData.mText[right].mDisplayFlags & (uint8)(SourceElementFlags.SymbolReference)) == 0)
|
if ((sourceEditWidgetContent.mData.mText[right].mDisplayFlags & (uint8)(SourceElementFlags.SymbolReference)) == 0)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
right++;
|
right++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4572,21 +4572,28 @@ namespace IDE.ui
|
||||||
base.Redo();
|
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)
|
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
|
typeId = mData.mText[index - 1].mDisplayTypeId; // Copy attr from prev attr
|
||||||
flags = (uint8)(mData.mText[index - 1].mDisplayFlags & mExtendDisplayFlags) | mInsertDisplayFlags;
|
flags = (uint8)(mData.mText[index - 1].mDisplayFlags & mExtendDisplayFlags) | mInsertDisplayFlags;
|
||||||
}
|
}
|
||||||
else if (index < mData.mTextLength - 1)
|
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
|
typeId = mData.mText[index].mDisplayTypeId; // Copy attr from prev attr
|
||||||
flags = (uint8)(mData.mText[index].mDisplayFlags & mExtendDisplayFlags) | mInsertDisplayFlags;
|
flags = (uint8)(mData.mText[index].mDisplayFlags & mExtendDisplayFlags) | mInsertDisplayFlags;
|
||||||
|
|
|
@ -3264,6 +3264,11 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
|
||||||
case UTF8PROC_CATEGORY_LM:
|
case UTF8PROC_CATEGORY_LM:
|
||||||
case UTF8PROC_CATEGORY_LO:
|
case UTF8PROC_CATEGORY_LO:
|
||||||
case UTF8PROC_CATEGORY_NL:
|
case UTF8PROC_CATEGORY_NL:
|
||||||
|
case UTF8PROC_CATEGORY_SM:
|
||||||
|
case UTF8PROC_CATEGORY_SC:
|
||||||
|
case UTF8PROC_CATEGORY_SK:
|
||||||
|
case UTF8PROC_CATEGORY_SO:
|
||||||
|
|
||||||
allowChar = true;
|
allowChar = true;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
@ -3305,6 +3310,10 @@ void BfParser::NextToken(int endIdx, bool outerIsInterpolate, bool disablePrepro
|
||||||
case UTF8PROC_CATEGORY_LM:
|
case UTF8PROC_CATEGORY_LM:
|
||||||
case UTF8PROC_CATEGORY_LO:
|
case UTF8PROC_CATEGORY_LO:
|
||||||
case UTF8PROC_CATEGORY_NL:
|
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_MN:
|
||||||
case UTF8PROC_CATEGORY_MC:
|
case UTF8PROC_CATEGORY_MC:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue