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

add :unindent property #804

Merged
merged 1 commit into from
Feb 17, 2024
Merged

Conversation

nativerv
Copy link
Contributor

Please follow this template, if applicable.

Description

Adds a property to control label unindenting/stripping leading spaces (default is true). This partly addresses #647 (although it is about using raw strings as widgets, but with this you can use label to work around it).

Usage

Example of a custom raw-label widget that does not strip leading spaces:

(defwidget raw-label [text ?class ?truncate-left ?show-truncated]
  (label
    :unindent false
    :text "${text}"
    :class {class}
    :truncate-left {truncate-left ?: false}
    :show-truncated {show-truncated ?: true}
  )
)

Showcase

Screenshot of my bar:

image

The rightmost elements use the above raw-label widget to display left-padded strings that i get from my scripts correctly, so the bar does not flick around on updates.

Checklist

Please make sure you can check all the boxes that apply to this PR.

  • All widgets I've added are correctly documented.
  • I added my changes to CHANGELOG.md, if appropriate.
  • The documentation in the docs/content/main directory has been adjusted to reflect my changes.
  • I used cargo fmt to automatically format all code before committing

@elkowar elkowar merged commit 607f441 into elkowar:master Feb 17, 2024
1 check passed
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.

2 participants