mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
* Lexer.{cpp,h}:
- implement quoteString for docstring * Menus.cpp: - use it for quoting flex argument. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27703 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cf247233c9
commit
c2bdcc6b63
@ -901,6 +901,18 @@ string Lexer::quoteString(string const & arg)
|
||||
}
|
||||
|
||||
|
||||
// same for docstring
|
||||
docstring Lexer::quoteString(docstring const & arg)
|
||||
{
|
||||
docstring res;
|
||||
res += '"';
|
||||
res += subst(subst(arg, from_ascii("\\"), from_ascii("\\\\")),
|
||||
from_ascii("\""), from_ascii("\\\""));
|
||||
res += '"';
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Lexer & Lexer::operator>>(char const * required)
|
||||
{
|
||||
string token;
|
||||
|
@ -193,6 +193,9 @@ public:
|
||||
/// Quotes a string so that reading it again with Lexer::next(true)
|
||||
/// gets the original string
|
||||
static std::string quoteString(std::string const &);
|
||||
/// Quotes a docstring so that reading it again with Lexer::next(true)
|
||||
/// gets the original string
|
||||
static docstring quoteString(docstring const &);
|
||||
|
||||
private:
|
||||
/// noncopyable
|
||||
|
@ -851,7 +851,7 @@ void MenuDefinition::expandFlexInsert(
|
||||
docstring const label = cit->first;
|
||||
addWithStatusCheck(MenuItem(MenuItem::Command,
|
||||
toqstr(translateIfPossible(label)),
|
||||
FuncRequest(LFUN_FLEX_INSERT, '"' + label + '"')));
|
||||
FuncRequest(LFUN_FLEX_INSERT, Lexer::quoteString(label))));
|
||||
}
|
||||
}
|
||||
// FIXME This is a little clunky.
|
||||
|
Loading…
Reference in New Issue
Block a user