Find & Replace - but not for Non-breaking Space

Hi team of Scrivener,
it would be very handy to have a function in Find and Replace that would enable to replace casual spaces with non-breaking spaces. P.e. in combination with ellipses. It’s not possible and I’d be happy if you add this feature.
I’m also having trouble with adding non-breaking spaces by hitting alt+spacebar: Instead of the desired nb space, it opens a Menu in the very top left corner of Scrivener. This might be a bug? I’m using Windows 10 and the latest version of Scrivener.
Thanks!
Mandy

Alt+Space is the default keyboard shortcut in Windows to open an application’s Title bar menu. It’s important when mouse or touch pad fail or a window is not located on the current screen. I don’t think apps can overrule that keyboard shortcut.

Regular Expressions (RegEx) might be able to find nbsp, casual spaces and ellipsis, especially when used in combination with each other.

I think in Scrivener there should be no need to add nbsp.

@AntoniDol, thank you for the fast answer.

So, in that case, it would be great if Scrivener would enable overriding the default shortcut (alt+space) for non-breaking spaces with custom shortcuts. It doesn’t make any sense to have them in Windows anyway.

How do I use RegEx? I’ve had already tried to paste non-breaking spaces into the search field while having RegEx selected in the options. This didn’t work. How do I do it?

I do really need a proper solution for this. By now, I’m copy-pasting every single space that requires replacement by hand.

edit: I just found out that I am actually able to replace the shortcut for nbsp. I have tried this before, but It wasn’t named the same way as in the menu (German version).

Scrivener, please correct the translation in the keybord shortcut menu:
Einfügen → Umbruch → Nicht umbrechender Abstand is wrong
Einfügen → Umbruch → Geschütztes Leerzeichen would be correct

The ability to distinguish between non-breaking and regular spaces in the Find & Replace panel was originally posted to the developers in 2014. I see no responses on the ticket, and no indication of whether it is possible of it has been forgotten. I’ve added this forum thread to the ticket so as to “bump” it.

It is not possible to find these markers with Regular Expressions. It’s not a bad idea—but it is an idea that is more modern than RTF, which is the format used to store data internally. :slight_smile: There is an official Unicode character for no-break spaces (u+00A0), and regex has mechanisms for searching by Unicode code points (\x{00a0}), and it generally works fine in Scrivener to do that, (\x{0046} will find the capital letter “F”). But like I say, the problem is RTF. It does not store no-break spaces as characters, but has its own syntax for it that would need to be specially implemented into the plain-text context that is the Find/Replace fields.

So that, I would imagine, is the challenge.

Hello Amber,
thank you for pushing the topic. Anyway, I’ve tried to find nbsp with RegEx in F&R with this expression, but as you said, it won’t work. I’m able to find the letters “f” with the other expression you’ve mentioned, but if I put the expression into the replace-field, it doesn’t work either (it puts the expression into my text instead). Shouldn’t this be possible as well?
Could you please have a look at my former post and ask someone to correct the German translation in the keyboard shortcuts menu?

I use them on almost every page, using TextExpander snippets to replace ;. with … ” and
;- with – ”. The non-breaking space prevents a line break between ellipsis or em-dash and the closing quote, and the snippet also prevents Scrivener (and other word processors) inserting the wrong smart quote.

I use TextExpander on a Mac, but there are similar apps for Windows. In it I created a snippet that converts two semicolons: ;; to the non-breaking space . The shortcut can be anything, of course.

@AmberV says you can’t distinguish between space and non-breaking space in an RTF, but it hasn’t hindered me at all. I think you can’t distinguish between the two when searching, but there’s no problem placing a in the replacement string. At least, on a Mac, there isn’t.

Yeah, we’re talking about the Windows version here. Whatever issues have been solved in finding these characters with search tools on the Mac is irrelevant.

@drmajorbob, thank you for the hint, but as @AmberV stated, this doesn’t seem to be a solution on a Windows PC. I was able to create a shortcut for nbsp and am happy with this for the coming text I’m writing. Still, for corrections, I’d love to have it in the search.

This regex finds non-breaking spaces in documents (V3.1.4.0)

\x{00A0}

But in a very peculiar way: you must use Project regex search, it doesn’t work with document search.

However, even if you enter \x{00A0} as the regex for a project search it won’t list the documents… BUT! If the document is open, it will highlight where the non-breaking space is!

This image shows:

  • the document not shown in the binder
  • the highlighted hit (from Project regex search)
  • the failure of document search to find the same thing

I don’t get it, but maybe someone else can add more knowledge to create a way to leverage this.

I can parse documents externally to find such things, fortunately the (uniquely!) very large number (300) of non-breaking spaces there were in one particular document seem to have disappeared subsequently; only one other document had any (only 1 in fact)

Since “Horizontal Line ▸ Centered Line Inserts a sequence of 100 underscored nonbreaking spaces” and I couldn’t remember whether I had inserted any such lines I was obliged to find a way to search for them all at once

TL;DR Select the Draft folder in the binder; all documents are then displayed consecutively in the active editor. Using project search with the regex would find any instances in the whole ms (apparently I hadn’t used the centered line)