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

Dressing does not respect multi line prompts #89

Closed
miversen33 opened this issue Feb 26, 2023 · 3 comments
Closed

Dressing does not respect multi line prompts #89

miversen33 opened this issue Feb 26, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@miversen33
Copy link

miversen33 commented Feb 26, 2023

Describe the bug
When using dressing in place of vim.ui.input, if you have your "prompt" object be multiple lines, dressing forces everything onto one line and truncates its length.

System information

  • OS: Linux
  • Neovim version: NVIM v0.9.0-dev-506+g090048bec
  • Is this related to a specific vim.ui.select backend? If so, which one? I don't think so?
  • Dressing config:
-- Paste your call to require("dressing").setup(...) in here
require("dressing").setup()

To Reproduce
Steps to reproduce the behavior:

  1. See below min file

If possible, provide a minimal file that will trigger the issue (see
tests/manual
for examples of short ways to call vim.ui.*):

vim.ui.input({
    prompt = "Do the thing\n 1) Yes\n 2) Maybe\n 3) No\n\nPlease select all that apply",
    default = "*"
}, function(choice)
        print(choice)
    end
)

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot without Dressing
Screenshot without Dressing

Screenshot with Dressing
Screenshot with Dressing

Additional context
While this maybe addressable with configuration, IMO this should not be something that needs to be configured to rectify. Dressing is (usually) a plugin that is used by other plugins, not by end users. Which IMO means that it would be unfair to expect users to fix this issue via configuring a dependent plugin of a plugin they are using.

I do note that :h dressing-format seems to call out a way to correct this, but that is then reliant on plugin authors to properly configure dressing to properly handle newlines in an "expected" format.

I suppose the long short, I would expect that newlines be handled as newlines when added to the title of either the select or input functions, as they are handled in an expected manner when using standard neovim ui elements.

@miversen33 miversen33 added the bug Something isn't working label Feb 26, 2023
@stevearc
Copy link
Owner

stevearc commented Mar 6, 2023

Hmmm...this is interesting because it is technically something that is supported by the default vim.ui.input function, but empirically not many people need multi-line prompts for vim.ui.input. Even the use case you outline is more suited for something like the possibly-upcoming vim.ui.confirm (though for multi-select, that would require the still-in-discussion vim.ui.select_many).

To display this properly, we would have to have a significantly different UI. The current implementation relies on being able to put the entire prompt into the title on a single line. For this to work properly, we would probably have to create two floating windows: one to display the multiline prompt, and one below it for the actual input.

Given the relative rarity of this and my lack of available time, I'm going to sit on this. I'll review PRs, but can't make any promises about working on this myself.

@emmanueltouzery

This comment was marked as off-topic.

@stevearc
Copy link
Owner

Support for multiline prompt strings has been added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants