-
Couldn't load subscription status.
- Fork 750
Description
I have been using prompt-toolkit to develop a console for the R language: https://github.com/randy3k/Rice
Recently, I was told that the cursor position is automatically reset when a user tries to scroll screen via a terminal emulator: randy3k/radian#31
The following is a screenshot of the demonstration of the issue

The console was running on a terminal emulator of Sublime Text which uses pyte behind the scene. You can see that the cursor position is reset when I tried to scroll up the screen.
After some analyses, I have determined that the problematic code is related to a recent update
https://github.com/jonathanslenders/python-prompt-toolkit/blob/2.0/prompt_toolkit/key_binding/key_processor.py#L309
If that line is commented, the scrolling works as expected and the cursor position does not reset.

My guess is that prompt-toolkit somehow messes up the scroll up and down sequences <ESC>D and <ESC>M.