Added a check in single-line algorithm to make sure last character renders.  Adopted from exp2 branch.