mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix bug #9622
The backslash is the escape character used in our parser. Hence,
when used as a path separator on Windows, it has to be itself
escaped or the path enclosed in either double or single quotes.
Windows users are maybe trained to quote paths containing spaces
but not paths with backslashes. So, we automatically escape the
backslashes when they are not already enclosed in quotes.
(cherry picked from commit 4c9df62c6c
)
This commit is contained in:
parent
759769131a
commit
3e9a1c2da7
@ -697,6 +697,28 @@ bool Formats::view(Buffer const & buffer, FileName const & filename,
|
||||
|
||||
string command = format->viewer();
|
||||
|
||||
// Escape backslashes if not already in double or single quotes.
|
||||
// We cannot simply quote the whole command as there may be arguments.
|
||||
if (contains(command, '\\')) {
|
||||
bool inquote1 = false;
|
||||
bool inquote2 = false;
|
||||
string::iterator cit = command.begin();
|
||||
for (; cit != command.end(); ++cit) {
|
||||
switch (*cit) {
|
||||
case '"':
|
||||
inquote1 = !inquote1;
|
||||
break;
|
||||
case '\'':
|
||||
inquote2 = !inquote2;
|
||||
break;
|
||||
case '\\':
|
||||
if (!inquote1 && !inquote2)
|
||||
cit = ++command.insert(cit, '\\');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (format_name == "dvi" &&
|
||||
!lyxrc.view_dvi_paper_option.empty()) {
|
||||
string paper_size = buffer.params().paperSizeName(BufferParams::XDVI);
|
||||
|
@ -61,6 +61,8 @@ What's new
|
||||
- Fix on-screen display of macros whose name is a single non-letter symbol
|
||||
(part of bug 11158).
|
||||
|
||||
- Do not swallow backspaces in custom viewer/editor paths (bug 9622).
|
||||
|
||||
|
||||
* INTERNALS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user