Post by Stefan on Nov 30, 2022 10:31:25 GMT -5
George,
We're playing "Is you is, or is you ain't a bug?"
There's a discrepency between the values returned by the Get_CSR_xxxx and Get_FIND_xxxx functions.
They do not necessarily agree.
Following a successful FIND 'ABC' command, the Get_CSR_xxxx and Get_FIND_xxxx values agree.
However, the GET_CSR_xxxx values are incorrect following a command such as FIND ALL "ABC" when multiple occurences of 'ABC' are found.
In this instance, the Get_CSR_xxxx values reflect the FIRST occurence of the 'ABC' string found, and the Get_FIND_xxxx values reflect the LAST occurrence of 'ABC' found.
Question is - intentional or bug?
I believe it is a bug, because
(a) I can see little use in a macro for knowing the first and last ocurrence. If required this can easily be established with a FIND FIRST followed by a FIND LAST command.
(b) It causes issues if the SUB or FUNCTION obtaining a cursor position and has no way of determining how the cursor came to be placed there.
(c) It is contrary to the user experience OUTSIDE a macro environment. Users know the cursor can be in only ONE place at a time. How it got there is not relevant to the co-ordinates.
(d) The Documentation describes
Get_CSR_LPtr as "Returns the line pointer of the line containing the cursor...."
Get_CSR_Col as "Returns the column number of the current cursor line...." (strange phrasing as a 'line' doesn't have a column. Maybe 'of' should be 'in' or 'along', but anyway)
There is no mention that this is may not be true in certain circumstances.
How to fix it?
Should Get_CSR_xxxx be changed after commands that include the ALL keyword to agree with the values of the Get_FIND_xxxx functions, or vica versa?
I think it should be vica versa.
Outside a macro, after a successful FIND ALL command, the cursor is placed at the co-ordinates where the FIRST occurence of the search-string was found.
If required, the display is repositioned so the line with the FIRST occurence is at/near the top of the page.
This also occurs if said FIND command is issued within a macro and the macro terminates after the FIND command.
In my view, this lends creedence to the argument that the Get_CSR_xxxx values are actually consistent with events.
So after every FIND ALL command, the Get_FIND_xxxx values should reflect the FIRST occurence found, instead of the LAST occurence.