Skip to content

zsh completion descriptions, ANSI escapes and multiple lines #220

@dbuenzli

Description

@dbuenzli

Since 621983e cmdliner's doclang is handled in the doc strings used for completion descriptions. We found it natural to use ANSI escapes in the doc string renders and this is specified in the protocol.

However this works only some of the time. Here are a few problems:

  1. If the doc string is long. It is arbitrarily cut to fit the terminal. First this is not nice from a usability perspective, who wants to read truncated doc strings ? Second it may cut out an ANSI mode reset, which means bold/italic glitches in the list of completions.
  2. It seems that when the zsh completion system collapses short and long option it escapes the escapes.
    E.g.:
    > b0 -␉
    --b0-dir           -- Use ^[[04mDIR^[[m for the b0 directory.                                                             
    --b0-file          -- Use ^[[04mPATH^[[m as the b0 file.                                                                  
    --build        -b  -- Build only. Do not execute the action.   
    
    But (with DIR, PATH variables correctly ANSI underlined):
    > b0 --␉
    --b0-dir       -- Use DIR for the b0 directory.
    --b0-file      -- Use PATH as the b0 file.
    

Regarding 1. I wonder if there is a way to be able to specify multi-line completion descriptions in zsh. Regarding 2. I wonder if there is a way to indicate to zsh. Answering these questions likely involves going to look at their code as trying to get anything meaningful from their docs is a challenge.

Another option of course is to strip the escapes from the doc strings in the completion script – I rather keep them in the protocol, perhaps one day we'll get less duck taped completion systems.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions