]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Amend 6c3447c8: FindAdv: sometimes a space is added on some math symbols
[lyx.git] / src / Paragraph.cpp
index dd8d66d1fa705898372d994b101d09fec8d8348a..a63017db328bc0c549c6f8a938719ffcb60de211 100644 (file)
@@ -1243,11 +1243,13 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
 {
        char_type const c = owner_->getUChar(bparams, runparams, i);
 
-       // Special case: URLs with hyperref need to escape backslash (#13012).
+       // Special case: URLs with hyperref need to escape backslash, # and % (#13012).
        // Both a layout tag and a dedicated inset seem too much effort for this.
-       if (c == '\\' && runparams.use_hyperref && il.latexname() == "url"
+       string const hr_url_escape_chars = "\\#%";
+       if (contains(hr_url_escape_chars, c) && runparams.use_hyperref && il.latexname() == "url"
            && il.required().find("url") != il.required().end()) {
-               os << "\\\\";
+               os << "\\";
+               os.put(c);
                return;
        }