Merged
Conversation
caarlos0
reviewed
Jun 8, 2022
ad414d7 to
edb33a0
Compare
caarlos0
approved these changes
Jun 10, 2022
GabrielNagy
reviewed
Jul 5, 2022
| m.value = runes | ||
| } | ||
| if m.pos == 0 || m.pos > len(m.value) { | ||
| if (m.pos == 0 && len(m.value) == 0) || m.pos > len(m.value) { |
Contributor
There was a problem hiding this comment.
Hey @maaslalani do you know if this was intended?
Basically now when I use SetValue to prefill a field my cursor is no longer moved to the end of the line and I have to call CursorEnd myself.
Contributor
Author
There was a problem hiding this comment.
Hey! That's definitely a bug, I will fix it soon! Thank you for catching it.
Contributor
There was a problem hiding this comment.
No worries, if you want I can open a PR 😄
Contributor
Author
There was a problem hiding this comment.
If you would like to, go for it! It would be much appreciated :)
GabrielNagy
added a commit
to GabrielNagy/bubbles
that referenced
this pull request
Jul 5, 2022
This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and adds a bit more customizability to the feature. Currently, the validation API will completely block text input if the Validate function returns an error. This commit makes this behavior configurable by introducing a ValidateAction which decides how to proceed in case a validation error happens. To preserve backwards compatibility, the default behavior remains unchanged. If ValidateAction is set to AllowInput, the text input error will still be set if needed, but actual input will not be blocked. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting this. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil
GabrielNagy
added a commit
to GabrielNagy/bubbles
that referenced
this pull request
Jul 5, 2022
This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and adds a bit more customizability to the feature. Currently, the validation API will completely block text input if the Validate function returns an error. This commit makes this behavior configurable by introducing a ValidateAction which decides how to proceed in case a validation error happens. To preserve backwards compatibility, the default behavior remains unchanged. If ValidateAction is set to AllowInput, the text input error will still be set if needed, but actual input will not be blocked. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting this. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil
GabrielNagy
added a commit
to GabrielNagy/bubbles
that referenced
this pull request
Jul 5, 2022
This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and adds a bit more customizability to the feature. Currently, the validation API will completely block text input if the Validate function returns an error. This commit makes this behavior configurable by introducing a ValidateAction which decides how to proceed in case a validation error happens. To preserve backwards compatibility, the default behavior remains unchanged. If ValidateAction is set to AllowInput, the text input error will still be set if needed, but actual input will not be blocked. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting the existence of the path. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil
GabrielNagy
added a commit
to GabrielNagy/bubbles
that referenced
this pull request
Aug 18, 2022
This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and adds a bit more customizability to the feature. Currently, the validation API will completely block text input if the Validate function returns an error. This commit makes this behavior configurable by introducing a ValidateAction which decides how to proceed in case a validation error happens. To preserve backwards compatibility, the default behavior remains unchanged. If ValidateAction is set to AllowInput, the text input error will still be set if needed, but actual input will not be blocked. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting the existence of the path. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil
GabrielNagy
added a commit
to GabrielNagy/bubbles
that referenced
this pull request
Sep 4, 2023
This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and adds a bit more customizability to the feature. Currently, the validation API will completely block text input if the Validate function returns an error. This commit makes a breaking change to the ValidateFunc by returning an additonal bool that indicates whether or not input should be blocked. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting the existence of the path. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil
GabrielNagy
added a commit
to GabrielNagy/bubbles
that referenced
this pull request
Feb 29, 2024
This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and adds a bit more customizability to the feature. Currently, the validation API will completely block text input if the Validate function returns an error. This commit makes a breaking change to the validate API to no longer block input if this is the case, thus handing this responsibility to the clients. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting the existence of the path. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil
GabrielNagy
added a commit
to GabrielNagy/bubbles
that referenced
this pull request
Feb 29, 2024
This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and makes a breaking change to the validation API. Currently, validation will completely block text input if the Validate function returns an error. This is now changed so the function no longer blocks input if this is the case, thus handing this responsibility to the clients. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting the existence of the path. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil
maaslalani
pushed a commit
to GabrielNagy/bubbles
that referenced
this pull request
Mar 13, 2024
This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and makes a breaking change to the validation API. Currently, validation will completely block text input if the Validate function returns an error. This is now changed so the function no longer blocks input if this is the case, thus handing this responsibility to the clients. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting the existence of the path. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil
maaslalani
added a commit
that referenced
this pull request
Mar 14, 2024
* feat(textinput): do not block input on validation This PR builds upon the excellent work in #167 and #114 and makes a breaking change to the validation API. Currently, validation will completely block text input if the Validate function returns an error. This is now changed so the function no longer blocks input if this is the case, thus handing this responsibility to the clients. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting the existence of the path. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil * fix: change name --------- Co-authored-by: Maas Lalani <maas@lalani.dev>
ReallyLiri
pushed a commit
to ReallyLiri/bubbles
that referenced
this pull request
Jun 13, 2024
* feat(textinput): do not block input on validation This PR builds upon the excellent work in charmbracelet#167 and charmbracelet#114 and makes a breaking change to the validation API. Currently, validation will completely block text input if the Validate function returns an error. This is now changed so the function no longer blocks input if this is the case, thus handing this responsibility to the clients. This is helpful for cases where the user is requested to type an existing system path, and the Validate function keeps asserting the existence of the path. With the current implementation such a validation is not possible. For example: > / Err: nil > /t Err: /t: No such file or directory > /tm Err: /tm: No such file or directory > /tmp Err: nil * fix: change name --------- Co-authored-by: Maas Lalani <maas@lalani.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #114
Adds
Validateproperty totextinputto ensure input is valid.Validate is a function that accepts a
stringand returns anerrorwhich may benilif the string is valid.