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