Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: user control over button padding in confirm view #1089

Open
1 task done
maxenglander opened this issue Mar 31, 2025 · 0 comments · May be fixed by #1090
Open
1 task done

feature: user control over button padding in confirm view #1089

maxenglander opened this issue Mar 31, 2025 · 0 comments · May be fixed by #1090
Labels
enhancement New feature or request

Comments

@maxenglander
Copy link

Did you check the docs?

  • I have read all the noice.nvim docs

Is your feature request related to a problem? Please describe.

I would like to customize the confirm view to be:

  • Anchored on the lower right of the screen.
  • Wrap long lines.
  • Left-align text.

I can accomplish this from the existing options, which is great!

      opts.views.confirm = {
        backend = "popup",
        relative = "editor",
        position = {
          col = "100%",
          row = -2,
        },
        size = {
          height = "auto",
          width = 40,
        },
        border = {
          style = "double",
          padding = { 0, 1 },
          text = {
            top = " Confirm ",
            top_align = "left",
          },
        },
        win_options = {
          wrap = true,
        },
      }

The problem I'm running into is that the buttons get a little bit janky when win_options.wrap is true. wrap is necessary to prevent very long confirm messages from going out of view.

Image

I believe the issue I'm running into is that the confirm formatter unconditionally sets padding on the button line.

local padding = math.floor((message:width() - message:last_line():width()) / 2)
table.insert(message:last_line()._texts, 1, NoiceText((" "):rep(padding)))

Describe the solution you'd like

Maybe there's a way around this with Noice already. Is there an option to define and use a custom formatter? I couldn't see anything like that but if there is a way to do this I'll use that of course.

Maybe there's some Neovim hackery I can manage with win_options or buf_options? I'd be happy with that too.

If neither of those are possible, I'd be happy with any new configuration optional that lets me define a custom formatter, conditionally influence or disable button padding in the existing formatter, or anything other idea that let's me get the look I'm going for.

Describe alternatives you've considered

I've tried routing all confirm-kind messages to the split view. That actually works as far as button alignment goes but is missing the Confirm title and nice button rendering we get from the confirm formatter.

Image

Additional context

Why do I worry about long messages going off the view? I'm using an AI tool that runs local commands. Some of these commands can get pretty long, and with each command it runs it will ask Confirm you want to run: <command>.

@maxenglander maxenglander added the enhancement New feature or request label Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant