Remove Space Before Line Break

Posts: 9
Joined: Wed Jul 25, 2012 2:01 am
Platform: Windows

Wed Jul 25, 2012 3:14 am Post

Problem: There seems to be no way to automatically replace spaces before a line break (aka paragraph break, enter, carriage return).

So to clean up lines like:
This is a test.<space><line break>
I have to manually go to the end of every paragraph. In every text file. This situation can happen due to a slip of the keyboard or a decision to break a paragraph into two. When the characters are talking and the words are flowing, this kind of thing isn't something you think about (or want to think about).

I've tried pasting the space + line break into find/replace. That doesn't work. There doesn't seem to be a way to find non-printing characters. (I searched the manual and the forums. Saw something elsewhere on the forums that seemed to be a way to enter non-printing characters in Find/Replace, but couldn't get it to work in Scriv Win 1.2.3.)

Why this is a problem: Extra spaces artificially inflate character count, which is a critical statistic for me (more reliable than word count for estimating how much I've actually written).

Am I missing a feature somewhere?
(Maybe "space before" is called something else in British English. :) )

There is a menu item Format | Convert | Multiple Spaces to Space (Ctrl + Space). I suggest there should be either a similar menu item for Space + LineBreak OR (more generic solution) the menu item should remove all extra spaces (any space before whitespace) and be appropriately retitled.

Alternatively, a way to enter whitespace and other non-printing characters in the Find/Replace function would let me do this too (though I'd miss my old word processor macro that did everything at once). Find/Replace regular expressions or macro capabilities if you really want to thrill us techies. :wink:


Posts: 40
Joined: Sun Apr 01, 2012 1:25 pm
Platform: Mac + Windows

Fri Aug 10, 2012 6:29 pm Post

I don't know how MS Word handles it, but it allows you to search for and replace special characters, most importantly tab ^t, paragraph return ^p, and manual end of line ^l This adds a huge amount of functionality to search and replace and is the one thing that has in the past pulled me back to word.

The other place where this comes up for me is I would love to be able to use these types of characters in the compile separators.

Posts: 9
Joined: Wed Jul 25, 2012 2:01 am
Platform: Windows

Sat Aug 11, 2012 1:42 am Post

Just noticed another interesting oddness. I turned on "show invisibles" in my test file. On a line that has a space before the line break, there is no paragraph symbol at the end. If I delete the space, the paragraph symbol appears. Add the space back, it reappears. Something weird going on here. I'm only changing the space. (Not that I consider using show invisibles a viable workaround, but this was weird behavior.)

I also copied the paragraph symbol at the end of a line and pasted it into the find dialog and Scrivener was unable to find it, even though there were two in the test file. I could copy the paragraph symbol and paste it at the end of another line in the text and it worked. So that seems conclusive proof that ScrivWin 1.2.3 can copy the line break, but not find it.

I realize I'm an insane control freak, but hopefully "find and replace special characters" is in the queue for near-future enhancements. m(_ _)m

User avatar
Posts: 152
Joined: Tue Mar 24, 2009 7:24 pm
Platform: Mac

Mon Jan 18, 2016 9:26 pm Post

I second this wanted feature. Has anything been updated regarding spaces at the end of a sentence/before a line break? The extra spaces conversion works magically; I wish I could do a project search, after completing my MS, so I don't have to go in manually with invisibles turned on in order to erase unwanted spaces at the end of a paragraph.

Thank you!

Posts: 22
Joined: Mon Apr 15, 2013 12:56 am
Platform: Mac

Tue Feb 09, 2016 9:05 pm Post

Scrivener can already handle this for you automatically, folks. :)

In your Compile settings, go to the Transformation section and activate the "Remove trailing whitespace from documents" option. Now you can ignore it while writing and still be assured that trailing whitespace will be removed in your final document.