I'm calling it from a Lua script. In a fresh Reaper session with no tracks, I can reproduce it consistently.
Reaper 5.33 x64, Windows 8.1

gfx.init("", 200, 200, 0, 200, 200)
local function Main()
local char = gfx.getchar()
if char == -1 or char == 27 then
return 0
end
--local wnd, seg, det = "a", "b", "c" -- <- this code works
local wnd, seg, det = reaper.BR_GetMouseCursorContext() -- <- this code doesn't
local str = (not wnd or wnd == "unknown")
and "- No context -"
or wnd..
(not not seg and (" | "..seg..
(not not det and (" | "..det))))
if string.sub(str, -2) == "| " then str = string.sub(str, 1, -4) end
gfx.x, gfx.y = 10, 10
gfx.drawstr(str)
gfx.update()
reaper.defer(Main)
end
Main()
I'm calling it from a Lua script. In a fresh Reaper session with no tracks, I can reproduce it consistently.
Reaper 5.33 x64, Windows 8.1