adjust ws stripping code

@umop

Change the ws stripping code slightly to make sure the text doesn't jump when replacing the old session contents w/ the new.