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

feat(menu.draw): columns can be function #1049

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Parsifa1
Copy link
Contributor

@Parsifa1 Parsifa1 commented Jan 21, 2025

#820 may be closed

what i did:

  • menu.draw.columns can receive an function with ctx args;
  • draw.components._.width.max can receive an function with ctx args (this is needed for set seperate max_width for cmdline);

example

menu.draw.columns = function(ctx)
    if ctx.mode == "cmdline" then
        return { { "kind_icon" }, { "label" } }
    else
        return { { "kind_icon" }, { "label", "label_description", gap = 1 } }
    end
end

draw.components.label.width.max = function(ctx)
    return ctx.mode == "cmdline" and 20 or 60
end

need to do:

  • docs
  • config check should be more detailed.

feel free to change anything to what you want :)

@Parsifa1 Parsifa1 force-pushed the main branch 2 times, most recently from ef2bf66 to 9b68a21 Compare January 21, 2025 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant