Description
I've looked for it, but there doesn't seem to be a way to do this easily currently. That is, having the up and down keys behave like a lot of text editors moving the cursor in an imaginary vertical line across the prompt, only straying from that when shorter rows are encountered and at the beginning/end of the document. Right now it seems that they go to the same index on the previous/next internal line, and not the "visual row".
My own hacky implementation is in this file:
https://github.com/MikkoMMM/Clover-Edition/blob/master/inline_editor.py
And even then I encountered problems where rarely but seemingly randomly the cursor would go in the slightly wrong column. That's why for example pressing left and right also manually invoke update_stored_pos in addition to the textf.buffer.on_cursor_position_changed event. And since I wasn't sure about the source of the problem, I also reimplemented the textf.document.cursor_position_col and textf.document.cursor_position_row functions.
So, it's a very messy solution and I'm not sure if it's working perfectly even still. It would be so much better if Python Prompt Toolkit could just offer the option to do it itself, and properly.