From 766709e999ca6525a8d607de8f7b1ea6f2174ad4 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Mon, 17 Jul 2006 20:06:58 +0000 Subject: [PATCH] fix bug 2687 * src/lyxfunc.C (quoteArg): new, quotes arguments for the "log" dialog (LyXFunc::dispatch): quote log filename * src/frontends/controllers/ControlLog.C (ControlLog::initialiseParams): parse \" as " and \\ as \ in filename git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14481 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/controllers/ControlLog.C | 6 +++++- src/lyxfunc.C | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/frontends/controllers/ControlLog.C b/src/frontends/controllers/ControlLog.C index 148bd7f9b9..2dd73a2930 100644 --- a/src/frontends/controllers/ControlLog.C +++ b/src/frontends/controllers/ControlLog.C @@ -39,7 +39,11 @@ bool ControlLog::initialiseParams(string const & data) lex.setStream(is); string logtype, logfile; - lex >> logtype >> logfile; + lex >> logtype; + if (lex.isOK()) { + lex.next(true); + logfile = lex.getString(); + } if (!lex) // Parsing of the data failed. return false; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 1cff4e2847..9f2a418c9c 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -199,6 +199,15 @@ Change::Type lookupChangeType(DocIterator const & dit, bool outer = false) return Change::UNCHANGED; } + +/// quotes a string for use as an argument of the "log" dialog +string const quoteArg(string const & arg) +{ + ostringstream os; + os << '"' << subst(subst(arg, "\\", "\\\\"), "\"", "\\\"") << '"'; + return os.str(); +} + } LyXFunc::LyXFunc(LyXView * lv) @@ -1175,11 +1184,11 @@ void LyXFunc::dispatch(FuncRequest const & cmd) data = "literate "; break; } - data += logfile.second; + data += quoteArg(logfile.second); owner->getDialogs().show("log", data); } else if (name == "vclog") { string const data = "vc " + - owner->buffer()->lyxvc().getLogFile(); + quoteArg(owner->buffer()->lyxvc().getLogFile()); owner->getDialogs().show("log", data); } else owner->getDialogs().show(name, data); -- 2.39.2