pudb
pudb copied to clipboard
Reloading modules messes up the UI
To reproduce:
First case:
- Load up a file
- Open the module menu(m)
- Choose file/module that you're running
- Choose "OK"
Second case(eligible after first):
- Open the module menu(m)
- Choose file/module that you're running
- Choose "Reload"
Shown in following recording:
(pudb) ➜ pudb-373 python -V
Python 3.7.2
(pudb) ➜ pudb-373 pip freeze
appdirs==1.4.3
attrs==19.3.0
black==19.10b0
certifi==2019.11.28
chardet==3.0.4
Click==7.0
codecov==2.0.5
coverage==4.3.4
idna==2.9
importlib-metadata==1.5.0
jedi==0.15.2
numpy==1.18.1
parso==0.6.1
pathspec==0.7.0
pbr==2.0.0
pluggy==0.13.1
-e git+http://git.tiker.net/trees/pudb.git@3f041b88b7cf623a22d50e702663b1e3e8076f3c#egg=pudb
py==1.4.33
Pygments==2.2.0
pyls-black==0.4.4
pyspark==2.4.4
pytest==3.0.7
pytest-cov==2.4.0
pytest-mock==1.10.0
python-jsonrpc-server==0.3.4
python-language-server==0.31.8
regex==2020.2.20
requests==2.23.0
six==1.10.0
toml==0.10.0
typed-ast==1.4.1
ujson==1.35
urllib3==1.25.8
urwid==1.3.1
zipp==3.0.0
Redrawing the screen after pick_module
and call_with_ui
appears to fix this issue. Result on following recording.
Do you think that forcing redrawing the screen is a good enough fix here? I can attach it as a PR, if yes.
I have noticed that the issue happens only when you try to reload your own file/module. That may point to another, cleaner solution, but I don't have it in mind yet.
I think the better option would be to acknowledge that reloading a module can execute arbitrary code (and produce output) and switch away from the UI.
This would have the added advantage that that output is not lost.