Skip to content

Conversation

@patrick91
Copy link
Owner

@patrick91 patrick91 commented Dec 17, 2025

Summary

  • Fixes wrapping issue where inline menu options (like "Yes" and "No" in confirm dialogs) were being displayed on separate lines
  • Replaces tab character separator with two spaces for inline menus

Problem

When using inline menus (e.g., app.confirm()), the options were being rendered with tab characters as separators. Tab characters expand to the next tab stop (typically 8 characters), which caused the menu to be too wide for the fixed-width table column layout used by TaggedStyle. This resulted in the "No" option wrapping to a new line.

Solution

Changed the separator for inline menus from "\t" to " " (two spaces) in src/rich_toolkit/styles/base.py:302. This provides consistent, predictable spacing that fits within the column layout without wrapping.

Testing

"""Basic usage demo for VHS recording."""

from rich_toolkit import RichToolkit
from rich_toolkit.styles.tagged import TaggedStyle

with RichToolkit(style=TaggedStyle()) as app:
    app.print_title("Launch sequence initiated.", tag="astro")
    name = app.input("What is your name?", tag="name")
    project_dir = app.input(
        "Where should we create your project?", tag="dir", default="./my-app"
    )
    if app.confirm("Continue?", tag="confirm"):
        app.print(f"Creating project for {name} in {project_dir}...")

    app.ask(
        label="Example",
        options=[
            {"value": True, "name": "Yes longer"},
            {"value": False, "name": "No longer"},
        ],
        inline=True,
    )

Implements a custom homepage component that reuses the compound components from @usecross/docs, allowing for future customization while maintaining the default layout structure.
Replace tab character separator with two spaces in inline menus to prevent
unpredictable wrapping when rendered in fixed-width table columns. Tab
characters expand to the next tab stop (typically 8 characters), which
can cause menu options to wrap to new lines in narrow layouts.
@github-actions
Copy link

Hi, thanks for contributing to this project!

We noticed that this PR is missing a RELEASE.md file. We use that to automatically do releases here on GitHub and, most importantly, to PyPI!

So as soon as this PR is merged, a release will be made 🚀.

Here's an example of RELEASE.md:

---
release type: patch
---

Description of the changes, ideally with some examples, if adding a new feature.

Release type can be one of patch, minor or major. We use [semver](https://semver.org/), so make sure to pick the appropriate type. If in doubt feel free to ask :)

@patrick91 patrick91 closed this Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants