mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
QuickFind fixes
This commit is contained in:
parent
f6752b703d
commit
18fa7e8a7b
3 changed files with 56 additions and 33 deletions
|
@ -79,6 +79,7 @@ namespace IDE.ui
|
||||||
public int32 mCurFindIdx = -1;
|
public int32 mCurFindIdx = -1;
|
||||||
public int32 mCurFindStart = 0;
|
public int32 mCurFindStart = 0;
|
||||||
public int32 mCurFindCount;
|
public int32 mCurFindCount;
|
||||||
|
public int32 mCurFindDir;
|
||||||
//public bool mSearchDidWrap;
|
//public bool mSearchDidWrap;
|
||||||
public bool mIsReplace;
|
public bool mIsReplace;
|
||||||
public int32 mLastTextVersion;
|
public int32 mLastTextVersion;
|
||||||
|
@ -254,9 +255,9 @@ namespace IDE.ui
|
||||||
{
|
{
|
||||||
uint8 mask = 0xFF;
|
uint8 mask = 0xFF;
|
||||||
if (clearMatches)
|
if (clearMatches)
|
||||||
mask = (uint8)(mask & ~(uint8)SourceElementFlags.Find_Matches);
|
mask = (uint8)(mask & ~(uint8)(SourceElementFlags.Find_Matches));
|
||||||
//if (clearSelection)
|
if (clearSelection)
|
||||||
//mask = (byte)(mask & ~(byte)SourceElementFlags.Find_CurrentSelection);
|
mask = (uint8)(mask & ~(uint8)SourceElementFlags.Find_CurrentSelection);
|
||||||
|
|
||||||
bool foundFlags = false;
|
bool foundFlags = false;
|
||||||
var text = mEditWidget.Content.mData.mText;
|
var text = mEditWidget.Content.mData.mText;
|
||||||
|
@ -301,12 +302,19 @@ namespace IDE.ui
|
||||||
return;
|
return;
|
||||||
var editWidgetContent = mEditWidget.Content;
|
var editWidgetContent = mEditWidget.Content;
|
||||||
editWidgetContent.MoveCursorToIdx(mCurFindIdx + (int32)findText.Length, true);
|
editWidgetContent.MoveCursorToIdx(mCurFindIdx + (int32)findText.Length, true);
|
||||||
|
|
||||||
|
for (int32 idx = mCurFindIdx; idx < mCurFindIdx + findText.Length; idx++)
|
||||||
|
{
|
||||||
|
uint8 flags = (uint8)SourceElementFlags.Find_CurrentSelection;
|
||||||
|
mEditWidget.Content.mData.mText[idx].mDisplayFlags = (uint8)(mEditWidget.Content.mData.mText[idx].mDisplayFlags | flags);
|
||||||
|
}
|
||||||
|
|
||||||
if ((mSelectionStart == null) || (mParent == null))
|
if ((mSelectionStart == null) || (mParent == null))
|
||||||
{
|
{
|
||||||
if (mFoundMatches)
|
/*if (mFoundMatches)
|
||||||
editWidgetContent.mSelection = EditSelection(mCurFindIdx, mCurFindIdx + (int32)findText.Length);
|
editWidgetContent.mSelection = EditSelection(mCurFindIdx, mCurFindIdx + (int32)findText.Length);
|
||||||
else if (!String.IsNullOrWhiteSpace(findText))
|
else if (!String.IsNullOrWhiteSpace(findText))
|
||||||
editWidgetContent.mSelection = null;
|
editWidgetContent.mSelection = null;*/
|
||||||
}
|
}
|
||||||
if (mHasNewActiveCursorPos)
|
if (mHasNewActiveCursorPos)
|
||||||
{
|
{
|
||||||
|
@ -337,9 +345,11 @@ namespace IDE.ui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearFlags(false, true);
|
|
||||||
if (FindNext(dir, true, showMessage ? ErrorReportType.MessageBox : ErrorReportType.Sound))
|
if (FindNext(dir, true, showMessage ? ErrorReportType.MessageBox : ErrorReportType.Sound))
|
||||||
ShowCurrentSelection();
|
{
|
||||||
|
ClearFlags(false, true);
|
||||||
|
ShowCurrentSelection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ErrorReportType
|
public enum ErrorReportType
|
||||||
|
@ -373,7 +383,9 @@ namespace IDE.ui
|
||||||
findTextLower.ToLower();
|
findTextLower.ToLower();
|
||||||
String findTextUpper = scope String(findText);
|
String findTextUpper = scope String(findText);
|
||||||
findTextUpper.ToUpper();
|
findTextUpper.ToUpper();
|
||||||
|
|
||||||
|
Debug.WriteLine("Before: mCurFindIdx:{} mCurFindStart:{} mCurFindCount:{}", mCurFindIdx, mCurFindStart, mCurFindCount);
|
||||||
|
|
||||||
if ((mCurFindIdx == -1) && (mSelectionStart != null))
|
if ((mCurFindIdx == -1) && (mSelectionStart != null))
|
||||||
{
|
{
|
||||||
mCurFindIdx = mSelectionStart.mIndex - 1;
|
mCurFindIdx = mSelectionStart.mIndex - 1;
|
||||||
|
@ -390,17 +402,19 @@ namespace IDE.ui
|
||||||
if (dir < 0)
|
if (dir < 0)
|
||||||
{
|
{
|
||||||
if (mCurFindIdx == -1)
|
if (mCurFindIdx == -1)
|
||||||
searchStartIdx = selEnd + dir - (int32)findText.Length;
|
{
|
||||||
|
searchStartIdx = selEnd + dir - (int32)findText.Length;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
searchStartIdx = mCurFindIdx + dir;
|
searchStartIdx = mCurFindIdx + dir;
|
||||||
if (searchStartIdx < selStart)
|
/*if (searchStartIdx < selStart)
|
||||||
searchStartIdx = selStart;
|
searchStartIdx = selStart;*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
searchStartIdx = mCurFindIdx + dir;
|
searchStartIdx = mCurFindIdx + dir;
|
||||||
if (searchStartIdx < selStart)
|
/*if (searchStartIdx < selStart)
|
||||||
searchStartIdx = selStart;
|
searchStartIdx = selStart;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if ((searchStartIdx == mCurFindStart) && (mCurFindCount > 0))
|
/*if ((searchStartIdx == mCurFindStart) && (mCurFindCount > 0))
|
||||||
|
@ -414,7 +428,7 @@ namespace IDE.ui
|
||||||
{
|
{
|
||||||
if (startIdx > selEnd - findText.Length)
|
if (startIdx > selEnd - findText.Length)
|
||||||
break;
|
break;
|
||||||
if (startIdx < 0)
|
if (startIdx < selStart)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
bool isEqual = true;
|
bool isEqual = true;
|
||||||
|
@ -439,6 +453,18 @@ namespace IDE.ui
|
||||||
int a = 0;
|
int a = 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
if (mCurFindDir != dir)
|
||||||
|
{
|
||||||
|
mCurFindDir = dir;
|
||||||
|
mCurFindCount = 0;
|
||||||
|
mCurFindStart = mCurFindIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
defer
|
||||||
|
{
|
||||||
|
Debug.WriteLine("After: mCurFindIdx:{} mCurFindStart:{} mCurFindCount:{}", mCurFindIdx, mCurFindStart, mCurFindCount);
|
||||||
|
}
|
||||||
|
|
||||||
if (dir < 0)
|
if (dir < 0)
|
||||||
{
|
{
|
||||||
int32 checkOfs = (mCurFindCount == 0) ? 1 : 0;
|
int32 checkOfs = (mCurFindCount == 0) ? 1 : 0;
|
||||||
|
@ -447,7 +473,7 @@ namespace IDE.ui
|
||||||
if (isSelection)
|
if (isSelection)
|
||||||
ShowDoneError(errorType);
|
ShowDoneError(errorType);
|
||||||
|
|
||||||
mCurFindIdx = mCurFindStart - 1;
|
mCurFindIdx = mCurFindStart + 1;
|
||||||
mCurFindCount = 0;
|
mCurFindCount = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -478,8 +504,8 @@ namespace IDE.ui
|
||||||
for (int32 idx = nextIdx; idx < nextIdx + findText.Length; idx++)
|
for (int32 idx = nextIdx; idx < nextIdx + findText.Length; idx++)
|
||||||
{
|
{
|
||||||
uint8 flags = (uint8)SourceElementFlags.Find_Matches;
|
uint8 flags = (uint8)SourceElementFlags.Find_Matches;
|
||||||
//if (isSelection)
|
/*if (isSelection)
|
||||||
//flags |= (byte)SourceElementFlags.Find_CurrentSelection;
|
flags |= (uint8)SourceElementFlags.Find_CurrentSelection;*/
|
||||||
|
|
||||||
mEditWidget.Content.mData.mText[idx].mDisplayFlags = (uint8)(mEditWidget.Content.mData.mText[idx].mDisplayFlags | flags);
|
mEditWidget.Content.mData.mText[idx].mDisplayFlags = (uint8)(mEditWidget.Content.mData.mText[idx].mDisplayFlags | flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,16 +572,6 @@ namespace IDE.ui
|
||||||
if ((flags & ~(uint8)SourceElementFlags.Skipped) == 0)
|
if ((flags & ~(uint8)SourceElementFlags.Skipped) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*if ((flags & (byte)SourceElementFlags.Find_CurrentSelection) != 0)
|
|
||||||
{
|
|
||||||
using (g.PushColor(0xFF706030))
|
|
||||||
g.FillRect(x, y, width, mFont.GetLineSpacing());
|
|
||||||
|
|
||||||
DrawSectionFlagsOver(g, x, y, width, (byte)(flags & ~(byte)(SourceElementFlags.Find_CurrentSelection | SourceElementFlags.Find_Matches)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else*/
|
|
||||||
|
|
||||||
if ((flags & (uint8)SourceElementFlags.SymbolReference) != 0)
|
if ((flags & (uint8)SourceElementFlags.SymbolReference) != 0)
|
||||||
{
|
{
|
||||||
bool isRenameSymbol = (IDEApp.sApp.mSymbolReferenceHelper != null) && (IDEApp.sApp.mSymbolReferenceHelper.mKind == SymbolReferenceHelper.Kind.Rename);
|
bool isRenameSymbol = (IDEApp.sApp.mSymbolReferenceHelper != null) && (IDEApp.sApp.mSymbolReferenceHelper.mKind == SymbolReferenceHelper.Kind.Rename);
|
||||||
|
@ -592,12 +582,18 @@ namespace IDE.ui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((flags & (uint8)SourceElementFlags.Find_CurrentSelection) != 0)
|
||||||
|
{
|
||||||
|
using (g.PushColor(0x80FFE0B0))
|
||||||
|
g.FillRect(x, y, width, mFont.GetLineSpacing());
|
||||||
|
|
||||||
|
DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)(SourceElementFlags.Find_CurrentSelection | .Find_Matches)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & (uint8)SourceElementFlags.Find_Matches) != 0)
|
if ((flags & (uint8)SourceElementFlags.Find_Matches) != 0)
|
||||||
{
|
{
|
||||||
//using (g.PushColor(0xFF505050))
|
using (g.PushColor(0x50D0C090))
|
||||||
//using (g.PushColor(0x30B0B0B0))
|
|
||||||
//using (g.PushColor(0x28FFFFFF))
|
|
||||||
using (g.PushColor(0x34FFE0B0))
|
|
||||||
g.FillRect(x, y, width, mFont.GetLineSpacing());
|
g.FillRect(x, y, width, mFont.GetLineSpacing());
|
||||||
|
|
||||||
DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)SourceElementFlags.Find_Matches));
|
DrawSectionFlagsOver(g, x, y, width, (uint8)(flags & ~(uint8)SourceElementFlags.Find_Matches));
|
||||||
|
|
|
@ -54,8 +54,9 @@ namespace IDE.ui
|
||||||
CompilerFlags_Mask = 0x0F,
|
CompilerFlags_Mask = 0x0F,
|
||||||
|
|
||||||
SpellingError = 0x10,
|
SpellingError = 0x10,
|
||||||
Find_Matches = 0x20,
|
Find_Matches = 0x20,
|
||||||
SymbolReference = 0x40,
|
Find_CurrentSelection = 0x40,
|
||||||
|
SymbolReference = 0x80,
|
||||||
EditorFlags_Mask = 0xF0,
|
EditorFlags_Mask = 0xF0,
|
||||||
|
|
||||||
MASK = 0xFF
|
MASK = 0xFF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue