diff --git a/mytwitter.py b/mytwitter.py index fd04a19..dbaa9c1 100755 --- a/mytwitter.py +++ b/mytwitter.py @@ -177,7 +177,8 @@ class TweetBox(gtk.VBox): self.text.set_alignment(0.0, 0.0) self.text.set_selectable(True) self.text.set_line_wrap(True) - self.text.connect('activate-link', self.on_url_clicked) + if gtk.pygtk_version[0] > 2 or (gtk.pygtk_version[0] == 2 and gtk.pygtk_version[1] >= 18): + self.text.connect('activate-link', self.on_url_clicked) button_box = gtk.HBox() self.pack_start(button_box) @@ -211,8 +212,9 @@ class TweetBox(gtk.VBox): # and the text new_text = status.text - new_text = re.sub('& ', '& ', new_text) - new_text = re.sub(r"(http://.*?)( |$)", r'\1\2', new_text) + new_text = re.sub('&([^;]*?)( |$)', '&\1\2', new_text) + if gtk.pygtk_version[0] > 2 or (gtk.pygtk_version[0] == 2 and gtk.pygtk_version[1] >= 18): + new_text = re.sub(r"(http://.*?)( |$)", r'\1\2', new_text) self.text.set_markup(new_text)