Significance of a negative value for a row or column
In the String descriptor and in several other descriptors and actions,
a negative value for a row or column of the session window indicates
an offset from the last row or the last column of the session window.
The macro runtime calculates the row or column location as follows:
actual row = (number of rows in text area) + 1 + (negative row offset)
actual column = (number of columns in text area) + 1 + (negative column offset)
For
example, if the session window has 24 rows of text then a row coordinate
of -1 indicates an actual row coordinate of 24 (calculated as: 24
+ 1 - 1). Similarly if the session window has 80 columns of text then
a column coordinate of -1 indicates an actual column coordinate of
80 (calculated as 80 + 1 - 1).The row calculation above ignores the OIA row. For example, if the session window is 25 rows high, it has only 24 rows of text.
The advantage of this convention is that if you want to specify a rectangle at the bottom of the session window, then this calculation gives the right result whether the session window has 25, 43, or 50 rows. Similarly, if you want to specify a rectangle at the right side of the session window, then this calculation gives the right result whether the session window has 80 columns or 132 columns.
The following tables shows the results for a few calculations:
Negative value for row: | Actual value in session window with 24 columns of text (OIA row is ignored): | Actual value in session window with 42 columns of text (OIA row is ignored): | Actual value in session window with 49 columns of text (OIA row is ignored): |
-1 | 24 | 42 | 49 |
-2 | 23 | 41 | 48 |
-3 | 22 | 40 | 47 |
Negative value for column: | Actual value in session window with 80 columns: | Actual value in session window with 132 columns: |
---|---|---|
-1 | 80 | 132 |
-2 | 79 | 131 |
-3 | 78 | 130 |
Whether you make use of this convention or not, you should at least remember that a rectangular area with coordinates of (1,1) and (-1,-1) means the entire text area of the session window.