+ # cursor can be just off the right side, but we draw it on the last column in that case
+ if term.x >= term.width
+ cursor_x = term.width - 1
+ else
+ cursor_x = term.x
+ # invert the cursor TODO: make it blink
+ if term.cursor_visible
+ term.attributes[term.y][cursor_x] ^= 0x080000