feat: set placeholder to text#112
Open
janTatesa wants to merge 2 commits into
Open
Conversation
joshka
reviewed
Dec 14, 2025
Contributor
joshka
left a comment
There was a problem hiding this comment.
I wrote some review comments on this a while back, but never hit submit. Apologies.
I think this is generally a good idea. Just some small things I'd suggest doing.
I'm in general approval of the idea. Needs some tests if that's possible.
pm100
added a commit
to pm100/ratatui-textarea
that referenced
this pull request
Mar 24, 2026
The placeholder field changes from (String, Style) to ratatui_core::text::Text, allowing rich styled content (multiple spans with different colours/styles) to be set as a placeholder. New API: - set_placeholder(impl Into<Text>) - primary setter - placeholder() -> &Text - getter The old set_placeholder_text/set_placeholder_style/placeholder_text/ placeholder_style methods are kept but marked deprecated. Ported from rhysd/tui-textarea#112 (original author @janTatesa), adapted to use ratatui-core/ratatui-widgets instead of ratatui. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pm100
added a commit
to pm100/ratatui-textarea
that referenced
this pull request
Mar 24, 2026
The placeholder field changes from (String, Style) to ratatui_core::text::Text, allowing rich styled content (multiple spans with different colours/styles) to be set as a placeholder. New API: - set_placeholder(impl Into<Text>) - primary setter - placeholder() -> &Text - getter The old set_placeholder_text/set_placeholder_style/placeholder_text/ placeholder_style methods are kept but marked deprecated. Ported from rhysd/tui-textarea#112 (original author @janTatesa), adapted to use ratatui-core/ratatui-widgets instead of ratatui. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pm100
added a commit
to ratatui/ratatui-textarea
that referenced
this pull request
Mar 29, 2026
* feat: upgrade placeholder to accept styled Text The placeholder field changes from (String, Style) to ratatui_core::text::Text, allowing rich styled content (multiple spans with different colours/styles) to be set as a placeholder. New API: - set_placeholder(impl Into<Text>) - primary setter - placeholder() -> &Text - getter The old set_placeholder_text/set_placeholder_style/placeholder_text/ placeholder_style methods are kept but marked deprecated. Ported from rhysd/tui-textarea#112 (original author @janTatesa), adapted to use ratatui-core/ratatui-widgets instead of ratatui. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: address PR review issues for styled placeholder - Add set_styled_placeholder(impl Into<Text>) alongside the existing set_placeholder_text / set_placeholder_style / placeholder_text / placeholder_style methods (no deprecations — both APIs coexist) - Fix set_placeholder_text('') to clear placeholder.lines, restoring the original disabled-placeholder semantics - Fix rendering guard: placeholder is only rendered when placeholder.lines is non-empty, so an unset placeholder no longer produces a styled-but-invisible paragraph on empty textarea - Restore cursor Span in placeholder rendering (was dropped when placeholder_widget() was removed by the PR) - Add placeholder_demo example covering all API combinations Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * style: apply cargo fmt Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: use div_ceil in placeholder_demo (clippy) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Resolves #110