Skip to content
This repository has been archived by the owner on Sep 19, 2022. It is now read-only.

Add "trim" attribute to "add" command #49

Closed
FeodorFitsner opened this issue Feb 16, 2021 · 0 comments
Closed

Add "trim" attribute to "add" command #49

FeodorFitsner opened this issue Feb 16, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@FeodorFitsner
Copy link
Contributor

FeodorFitsner commented Feb 16, 2021

trim allows to specify the maximum number of children to leave after adding new child controls.
Negative trim value trims items from the end; positive - from the start.

For example, if we have the following controls tree:

page
  stack id=lines
    text value='Line 1'
    text value='Line 2'
    text value='Line 3'

Running add to=lines trim=3 text value='Line 4' will result into:

page
  stack id=lines
    text value='Line 2'
    text value='Line 3'
    text value='Line 4'

so controls were trimmed from the start to have a total number of children at 3.

On the other hand, running add to=lines at=0 trim=-3 text value='Line 4' will result into:

page
  stack id=lines
    text value='Line 4'
    text value='Line 1'
    text value='Line 2'

so new control was insterted to lines stack at position 0 and controls were trimmed from the end to have a total number of children at 3.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant