floem icon indicating copy to clipboard operation
floem copied to clipboard

TextInput view: UI does not react when updating buffer value to previous value entered

Open sexnine opened this issue 10 months ago • 0 comments

When the signal that serves as the value for a TextInput is updated, if the value it was last set to by method of user input is the same, the UI does not react.

This is due to TextInput.buffer.last_buffer only being set on user input and an optimization where request_layout is not called when the last buffer and the current buffer are the same: https://github.com/lapce/floem/blob/4bf974cc8a6ff43dd2e476595379ac91440ab89a/src/views/text_input.rs#L1044-L1060

My use case for this is listening to arrow key up/down events and increasing the value in the TextInput accordingly. As a temporary fix, I am calling request_layout myself in that event handler when I update the value.

Demo of issue with my use case:

https://github.com/user-attachments/assets/5cfe41f8-017b-45dd-8ba9-dbdc285908d3

sexnine avatar Mar 11 '25 05:03 sexnine