Skip to content

Item-specific styling #200

@jtreminio

Description

@jtreminio

Currently all items are on the same vertical level:

    Example Title                                                                              
    ================================================================================================  
                                                                                                      
    Static Item #1                                                                                    
    ○ Item 1                                                                                          
    ○ Item 2                                                                                          
    ○ Item 3                                                                                          
    ○ Item 4                                                                                          
    Static Item #2                                                                                    
    ○ Item 1                                                                                          
    ○ Item 2                                                                                          
    ○ Item 3                                                                                          
    ○ Item 4                                                                                          
    Static Item #3                                                                                    
    [○] Item 1                      [○] Item 2                      [○] Item 3                        
                                                                                                      
    ------------------------------------------------------------------------------------------------  
    ● Exit                                                                                            

Using line breaks makes it a little easier to separate elements:

    Example Title                                                                              
    ================================================================================================  
                                                                                                      
    Static Item #1                                                                                    
    ○ Item 1                                                                                          
    ○ Item 2                                                                                          
    ○ Item 3                                                                                          
    ○ Item 4                                                                                          

    Static Item #2                                                                                    
    ○ Item 1                                                                                          
    ○ Item 2                                                                                          
    ○ Item 3                                                                                          
    ○ Item 4                                                                                          

    Static Item #3                                                                                    
    [○] Item 1                      [○] Item 2                      [○] Item 3                        
                                                                                                      
    ------------------------------------------------------------------------------------------------  
    ● Exit                                                                                            

This works fine but could be better. What do you think about an "itemIndent" vlaue in the MenuStyle that is applied only to SelectItem, RadioItem and CheckableItem?

    Example Title                                                                                     
    ================================================================================================  
                                                                                                      
    Static Item #1                                                                                    
       ○ Item 1                                                                                       
       ○ Item 2                                                                                       
       ○ Item 3                                                                                       
       ○ Item 4                                                                                       
    Static Item #2                                                                                    
       ○ Item 1                                                                                       
       ○ Item 2                                                                                       
       ○ Item 3                                                                                       
       ● Item 4                                                                                       
    Static Item #3                                                                                    
       [○] Item 1                   [○] Item 2                      [○] Item 3                        
                                                                                                      
    ------------------------------------------------------------------------------------------------  
    ○ Exit                                                                                            

The indentation helps visually separate what is an actionable item and what is mostly text description:

Peek 2019-12-17 21-39

Let me know if this is something that would be interesting. I've got it implemented but needs some testing for the StringUtil::wordwrap() function that calculates terminal width and breaks up lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions