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

add an option to show cursor and placeholder together #73

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

kyu08
Copy link
Contributor

@kyu08 kyu08 commented Jul 26, 2024

What

I added an option to show cursor with placeholder. This is disabled by default.
image

Motivation

I feel it is more common that cursor and placeholder are shown together. Also users can understand easily they can input.

Comment on lines +123 to +127
#[cfg(any(
feature = "tuirs-crossterm",
feature = "tuirs-termion",
feature = "tuirs-no-backend",
))]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In tui-rs, Text does not have push_span method, so I did not support them.

When I did not put above cfg, I got this error.

error[E0599]: no method named `push_span` found for struct `tui::text::Text` in the current scope
   --> src/widget.rs:[12](https://github.com/kyu08/tui-textarea/actions/runs/10096172842/job/27918026333#step:18:13)9:22
    |
129 |                 text.push_span(self.0.placeholder.as_str());
    |                      ^^^^^^^^^ method not found in `Text<'_>`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `tui-textarea` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `tui-textarea` (lib test) due to 1 previous error

@rhysd
Copy link
Owner

rhysd commented Jul 31, 2024

Thank you for implementing this. I feel this behavior should be default. I will remove the option and make this as default behavior after merging this PR.

@rhysd rhysd merged commit cc016f9 into rhysd:main Jul 31, 2024
5 checks passed
rhysd added a commit that referenced this pull request Jul 31, 2024
@rhysd
Copy link
Owner

rhysd commented Jul 31, 2024

I made this default behavior at 00f0010

@kyu08
Copy link
Contributor Author

kyu08 commented Jul 31, 2024

@rhysd
Thanks!
I'm looking forward to use this in my TUI app!

@rhysd
Copy link
Owner

rhysd commented Jul 31, 2024

Okay, I'll announce the next release in this issue thread so that you can notice it.

@kyu08
Copy link
Contributor Author

kyu08 commented Jul 31, 2024

Thank you so much!
I appreciate your kindness.

@kyu08
Copy link
Contributor Author

kyu08 commented Aug 1, 2024

Thanks for fixing image ratio. 🙏
d5c9959

@rhysd
Copy link
Owner

rhysd commented Aug 1, 2024

This feature was included in v0.5.2 release.

@kyu08
Copy link
Contributor Author

kyu08 commented Aug 1, 2024

@rhysd
Thank you for informing me very kindly.🙏

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