Edit: handle blanks in filenames correctly

Also, move path escaping to `Editor` class. The test is currently
failing (looks like a bug in `Editor`).