Skip to content

Commit

Permalink
✨ keep prompt at bottom of screen
Browse files Browse the repository at this point in the history
by using the prompt toolkit patch stdout we can keep the prompt at the bottom
of the screen even if other threads print to stdout
  • Loading branch information
ianhomer committed Oct 1, 2024
1 parent 89188ad commit 551512f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ask/ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import threading
from typing import Optional

from prompt_toolkit.patch_stdout import patch_stdout

from .config import default_parse_args, load_config
from .handler import InputHandler
from .input import AbstractInputter, InputInterrupt, PromptInputter
Expand Down Expand Up @@ -86,7 +88,8 @@ def process(user_input) -> Optional[str]:

while service.available:
try:
user_input = inputter.get_input()
with patch_stdout():
user_input = inputter.get_input()
except InputInterrupt:
quit(renderer)
break
Expand Down

0 comments on commit 551512f

Please sign in to comment.