Post by Stefan on Jan 14, 2024 6:51:45 GMT -5
George,
My LP.MACRO doesn't work if the user has BOUNDS set to a range which prevents LP finding the start of procedures. methods, etc.
So I added
GLOBAL AS NUMBER gLBnd = Get_LBound ' Currently active BOUNDS
GLOBAL AS NUMBER gRBnd = Get_Rbound
GLOBAL AS NUMBER gRBnd = Get_Rbound
SPF_Cmd("BOUNDS 1 MAX") ' Remove any BOUNDS restrictions
at the start and
IF gLBnd <> 1 OR gRBnd <> 0 THEN _ ' Reset the original BOUNDS values
SPF_Cmd("BOUNDS "+gLBnd+" "+gRBnd)
before the macro ends.
SPF_Cmd("BOUNDS "+gLBnd+" "+gRBnd)
before the macro ends.
Problem: The IF statement at the end is always true and resets the BOUNDS to 1 <length-of-longest-line>
This little macro illustrates that Get_Rbound does not perform as documented.
If BOUNDS 1 MAX is in effect, Get_RBound should return a value of 0, but it returns <length-of-longest-line> instead
The status line then reflects the constraint which is carried forward for this sesssion and possibly beyond via an unlocked profile
To illustrate:
' SN.MACRO
DIM AS NUMBER lBnd = Get_LBound ' Currently active left BOUNDS
DIM AS NUMBER rBnd = Get_Rbound ' Currently active right BOUNDS
SPF_CMD("CLS")
SPF_TRACE(ON)
SPF_Debug("Captured Bounds: "+lBnd+" "+rBnd)
SPF_DEBUG("------")
SPF_Cmd("BOUNDS 1 MAX") ' Remove any BOUNDS restrictions
lBnd = Get_LBound
rBnd = Get_Rbound
SPF_Debug("Should be 1 0 now: "+lBnd+" "+rBnd)
SPF_DEBUG("------")
IF lBnd <> 1 OR rBnd <> 0 THEN _ ' Reset the original BOUNDS values
SPF_Cmd("BOUNDS "+lBnd+" "+rBnd)
SPF_Debug("Should equal Captured: "+lBnd+" "+rBnd)
HALT