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

Let the multiline filter have access to the prompt text

Open
#1,132 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Right now there's no simple way to decide whether Enter should accept or open a new line based on the content of the text.

It seems like a very useful feature in general. For example, to write something like ptpython (that doesn't seem to use this feature)

Please correct me if I'm wrong about that.

Also, right now is_true(self.multiline) is called about 10 times for each character pressed. You really only need to call it once.

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 by locating the multiline filter and the code path that handles Enter, then trace how the current is_true(self.multiline) checks are performed. Determine how prompt text could be exposed to that decision and where the repeated check can be consolidated. Done means the filter can decide based on the current text and the redundant per-character evaluations are removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.