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(textinput): Yank function that returns and resets the content #474

Closed
wants to merge 1 commit into from

Conversation

david-d-h
Copy link

Introduce a new Yank method on the textinput Model that first grabs the content, then resets the text input and returns the content.

@maaslalani
Copy link
Contributor

maaslalani commented Feb 6, 2024

Hey @daviddenhaan, thank you for the contribution. Personally, I don't think this method is necessary since:

  1. It increases the API surface area
  2. it is fairly trivial to Reset the textinput after getting the value
  3. I don't think Yank is the correct naming since it is ambiguous as in Vim yanking does not reset the text (a more appropriate name could be GetValueAndReset but then it's easier (and more clear) to: m.Value() and m.Reset().

What do you think? Happy to take feedback on why this is necessary / better for users.

That being said, thank you so much for the PR! We really appreciate it ❤️

@david-d-h
Copy link
Author

Hi @maaslalani! Thanks for your response and feedback.

I don't think this addition to the API is a necessity, or even adds that much in the first place. I just thought it would be nice to simplify the action of "cutting" the content from the text input as it's quite common for things like chat applications and the likes.

Also, I totally agree on the naming being kind of confusing, I just couldn't come up with anything better that wasn't something equivalent to just calling two methods as you mentioned above 😓 I'd be happy to change it to anything else.

As for the API surface area, unless I misunderstood this point, I don't think it has to be an issue because the method itself only uses other methods that are already established (those being Reset and Value).

I'm happy to take any feedback you might have, and I understand if this change does not entirely align with bubbles for the reasons you mentioned in which case the merge request can be closed.

@maaslalani
Copy link
Contributor

Hey @daviddenhaan, thanks again for this PR. We really appreciate the contribution! I think for us it's better to keep the API surface area as small as possible. I agree that this method is useful but I think it's more clear for a reader to read both functions happening explicitly when written in code, instead of having to go to the definition if they are unfamiliar with the function.

That being said I think we can close this PR out for now and if it is very requested add it in.

Thank you again for the contributions and ideas!

@maaslalani maaslalani closed this Feb 28, 2024
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