I am following the Iced text editor YouTube video put out by Héctor and I have reached the point where I have added the line:column output under the text editor widget. But unlike the video where the line:column output is always at the bottom of the screen no matter how much content is in the text editor, the text editor in my version (trying to use version 0.12.1) pushes the line:column output off the screen until you scroll to the bottom of the TextEditor widget even though there is still padding involved and I can see that the TextEditor isn’t going off screen.
I have double checked, and other than the changes I needed to make to have the project build (changing on_edit to on_action) I can’t see any differences that would cause this behaviour. Is there something new about the TextEditor widget that needs to be set to have it match the behaviour in Héctor’s video?
The text_editor has now a Shrink behavior by default on its height. This means that it will fill space as needed; leaving no space left for the text.
This is a limitation of the layout approach of column and row widgets. There are plans to allow further customization (e.g. layout from bottom to top would solve the issue here).
The actual solution here is to use height(Length::Fill) on the text_editor. This causes the layout algorithm to measure the text first and use the remaining space for the editor.
Thanks, that fixed it. I had actually tried .height(Length::Fill) but I tried it on the container itself not the text editor, my assumption being that if I told the container to fill the window that it wouldn’t let the text widget be pushed outside the window.