-
Notifications
You must be signed in to change notification settings - Fork 747
Open
Description
Consider the finalterm-shell-integration.py example. Make the following change to it
--- a/examples/finalterm-shell-integration.py
+++ b/examples/finalterm-shell-integration.py
@@ -8,7 +8,7 @@ from __future__ import unicode_literals
from prompt_toolkit import prompt
from prompt_toolkit.token import Token
import sys
-
+import time
BEFORE_PROMPT = '\033]133;A\a'
AFTER_PROMPT = '\033]133;B\a'
@@ -29,8 +29,9 @@ def get_prompt_tokens(cli):
if __name__ == '__main__':
- answer = prompt(get_prompt_tokens=get_prompt_tokens)
-
- sys.stdout.write(BEFORE_OUTPUT)
- print('You said: %s' % answer)
- sys.stdout.write(AFTER_OUTPUT.format(command_status=0))
+ while True:
+ answer = prompt(get_prompt_tokens=get_prompt_tokens)
+ time.sleep(2)
+ sys.stdout.write(BEFORE_OUTPUT)
+ print('You said: %s' % answer)
+ sys.stdout.write(AFTER_OUTPUT.format(command_status=0))
Then run the script and type
hello
hello
hello
hello
several times without waiting for the prompt. Eventually, you'll see something like this:
Say something: # hello
^[[45;1Rello
You said: hello
The ^[[45;1R
is printed before the output. I don't understand what that escape code is exactly. It doesn't look like one of the FinalTerm codes. I believe the final term codes themselves are being printed correctly, as the "select output" feature in iTerm2 works correctly (it selects everything, including the ^[[45;1R
).
Metadata
Metadata
Assignees
Labels
No labels