Commit 68f2910
committed
Fix UI flicker issue by updating prompt before alert message.
While testing the new background alerter thread, I noticed a slight UI flicker issue could occur when both msg and prompt are provided in an alert:
- prompt_toolkit's patch_stdout() intercepts the printed message and immediately forces a redraw of the prompt so the message displays cleanly above it.
- In the branch's implementation, self.prompt was being updated after printing the message. This caused patch_stdout to redraw the old prompt, and then get_app().invalidate() would immediately redraw the new prompt, causing a flicker.
I've updated cmd2/cmd2.py so that self.prompt is updated before the message is printed. This allows patch_stdout to natively draw the new prompt immediately, eliminating the flicker:1 parent dd68571 commit 68f2910
2 files changed
+11
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3367 | 3367 | | |
3368 | 3368 | | |
3369 | 3369 | | |
3370 | | - | |
3371 | | - | |
3372 | | - | |
3373 | | - | |
3374 | | - | |
3375 | 3370 | | |
| 3371 | + | |
3376 | 3372 | | |
3377 | 3373 | | |
3378 | 3374 | | |
3379 | 3375 | | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
| 3379 | + | |
| 3380 | + | |
| 3381 | + | |
3380 | 3382 | | |
3381 | | - | |
3382 | | - | |
3383 | | - | |
| 3383 | + | |
| 3384 | + | |
| 3385 | + | |
3384 | 3386 | | |
3385 | 3387 | | |
3386 | 3388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
0 commit comments