don't escape regex metacharacters when writing apps file
markt markt
3 files changed,
15 insertions(+),
7 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,5 +1,9 @@
(Format: Year/Month/Day) Changes for 1.0rc3: +*07/01/02: + * Don't escape regular expression metacharacters in apps file, bug + #1595497 (Mark) + Remember.cc ClientPattern.cc *07/01/01: * Happy New Year! * Don't draw style's menu icon pixmap underneath the program's icon (Mark)
M
src/ClientPattern.cc
→
src/ClientPattern.cc
@@ -170,11 +170,6 @@ Terms::const_iterator it_end = m_terms.end();
for (; it != it_end; ++it) { pat.append(" ("); - // replace special chars like ( ) and [ ] with \( \) and \[ \] - string orig = FbTk::StringUtil::replaceString((*it)->orig, "(", "\\("); - orig = FbTk::StringUtil::replaceString(orig, ")", "\\)"); - orig = FbTk::StringUtil::replaceString(orig, "[", "\\["); - orig = FbTk::StringUtil::replaceString(orig, "]", "\\]"); switch ((*it)->prop) { case NAME:@@ -190,7 +185,7 @@ case ROLE:
pat.append("role="); } - pat.append(orig); + pat.append((*it)->orig); pat.append(")"); }
M
src/Remember.cc
→
src/Remember.cc
@@ -302,8 +302,17 @@
Application * Remember::add(WinClient &winclient) { ClientPattern *p = new ClientPattern(); Application *app = new Application(false); + // by default, we match against the WMClass of a window. - p->addTerm(p->getProperty(ClientPattern::NAME, winclient), ClientPattern::NAME); + string win_name = p->getProperty(ClientPattern::NAME, winclient); + + // replace special chars like ( ) and [ ] with \( \) and \[ \] + win_name = FbTk::StringUtil::replaceString(win_name, "(", "\\("); + win_name = FbTk::StringUtil::replaceString(win_name, ")", "\\)"); + win_name = FbTk::StringUtil::replaceString(win_name, "[", "\\["); + win_name = FbTk::StringUtil::replaceString(win_name, "]", "\\]"); + + p->addTerm(win_name, ClientPattern::NAME); m_clients[&winclient] = app; p->addMatch(); m_pats->push_back(make_pair(p, app));