From 60bcea88ed6f9bfa331c29f72e61b710a422b62c Mon Sep 17 00:00:00 2001 From: VaporGame Date: Sat, 26 Apr 2025 17:06:26 +0200 Subject: [PATCH 1/2] Fix line highlighting bug and Fix opening ZCPU documentation --- lua/wire/cpulib.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lua/wire/cpulib.lua b/lua/wire/cpulib.lua index 41ba6e6..dfaceb2 100644 --- a/lua/wire/cpulib.lua +++ b/lua/wire/cpulib.lua @@ -372,6 +372,11 @@ if CLIENT or TESTING then -- Update highlighted lines function CPULib.DebugUpdateHighlights(dontForcePosition) if ZCPU_Editor then + -- Clear all highlighted lines + for tab=1,ZCPU_Editor:GetNumTabs() do + ZCPU_Editor:GetEditor(tab):ClearHighlightedLines() + end + -- Highlight current position local currentPosition = CPULib.Debugger.PositionByPointer[CPULib.Debugger.Variables[CPULib.Debugger.PreferredTracker or "IP"]] if currentPosition then @@ -380,10 +385,6 @@ if CLIENT or TESTING then if not currentPosition.File:sub(1,9):match("cpuchip/") then return end - -- Clear all highlighted lines - for tab=1,ZCPU_Editor:GetNumTabs() do - ZCPU_Editor:GetEditor(tab):ClearHighlightedLines() - end local textEditor = CPULib.SelectTab(ZCPU_Editor,currentPosition.File,not CPULib.Debugger.FollowTracker) if textEditor then @@ -464,6 +465,7 @@ if CLIENT or TESTING then CPULib.HandbookWindow = nil -- Platform bookmarks, it'll automatically jump to this section when opening. local bookmarks = { + ZCPU="", ZGPU="#zgpu", ZSPU="#zspu" } @@ -480,7 +482,7 @@ if CLIENT or TESTING then browser:SetPos(10, 25) browser:SetSize(w - 20, h - 35) - browser:OpenURL("https://wiremod.github.io/Miscellaneous/zcpudoc.html"..bookmarks[bookmark] or "") + browser:OpenURL("https://wiremod.github.io/Miscellaneous/zcpudoc.html"..bookmarks[bookmark]) end end From d8b4f3680c2d0eddd72280c5b57d44bca5f64a5a Mon Sep 17 00:00:00 2001 From: VaporGame <81253710+VaporGame@users.noreply.github.com> Date: Sun, 27 Apr 2025 13:46:15 +0200 Subject: [PATCH 2/2] Update lua/wire/cpulib.lua Add failsafe for opening docs Co-authored-by: thegrb93 --- lua/wire/cpulib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/wire/cpulib.lua b/lua/wire/cpulib.lua index dfaceb2..345ad97 100644 --- a/lua/wire/cpulib.lua +++ b/lua/wire/cpulib.lua @@ -482,7 +482,7 @@ if CLIENT or TESTING then browser:SetPos(10, 25) browser:SetSize(w - 20, h - 35) - browser:OpenURL("https://wiremod.github.io/Miscellaneous/zcpudoc.html"..bookmarks[bookmark]) + browser:OpenURL("https://wiremod.github.io/Miscellaneous/zcpudoc.html"..(bookmarks[bookmark] or "")) end end