widget: correct textfield insert behavior
varintrle: copied from a discontinued project

This was originally written for part of the compression algorithm in a
custom timeseries DB.

No exported API since it has not been thought too much about, but it's
here anyways for future use.