Section 3.5.4 of the Glk specification document describes “text grid windows”, which store an “output cursor position”. Consider the following 16x4 text grid window, where the cursor (represented by _
) is at (13, 1):
+----------------+
|This is a text w|
|indow... _ |
| |
| |
+----------------+
The window is resized to 8x4:
+--------+
|This is |
|indow...| _ <- (13, 1) is now out of bounds!
| |
| |
+--------+
What happens to the cursor? The specification doesn’t seem to say, and I can come up with a few different plausible ideas:
- It moves to (0, 2), the beginning of the next line
- It moves to (5, 2), which is where it would be if it started at (0, 1) and 13 characters were printed
- It moves to (5, 3), which is where it would be if it started at (0, 0) and 16+13=29 characters were printed
- It is reset to (0, 0)
- It goes “off the screen”, silencing all further output until it’s put back in bounds with a
glk_window_move_cursor()
orglk_window_clear()
call