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

Purpose of text_input::State::is_pasting #184

Closed
luleyleo opened this issue Feb 9, 2020 · 3 comments
Closed

Purpose of text_input::State::is_pasting #184

luleyleo opened this issue Feb 9, 2020 · 3 comments
Labels
question Further information is requested

Comments

@luleyleo
Copy link

luleyleo commented Feb 9, 2020

While trying to understand the architecture of Iced I started implementing selecting text for the native TextInput.
When I wanted to implement copying to the clipboard I got irritated about what the purpose of is_pasting is as it seems to get cleared right after being set.
Does it have some purpose or can it be ignored / removed?

@hecrj
Copy link
Member

hecrj commented Feb 9, 2020

Currently, it's used to ignore any received characters while a user keeps pasting text (for instance, if a user keeps Ctrl + V pressed for a while). However, I think we should just cancel the pasting completely in that case.

That said, text selection is tricky and may involve changing the State considerably. For instance, the scrolling offset of a TextInput is currently determined from the cursor position alone. However, most toolkits implement a stateful offset that only changes when the cursor is close to the edges of the clipping area. Text selection will force us to implement this and unify it somehow.

Additionally, if we are going to add text selection complexity it may be a good idea to have in mind a multi-line text input or TextArea and implement a general solution instead.

@hecrj hecrj added the question Further information is requested label Feb 9, 2020
@hecrj
Copy link
Member

hecrj commented Feb 9, 2020

Oh, I forgot it is also used to cache the clipboard contents. Accessing the clipboard can be quite slow.

I took a look at your branch and looks very promising! 🎉

@hecrj
Copy link
Member

hecrj commented Mar 25, 2020

Closing as #202 landed.

@hecrj hecrj closed this as completed Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants