don't escape regex metacharacters when writing apps file

This commit is contained in:
markt 2007-01-02 03:12:24 +00:00
parent 9910094bd1
commit 8588402376
3 changed files with 15 additions and 7 deletions

View file

@ -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)

View file

@ -170,11 +170,6 @@ string ClientPattern::toString() const {
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 @@ string ClientPattern::toString() const {
pat.append("role=");
}
pat.append(orig);
pat.append((*it)->orig);
pat.append(")");
}

View file

@ -302,8 +302,17 @@ Application* Remember::find(WinClient &winclient) {
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));