1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-19 16:40:26 +02:00

Scope Prev/Next, other minor improvements

This commit is contained in:
Brian Fiete 2020-06-23 15:24:50 -07:00
parent 0154b75923
commit 9e009b134c
7 changed files with 115 additions and 4 deletions

View file

@ -4808,6 +4808,20 @@ namespace IDE
mHistoryManager.NextHistory();
}
void ScopePrev()
{
var sewc = GetActiveSourceEditWidgetContent();
if (sewc != null)
sewc.ScopePrev();
}
void ScopeNext()
{
var sewc = GetActiveSourceEditWidgetContent();
if (sewc != null)
sewc.ScopeNext();
}
void ExitTest()
{
sExitTest = true;

View file

@ -485,6 +485,8 @@ namespace IDE
Add("Run Without Compiling", "Ctrl+Shift+F5");
Add("Save All", "Ctrl+Shift+S");
Add("Save File", "Ctrl+S");
Add("Scope Prev", "Alt+Up");
Add("Scope Next", "Alt+Down");
Add("Set Next Statement", "Ctrl+Shift+F10");
Add("Show Auto Watches", "Ctrl+Alt+A");
Add("Show Autocomplete Panel", "Ctrl+Alt+U");

View file

@ -52,6 +52,7 @@ namespace IDE.ui
MakeEditable();
mEditWidget.mOnContentChanged.Add(new => NavigationBarChanged);
mEditWidget.mOnKeyDown.Add(new => EditKeyDownHandler);
mEditWidget.mOnGotFocus.Add(new (widget) => mEditWidget.mEditWidgetContent.SelectAll());
mEditWidget.mEditWidgetContent.mWantsUndo = false;
mFocusDropdown = false;
}

View file

@ -383,6 +383,13 @@ namespace IDE.ui
var bfSystem = IDEApp.sApp.mBfResolveSystem;
var bfCompiler = IDEApp.sApp.mBfResolveCompiler;
if (mGettingSymbolInfo)
{
gApp.Fail("Cannot rename symbols here");
mGettingSymbolInfo = false;
return;
}
Debug.Assert(!mGettingSymbolInfo);
StopWork();
@ -855,7 +862,9 @@ namespace IDE.ui
if (mSourceViewPanel.[Friend]mWantsFullClassify)
hasWorkLeft = true;
if (mSourceViewPanel.HasDeferredResolveResults())
{
hasWorkLeft = true;
}
if (!hasWorkLeft)
{
StartWork();

View file

@ -1521,6 +1521,70 @@ namespace IDE.ui
return;
}
public void ScopePrev()
{
int pos = CursorTextPos - 1;
int openCount = 0;
while (pos >= 0)
{
let c = mData.mText[pos].mChar;
let displayType = (SourceElementType)mData.mText[pos].mDisplayTypeId;
if (displayType == .Normal)
{
if (c == '{')
{
openCount--;
if (openCount <= 0)
{
CursorTextPos = pos;
EnsureCursorVisible();
break;
}
}
else if (c == '}')
{
openCount++;
}
}
pos--;
}
}
public void ScopeNext()
{
int pos = CursorTextPos;
int openCount = 0;
while (pos < mData.mTextLength)
{
let c = mData.mText[pos].mChar;
let displayType = (SourceElementType)mData.mText[pos].mDisplayTypeId;
if (displayType == .Normal)
{
if (c == '}')
{
openCount--;
if (openCount <= 0)
{
CursorTextPos = pos + 1;
EnsureCursorVisible();
break;
}
}
else if (c == '{')
{
openCount++;
}
}
pos++;
}
}
bool IsTextSpanEmpty(int32 start, int32 length)
{
for (int32 i = start; i < start + length; i++)