Skip to content

Conversation

sbs44
Copy link

@sbs44 sbs44 commented Sep 13, 2025

Description

Fixes #654 - Prevent unnecessary pagination prompt when using colored group descriptions in small terminals

Root Cause

Zsh mistakenly treats strings that are exactly $COLUMNS wide as not fitting on one line, causing the autocomplete system to miscalculate the number of lines needed and trigger the pagination prompt unnecessarily.

Solution

  • Centralize display width calculation using _display_width_=$(( COLUMNS - 1)) to avoid code duplication
  • Apply consistent width trimming to heading strings to prevent line wrapping
  • Preserve the existing logic for parsing and applying heading options (-X/-x)

This ensures that colored group descriptions don't trigger the "Do you wish to see all possibilities?" prompt when they shouldn't.

Testing

Tested with various terminal sizes and with/without colored group descriptions.

Before (unwanted prompt appears):

before

After (no prompt, completions display correctly):

after
  • There is no other PR (open or closed) similar to yours. If there is, please first discuss over there.
  • Your new code in each file follows the same style as the existing code in that file.
  • Each commit messages follows the Seven Rules of a Great Commit Message.
  • Each commit message includes Fixes #<bug> or Resolves #<issue> in its body (not subject, that is, the
    first line) for each issue it resolves (if any).
  • You have squashed any redundant or insignificant commits.

… colored group descriptions

- Move display width calculation earlier and reuse it consistently
- Parse heading options (-X/-x) once and preserve them through the function
- Trim heading strings to terminal width to prevent line wrapping
- This prevents the pagination prompt from being incorrectly triggered
  when using colored group descriptions in small terminals
@sbs44 sbs44 closed this by deleting the head repository Sep 23, 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.

"Do you wish to see all Possibilities?" triggered with group description colors in small terminals
1 participant