Skip to content

Rename Stepper builder methods #697

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

Merged
merged 3 commits into from
Mar 19, 2020
Merged

Rename Stepper builder methods #697

merged 3 commits into from
Mar 19, 2020

Conversation

luleyleo
Copy link
Collaborator

This fuses Stepper::min and Stepper::max to Stepper::with_range and renames Stepper::step as well as Stepper::wrap to Stepper::with_step and Stepper::with_wrap respectively.

Closes #684

@cmyr
Copy link
Member

cmyr commented Mar 18, 2020

Looks good! with_wrap stands out as feeling a little weird, but 🤷‍♂

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks functionally equivalent.

@cmyr
Copy link
Member

cmyr commented Mar 18, 2020

To bikeshed: how do we feel about with_wrapping or with_wraparound?

@luleyleo
Copy link
Collaborator Author

with_wraparound seems good to me, should I change it to that or wait a little longer?

@xStrom
Copy link
Member

xStrom commented Mar 18, 2020

You can just change it to with_wraparound now.

Not related to your work per se, but I was looking at this Stepper code and the wraparound doesn't even work. With wraparound set the Stepper can only have its value as the min or max.

Looking at the PR (#308) it seems that initially the code was maybe more functional.

if (*data - old_data).abs() > EPSILON {
    // callback
    (self.value_changed)(ctx, data, env);
} else if self.wrap {

However in a commit titled Adress stepper review feedback that was removed and changed to the current non-working code. Also that change doesn't seem to be based on any actual reviewer feedback, so I guess some sort of mistake.

Feel free to fix the wraparound code here, or if you'd rather not that's fine too and we'll just merge the method renames only.

@luleyleo
Copy link
Collaborator Author

For now I've just renamed with_wrap to with_wraparound

The functionality in itself is indeed completely broken, I think I will deal with that in a separate PR after I'm done with #632

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good! I'm going to make a few little doc fixes but happy to merge.

@cmyr cmyr merged commit ff7ed5c into linebender:master Mar 19, 2020
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.

replace Stepper::min/max with 'with_range'
3 participants