Revert "duct-taped trimText() to pass unit test"

This reverts commit 29a0c3fab0fdefb73c5f8df29e9269f950f891d2.