charmbracelet / huh

Build terminal forms and prompts 🤷🏻‍♀️
MIT License
4.18k stars 113 forks source link

Confirm button indent at wrong position #367

Open Chissanu opened 1 month ago

Chissanu commented 1 month ago

Describe the bug When creating a confirm button that has long description, the button would shift to right depends on the length of description

To Reproduce Steps to reproduce the behavior:

  1. Create a confirmation form
  2. Create a very long desciption

Expected behavior The confirm buttons are at the left side

Screenshots If applicable, add screenshots to help explain your problem. image-1.png

Desktop (please complete the following information):

eduardoagarcia commented 1 month ago

I noticed the same thing, and it looks like it's hard-coded to be centered: https://github.com/charmbracelet/huh/blob/main/field_confirm.go#L271

Seems like adding a property to override the alignment via a new function called something like withAlginment() would be fairly easy update to the package? 🙏 🙏

Hector-Work commented 2 weeks ago

This is also happening when the title is long, even if there is no description set.

Chissanu commented 2 weeks ago

The work around I did was to put title and description for NewConfirm into NewNote and have NewConfirm to only store the values with no title and description.