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(block): added FillerTemplate to block #5953

Conversation

dusktreader
Copy link
Contributor

Prerequisites

  • I have read and understood the [contributing guide][CONTRIBUTING.md].
  • The commit message follows the [conventional commits][cc] guidelines.
  • Tests for the changes have been added (for bug fixes / features).
  • Docs have been added/updated (for bug fixes / features).

Description

This change introduces a new block configuration called "FillerTemplate". This allows the user to specify a template for filler so that different behavior can be configured when the block is handling an overflow.

An example configuration might be:

- type: prompt
  alignment: right
  filler_template: "{{ if .Overflow }} {{ else }}<#3d59a1,transparent>━</>{{ end }}"
  overflow: break

This would draw filler text ("-") when there is no overflow and empty space when there is an overflow.

@dusktreader
Copy link
Contributor Author

Example renderings:

Given config:

- type: prompt
  alignment: right
  filler_template: "{{ if .Overflow }} {{ else }}<#3d59a1,transparent>━</>{{ end }}"
  overflow: break

No Overflow:
image

With Overflow:
image

@JanDeDobbeleer
Copy link
Owner

@dusktreader you could also enable filler to be template-able, it doesn't need an additional property. I'll refactor this a bit so you can see how that would work.

@JanDeDobbeleer JanDeDobbeleer force-pushed the dusktreader/feat-block-fill-template branch from 5bcb31d to 4bb91d7 Compare November 28, 2024 09:04
This change allows the user to specify a template for filler so that
different behavior can be configured when the block is handling an
overflow.

An example configuration might be:

```yaml
- type: prompt
  alignment: right
  filler: "{{ if .Overflow }} {{ else }}<#3d59a1,transparent>━</>{{ end }}"
  overflow: break
```

This would draw filler text ("-") when there is no overflow and empty
space when there is an overflow.
@JanDeDobbeleer JanDeDobbeleer force-pushed the dusktreader/feat-block-fill-template branch from 4bb91d7 to 3ff2340 Compare November 28, 2024 15:18
@JanDeDobbeleer JanDeDobbeleer changed the base branch from main to next November 28, 2024 18:40
@JanDeDobbeleer JanDeDobbeleer merged commit da5b612 into JanDeDobbeleer:next Nov 28, 2024
10 checks passed
@JanDeDobbeleer
Copy link
Owner

@all-contributors please add @dusktreader for code,doc

This is pure magic 🪄! @holopin-bot @dusktreader wizard

Copy link

holopin-bot bot commented Nov 28, 2024

Congratulations @dusktreader, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/cm41o0dfj129710clbf0txhvxg

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

Copy link
Contributor

@JanDeDobbeleer

I've put up a pull request to add @dusktreader! 🎉

@dusktreader
Copy link
Contributor Author

Thanks! Your refactor is definitely a better approach. I'm excited for the next release!

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