[lib] make singleSpace only replace double+ spaces rather than all