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

Feature request: Word wrapping in buffers

Open
#1,648 0 comments 2 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

Hi,

I need to display a longer piece of text in my full screen program. According to the docstrings FormattedTextControl/Label is only suitable for shorter strings, so I went with Buffer/BufferControl, specifically the approach in #711 (for formatted buffer).

However neither that, nor the basic underlying buffer seems to support word wrapping (wrapping on space). Instead they wrap in the middle of words.

Either I'm missing something (in which case please inform me), or this is a feature request to support basic word wrapping.

I'm not asking for hyphenation, but it would be a nice bonus if this was implemented as a wrapping-policy. Then the user could provide a fancy version specific to their natural language of choice.

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 reading the docstrings for Buffer, BufferControl, FormattedTextControl, and Label, then compare the formatted-buffer approach referenced in #711 with the current wrapping behavior. Confirm where Buffer and BufferControl split lines, and define completion as wrapping at spaces with a user-selectable wrapping policy.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.