# HG changeset patch
# User Yuki KODAMA <endflow....@gmail.com>
# Date 1259171449 -32400
# Branch stable
# Node ID 8407dab2642af7438759ba48a4b86ab98ffb63f1
# Parent  ef1f57118dc856f2dee4ed58d112cd26a5397f0f
logview: fix escaping issues on treeview markup

Closes #759

There were 2 issues:
 * Tags and branch names must be escaped
 * 'BRANCH' column should use 'text' instead of 'markup'

diff --git a/tortoisehg/hgtk/logview/treemodel.py
b/tortoisehg/hgtk/logview/treemodel.py
--- a/tortoisehg/hgtk/logview/treemodel.py
+++ b/tortoisehg/hgtk/logview/treemodel.py
@@ -156,21 +156,22 @@
             else:
                 lines = summary.splitlines()
                 summary = lines and lines[0] or ''
-            summary = gtklib.markup_escape_text(hglib.toutf(summary))
+            escape = gtklib.markup_escape_text
+            summary = escape(hglib.toutf(summary))
             node = ctx.node()
             tags = self.repo.nodetags(node)
             taglist = hglib.toutf(', '.join(tags))
             tstr = ''
             for tag in tags:
                 if tag not in self.hidetags:
-                    tstr += '<span color="%s" background="%s"> %s </span> ' % \
-                            ('black', '#ffffaa', tag)
+                    tstr += gtklib.markup(' %s ' % tag, color='black',
+                                          background='#ffffaa') + ' '

             branch = ctx.branch()
             bstr = ''
             if self.branchtags.get(branch) == node:
-                bstr += '<span color="%s" background="%s"> %s </span> ' % \
-                        ('black', '#aaffaa', branch)
+                bstr += gtklib.markup(' %s ' % branch, color='black',
+                                      background='#aaffaa') + ' '

             author = hglib.toutf(hglib.username(ctx.user()))
             age = hglib.age(ctx.date())
diff --git a/tortoisehg/hgtk/logview/treeview.py
b/tortoisehg/hgtk/logview/treeview.py
--- a/tortoisehg/hgtk/logview/treeview.py
+++ b/tortoisehg/hgtk/logview/treeview.py
@@ -423,8 +423,8 @@
         col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
         col.set_fixed_width(cell.get_size(self.treeview)[2])
         col.pack_start(cell, expand=True)
+        col.add_attribute(cell, "text", treemodel.BRANCH)
         col.add_attribute(cell, "foreground", treemodel.FGCOLOR)
-        col.add_attribute(cell, "markup", treemodel.BRANCH)

         cell = gtk.CellRendererText()

Attachment: thg-kuy-stable_rev4990.patch
Description: Binary data

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to