The text_input case is easier, so let's do that first. Just forget about the state of screen_top1 and just ensure the cursor is in view.
Now the remaining case is more challenging. We might need to scroll upwards sometimes using bring_cursor_of_cursor_pane_in_view.
GMOFM2TFVNOYYMKAMZNRGECLNZESBUBYOHQ24TXL2VWA3XMKQOIAC