rewrite filename truncation code; ref #53
Merge remote-tracking branch 'upstream/master'