diff --git a/BeefLibs/Beefy2D/src/theme/dark/DarkEditWidget.bf b/BeefLibs/Beefy2D/src/theme/dark/DarkEditWidget.bf index b8175ffa..7c4e7833 100644 --- a/BeefLibs/Beefy2D/src/theme/dark/DarkEditWidget.bf +++ b/BeefLibs/Beefy2D/src/theme/dark/DarkEditWidget.bf @@ -22,6 +22,7 @@ namespace Beefy.theme.dark public bool mWantsCheckScrollPosition; public uint32 mViewWhiteSpaceColor; public bool mScrollToStartOnLostFocus; + public bool mHiliteCurrentLine; protected static uint32[] sDefaultColors = new uint32[] ( Color.White ) ~ delete _; @@ -480,9 +481,21 @@ namespace Beefy.theme.dark } if (aX != -1) - { + { + if (mHiliteCurrentLine && selStartIdx == selEndIdx) + { + float thickness = 2 * (lineSpacing / 18); + // This isn't quite the right value, but I'm not sure how to get this + // to properly highlight the whole line without getting cut off - this works well for now. + float totalLineWidth = mEditWidget.mScrollContentContainer.mWidth - thickness; + + float x = (int)mEditWidget.mHorzPos.v; // If we don't round to int we get jitter while scrolling. + using (g.PushColor(DarkTheme.COLOR_CURRENT_LINE_HILITE)) + g.OutlineRect(x, curY, totalLineWidth, lineSpacing + thickness, thickness); + } + float brightness = (float)Math.Cos(Math.Max(0.0f, mCursorBlinkTicks - 20) / 9.0f); - brightness = Math.Max(0, Math.Min(1.0f, brightness * 2.0f + 1.6f)); + brightness = Math.Clamp(brightness * 2.0f + 1.6f, 0, 1); if (mEditWidget.mVertPos.IsMoving) brightness = 0; // When we animate a pgup or pgdn, it's weird seeing the cursor scrolling around @@ -503,7 +516,7 @@ namespace Beefy.theme.dark } else { - using (g.PushColor(Color.Mult(cursorColor, Color.Get(brightness)))) + using (g.PushColor(Color.Mult(cursorColor, Color.Get(brightness)))) g.FillRect(aX, curY, Math.Max(1.0f, GS!(1)), lineSpacing); } drewCursor = true; diff --git a/BeefLibs/Beefy2D/src/theme/dark/DarkTheme.bf b/BeefLibs/Beefy2D/src/theme/dark/DarkTheme.bf index c8bc8e14..15cb6fee 100644 --- a/BeefLibs/Beefy2D/src/theme/dark/DarkTheme.bf +++ b/BeefLibs/Beefy2D/src/theme/dark/DarkTheme.bf @@ -191,6 +191,7 @@ namespace Beefy.theme.dark public static uint32 COLOR_SELECTED_OUTLINE = 0xFFCFAE11; public static uint32 COLOR_MENU_FOCUSED = 0xFFE5A910; public static uint32 COLOR_MENU_SELECTED = 0xFFCB9B80; + public static uint32 COLOR_CURRENT_LINE_HILITE = 0xFF4C4C54; public static float sScale = 1.0f; public static int32 sSrcImgScale = 1; diff --git a/BeefLibs/corlib/src/Diagnostics/Debug.bf b/BeefLibs/corlib/src/Diagnostics/Debug.bf index 7ab33151..dd22b0ab 100644 --- a/BeefLibs/corlib/src/Diagnostics/Debug.bf +++ b/BeefLibs/corlib/src/Diagnostics/Debug.bf @@ -70,7 +70,7 @@ namespace System.Diagnostics public static void WriteLine(StringView line) { - String lineStr = scope String(Math.Min(line.Length, 4096)); + String lineStr = scope String(Math.Min(line.Length + 1, 4096)); lineStr.Append(line); lineStr.Append('\n'); Write(lineStr.Ptr, lineStr.Length); diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index 79913955..ba7e9e55 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -6097,6 +6097,7 @@ namespace IDE //mEditWidget.mVertScrollbar.mScrollIncrement = editWidgetContent.mFont.GetLineSpacing(); editWidgetContent.mHiliteColor = 0xFF384858; editWidgetContent.mUnfocusedHiliteColor = 0x80384858; + editWidgetContent.mHiliteCurrentLine = mSettings.mEditorSettings.mHiliteCurrentLine; return editWidget; } diff --git a/IDE/src/Settings.bf b/IDE/src/Settings.bf index dab259bd..fc5e6785 100644 --- a/IDE/src/Settings.bf +++ b/IDE/src/Settings.bf @@ -324,6 +324,7 @@ namespace IDE public Color mBuildError = 0xFFFF8080; public Color mBuildWarning = 0xFFFFFF80; public Color mVisibleWhiteSpace = 0xFF9090C0; + public Color mCurrentLineHilite = 0xFF4C4C54; public void Deserialize(StructuredData sd) { @@ -348,6 +349,7 @@ namespace IDE GetColor("WorkspaceFailedText", ref mWorkspaceFailedText); GetColor("WorkspaceManualIncludeText", ref mWorkspaceManualIncludeText); GetColor("WorkspaceIgnoredText", ref mWorkspaceIgnoredText); + GetColor("CurrentLineHilite", ref mCurrentLineHilite); GetColor("Code", ref mCode); GetColor("Keyword", ref mKeyword); @@ -411,6 +413,7 @@ namespace IDE DarkTheme.COLOR_SELECTED_OUTLINE = mSelectedOutline; DarkTheme.COLOR_MENU_FOCUSED = mMenuFocused; DarkTheme.COLOR_MENU_SELECTED = mMenuSelected; + DarkTheme.COLOR_CURRENT_LINE_HILITE = mCurrentLineHilite; } } @@ -616,6 +619,7 @@ namespace IDE public bool mFuzzyAutoComplete = false; public bool mShowLocatorAnim = true; public bool mHiliteCursorReferences = true; + public bool mHiliteCurrentLine = true; public bool mLockEditing; public LockWhileDebuggingKind mLockEditingWhenDebugging = .WhenNotHotSwappable;// Only applicable for // non-Beef sources @@ -644,6 +648,7 @@ namespace IDE sd.Add("FuzzyAutoComplete", mFuzzyAutoComplete); sd.Add("ShowLocatorAnim", mShowLocatorAnim); sd.Add("HiliteCursorReferences", mHiliteCursorReferences); + sd.Add("HiliteCurrentLine", mHiliteCurrentLine); sd.Add("LockEditing", mLockEditing); sd.Add("LockEditingWhenDebugging", mLockEditingWhenDebugging); sd.Add("PerforceAutoCheckout", mPerforceAutoCheckout); @@ -675,6 +680,7 @@ namespace IDE sd.Get("FuzzyAutoComplete", ref mFuzzyAutoComplete); sd.Get("ShowLocatorAnim", ref mShowLocatorAnim); sd.Get("HiliteCursorReferences", ref mHiliteCursorReferences); + sd.Get("HiliteCurrentLine", ref mHiliteCurrentLine); sd.Get("LockEditing", ref mLockEditing); sd.Get("LockEditingWhenDebugging", ref mLockEditingWhenDebugging); sd.Get("PerforceAutoCheckout", ref mPerforceAutoCheckout); @@ -1189,6 +1195,10 @@ namespace IDE } } + for (let value in gApp.mFileEditData.Values) + if (value.mEditWidget != null) + ((SourceEditWidgetContent)value.mEditWidget.Content).mHiliteCurrentLine = gApp.mSettings.mEditorSettings.mHiliteCurrentLine; + if (!mWakaTimeKey.IsEmpty) { if (gApp.mWakaTime == null) diff --git a/IDE/src/ui/SettingsDialog.bf b/IDE/src/ui/SettingsDialog.bf index b82bd49a..096ad90f 100644 --- a/IDE/src/ui/SettingsDialog.bf +++ b/IDE/src/ui/SettingsDialog.bf @@ -101,6 +101,7 @@ namespace IDE.ui AddPropertiesItem(category, "Fuzzy Autocomplete", "mFuzzyAutoComplete"); AddPropertiesItem(category, "Show Locator Animation", "mShowLocatorAnim"); AddPropertiesItem(category, "Hilite Symbol at Cursor", "mHiliteCursorReferences"); + AddPropertiesItem(category, "Hilite Current Line", "mHiliteCurrentLine"); (?, propEntry) = AddPropertiesItem(category, "Spell Check", "mSpellCheckEnabled"); var resetButton = new DarkButton(); @@ -128,7 +129,7 @@ namespace IDE.ui AddPropertiesItem(category, "Format on Save", "mFormatOnSave"); AddPropertiesItem(category, "Sync with Workspace Panel", "mSyncWithWorkspacePanel"); AddPropertiesItem(category, "Wrap Comments at Column", "mWrapCommentsAt"); - + category.Open(true, true); } diff --git a/IDE/src/util/DefinesSet.bf b/IDE/src/util/DefinesSet.bf index d55feafa..4dd2697b 100644 --- a/IDE/src/util/DefinesSet.bf +++ b/IDE/src/util/DefinesSet.bf @@ -18,7 +18,7 @@ namespace IDE.util return; } - if (!mDefinesSet.ContainsAlt(str)) + if (!mDefinesSet.Contains(scope .(str))) { var strCopy = new String(str); mDefines.Add(strCopy);