diff --git a/IDE/src/Debugger/DebugManager.bf b/IDE/src/Debugger/DebugManager.bf index a3b8a63e..046b01c8 100644 --- a/IDE/src/Debugger/DebugManager.bf +++ b/IDE/src/Debugger/DebugManager.bf @@ -96,7 +96,8 @@ namespace IDE.Debugger MemoryAddress = 0x40, MemoryWatch = 0x80, Symbol = 0x100, - StepIntoCall = 0x200 + StepIntoCall = 0x200, + RawStr = 0x400, } [Reflect] diff --git a/IDE/src/ui/HoverWatch.bf b/IDE/src/ui/HoverWatch.bf index dae9c039..5fae8f47 100644 --- a/IDE/src/ui/HoverWatch.bf +++ b/IDE/src/ui/HoverWatch.bf @@ -718,6 +718,14 @@ namespace IDE.ui var watch = useListViewItem.mWatchEntry; String.NewOrSet!(watch.mName, displayString); String.NewOrSet!(watch.mEvalStr, evalString); + + if (watch.mEvalStr.StartsWith("!raw")) + { + for (int i < 4) + watch.mEvalStr[i] = ' '; + watch.mResultType = .RawText; + } + useListViewItem.mWatchEntry = watch; if (!isLiteral) useListViewItem.Label = displayString; @@ -759,11 +767,13 @@ namespace IDE.ui flags |= .AllowSideEffects | .AllowCalls; if (gApp.mSettings.mDebuggerSettings.mAutoEvaluateProperties) flags |= .AllowProperties; + if (watch.mResultType == .RawText) + flags |= .RawStr; DebugManager.Language language = mLanguage; if (parentWatchEntry != null) language = parentWatchEntry.mLanguage; - gApp.DebugEvaluate(null, evalString, val, -1, language, flags); + gApp.DebugEvaluate(null, watch.mEvalStr, val, -1, language, flags); } if (val == "!pending") { @@ -773,6 +783,13 @@ namespace IDE.ui } watch.mIsPending = false; } + + if (watch.mResultType == .RawText) + { + String.NewOrSet!(valueSubItem.mLabel, val); + return useListViewItem; + } + var vals = scope List(val.Split('\n')); //if (!vals[0].IsEmpty) diff --git a/IDE/src/ui/ImmediateWidget.bf b/IDE/src/ui/ImmediateWidget.bf index 1151fe1f..0c31f89b 100644 --- a/IDE/src/ui/ImmediateWidget.bf +++ b/IDE/src/ui/ImmediateWidget.bf @@ -7,6 +7,7 @@ using Beefy.theme.dark; using Beefy.gfx; using System.Diagnostics; using System.IO; +using IDE.Debugger; namespace IDE.ui { @@ -379,7 +380,11 @@ namespace IDE.ui var subItemLabel = result.GetSubItem(1).mLabel; if (subItemLabel == null) subItemLabel = ""; - mEditWidgetContent.AppendText(scope String(" ", subItemLabel, "\n")); + + if (result.mWatchEntry.mResultType == .RawText) + mEditWidgetContent.AppendText(scope String(subItemLabel, "\n")); + else + mEditWidgetContent.AppendText(scope String(" ", subItemLabel, "\n")); if (result.mWatchEntry.mWarnings != null) { @@ -415,7 +420,11 @@ namespace IDE.ui for (int32 i = startPos; i < mEditWidgetContent.mData.mTextLength; i++) mEditWidgetContent.mData.mText[i].mDisplayTypeId = (uint8)SourceElementType.Error; } - else + else if (result.mWatchEntry.mResultType == .RawText) + { + // No info button + } + else { mInfoButton.Resize(resultX - GS!(3), resultY - GS!(2), GS!(20), GS!(20)); mEditWidgetContent.AddWidget(mInfoButton); @@ -547,7 +556,16 @@ namespace IDE.ui } else { - gApp.DebugEvaluate(null, cmdText, val, mEditWidgetContent.CursorTextPos - mEntryStartPos.mIndex - 2); + DebugManager.EvalExpressionFlags flags = .None; + + if (cmdText.StartsWith("!raw")) + { + for (int i < 4) + cmdText[i] = ' '; + flags |= .RawStr; + } + + gApp.DebugEvaluate(null, cmdText, val, mEditWidgetContent.CursorTextPos - mEntryStartPos.mIndex - 2, .NotSet, flags); gApp.mIsImmediateDebugExprEval = true; } } @@ -570,7 +588,19 @@ namespace IDE.ui } var info = scope String()..Append(val, idx + ":autocomplete\n".Length); if (!editWidgetContent.mAutoComplete.mIsDocumentationPass) + { + if ((cmdText.StartsWith("!")) && (!cmdText.Contains(' '))) + { + if ("!raw".Contains(cmdText)) + info.Append("cmd\traw\n"); + if ("!info".Contains(cmdText)) + info.Append("cmd\tinfo\n"); + if ("!step".Contains(cmdText)) + info.Append("cmd\tstep\n"); + } + editWidgetContent.mAutoComplete.SetInfo(info, true, mEntryStartPos.mIndex + 1); + } } else if (editWidgetContent.mAutoComplete != null) editWidgetContent.mAutoComplete.Close(); diff --git a/IDE/src/ui/WatchPanel.bf b/IDE/src/ui/WatchPanel.bf index 4ca1eab3..497beab4 100644 --- a/IDE/src/ui/WatchPanel.bf +++ b/IDE/src/ui/WatchPanel.bf @@ -27,7 +27,8 @@ namespace IDE.ui TypeClass = 0x80, TypeValueType = 0x100, Namespace = 0x200, - Text = 0x400 + Text = 0x400, + RawText = 0x800 } public class WatchEntry diff --git a/IDEHelper/Debugger.h b/IDEHelper/Debugger.h index 1b0a740e..a9416539 100644 --- a/IDEHelper/Debugger.h +++ b/IDEHelper/Debugger.h @@ -120,6 +120,7 @@ enum DwEvalExpressionFlags : int16 DwEvalExpressionFlag_MemoryWatch = 0x80, DwEvalExpressionFlag_Symbol = 0x100, DwEvalExpressionFlag_StepIntoCalls = 0x200, + DwEvalExpressionFlag_RawStr = 0x400 }; struct DwDisplayInfo diff --git a/IDEHelper/WinDebugger.cpp b/IDEHelper/WinDebugger.cpp index e685cd74..b443c538 100644 --- a/IDEHelper/WinDebugger.cpp +++ b/IDEHelper/WinDebugger.cpp @@ -9504,6 +9504,11 @@ String WinDebugger::Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, in expressionFlags = (DwEvalExpressionFlags)(expressionFlags & ~DwEvalExpressionFlag_AllowCalls); } + if ((expressionFlags & DwEvalExpressionFlag_RawStr) != 0) + { + formatInfo.mRawString = true; + } + auto dbgModule = GetCallStackDbgModule(callStackIdx); auto dbgSubprogram = GetCallStackSubprogram(callStackIdx); DbgCompileUnit* dbgCompileUnit = NULL;