Revert "Simplify Unicode-aware trimming"
Revert "Simplify Unicode-aware trimming"

`taken` is actually used afterwards
graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust