iced-rs/iced

TextInput paragraph state cache

tzemanovic opened this issue · 0 comments

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

Hi, I’m using iced with bevy using https://github.com/tasgon/bevy_iced and I’m trying to update it from iced 0.10 to 0.12, but the integration of TextInput seems to be affected by the state caching introduced in #2058.

The issue is that the paragraph update applied in TextInput’s on_event in by the update_cache closure sometimes gets out of sync with the actual value, because in the integration the input message is passed via bevy’s event system which is sometimes delayed by a frame, which causes the input to flicker.

From what I can see the flicker is due to fn offset being calculated using the cache state before the actual value is updated via the propagated event. This is even worse with .secure(true) input where the raw input is shown for a frame. I’m not yet too familiar with the iced internals so I’m not sure what would be a right approach to fix this (and if there are any other widgets that may be affected by this?), but I’m happy to collaborate on a patch. When I removed the call to update_cache the problem in the integration goes away.

What is the expected behavior?

Visual integrity on text input. Cache should not affect the view before the event is processed by the app.

Version

crates.io release

Operating System

Linux

Do you have any log output?

No response