prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Cannot embed vt100 sequences in a prompt which send hidden information to the terminal

Open
#1,309 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

I using the emacs-libvterm terminal emulator and run a prompt-toolkit based REPL inside it.

For interaction with the terminal "host" I need to issue special vt100 sequences at the end of each prompt-toolkit prompt. I try to issue these sequences lkie this:

vtescape = '\033]{}\033\\&'
infostr = '51;A{}@{}:{}'.format(whoami, hostname, pwd)  # whoami, hostname and pwd are strings variables
vtinfo = vtescape.format(infostr)
text = session.prompt('> '+vtinfo)

However prompt_toolkit seems to filter out the escape bits of it, so that the information is not hidden as the terminal requires it.

How can I send exactly these escape sequences at the end of each prompt?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the session.prompt() call and trace how prompt-toolkit processes the prompt text and terminal escape sequences. Reproduce the behavior with the provided emacs-libvterm example, then verify that the required sequences reach the terminal unchanged while remaining hidden from the visible prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.