Author: rpmcruz
Date: Thu Mar 25 06:20:42 2010
New Revision: 61482
URL: http://svn.opensuse.org/viewcvs/yast?rev=61482&view=rev
Log:
* src/pkg/ygtkpkglistview.cc: bug fix 2: highlight could
still get mangled when searching for more than one keyword,
when the 2nd was part of a tag.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/pkg/ygtkpkglistview.cc
trunk/gtk/src/pkg/ygtkpkgsearchentry.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=61482&r1=61481&r2=61482&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Thu Mar 25 06:20:42 2010
@@ -1,5 +1,11 @@
2010-03-25 Ricardo Cruz
+ * src/pkg/ygtkpkglistview.cc: bug fix 2: highlight could
+ still get mangled when searching for more than one keyword,
+ when the 2nd was part of a tag.
+
+2010-03-25 Ricardo Cruz
+
* src/pkg/ygtkpkglistview.cc: bug fix: various glitches
when searching for certain small sub-strings (due to
a collision with the tag "</small>").
Modified: trunk/gtk/src/pkg/ygtkpkglistview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkglistview.cc?rev=61482&r1=61481&r2=61482&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkglistview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkglistview.cc Thu Mar 25 06:20:42 2010
@@ -980,16 +980,22 @@
const char *openTag, const char *closeTag, int openTagLen, int closeTagLen)
{
if (keywords.empty()) return;
- for (std::list std::string::const_iterator it = keywords.begin();
- it != keywords.end(); it++) {
- const std::string &keyword = *it;
- const char *c = text.c_str();
- while ((c = strcasestr (c, keyword.c_str()))) {
- int pos = c - text.c_str(), len = keyword.size();
- text.insert (pos+len, closeTag);
- text.insert (pos, openTag);
- c = text.c_str() + pos + len + openTagLen + closeTagLen - 2;
+ const char *i = text.c_str();
+ while (*i) {
+ std::list std::string::const_iterator it;
+ for (it = keywords.begin(); it != keywords.end(); it++) {
+ const std::string &keyword = *it;
+ int len = keyword.size();
+ if (strncasecmp (i, keyword.c_str(), len) == 0) {
+ int pos = i - text.c_str();
+ text.insert (pos+len, closeTag);
+ text.insert (pos, openTag);
+ i = text.c_str() + pos + len + openTagLen + closeTagLen - 2;
+ break;
+ }
}
+ if (it == keywords.end())
+ i++;
}
}
Modified: trunk/gtk/src/pkg/ygtkpkgsearchentry.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgsearchentry.cc?rev=61482&r1=61481&r2=61482&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgsearchentry.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgsearchentry.cc Thu Mar 25 06:20:42 2010
@@ -222,7 +222,7 @@
G_CALLBACK (patterns_link_cb), this);
GtkWidget *icon = gtk_image_new_from_stock (
GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON);
- GtkWidget *hbox = gtk_hbox_new (FALSE, 4);
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_widget_show_all (hbox);
@@ -235,7 +235,7 @@
gtk_misc_set_alignment (GTK_MISC (label), 0, .5);
GtkWidget *icon = gtk_image_new_from_stock (
GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_BUTTON);
- GtkWidget *hbox = gtk_hbox_new (FALSE, 4);
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_widget_show_all (hbox);
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org