Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

stable fix 80-char limiting of utf-8 encoded strings

The limit was applied to the native encoded string, which not only calculates the wrong
length but also makes GTK crash badly if a code point is cut in half, when the native
encoding was UTF-8.

Changeset 778b2ea72507

Parent ecf1189f9fab

by Sune Foldager

Changes to 4 files · Browse files at 778b2ea72507 Showing diff from parent ecf1189f9fab Diff from another changeset...

 
447
448
449
450
451
 
 
452
453
454
 
447
448
449
 
 
450
451
452
453
454
@@ -447,8 +447,8 @@
  return gtklib.markup(revid, **opts)   def data_func(widget, item, ctx):   def summary_line(desc): - desc = desc.replace('\0', '') - return hglib.toutf(desc.split('\n')[0][:80]) + desc = hglib.tounicode(desc.replace('\0', '').split('\n')[0]) + return hglib.toutf(desc[:80])   def revline_data(ctx, hl=False, branch=None):   if isinstance(ctx, basestring):   return ctx
 
891
892
893
894
895
 
 
896
897
898
 
891
892
893
 
 
894
895
896
897
898
@@ -891,8 +891,8 @@
  self.msg_config(None)   return False   - lines = buf.get_text(buf.get_start_iter(), - buf.get_end_iter()).splitlines() + lines = hglib.tounicode(buf.get_text(buf.get_start_iter(), + buf.get_end_iter())).splitlines()     if sumlen and len(lines[0].rstrip()) > sumlen:   resp = gdialog.Confirm(_('Confirm Commit'), [], self,
 
220
221
222
223
224
 
 
225
226
227
 
228
229
230
 
220
221
222
 
 
223
224
225
226
 
227
228
229
230
@@ -220,11 +220,11 @@
  elif item == 'desc':   return hglib.toutf(ctx.description().replace('\0', ''))   elif item == 'summary': - desc = self.get_data('desc', *args) - value = desc.split('\n')[0][:80] + value = ctx.description().replace('\0', '').split('\n')[0] + value = hglib.tounicode(value[:80])   if len(value) == 0:   return None - return value + return hglib.toutf(value)   elif item == 'user':   return hglib.toutf(ctx.user())   elif item == 'dateage':
 
28
29
30
31
 
32
33
34
 
28
29
30
 
31
32
33
34
@@ -28,7 +28,7 @@
  self.cmdlist = []   title = text or ' '.join(cmdline)   if len(title) > 80: - title = title[:80] + '...' + title = hglib.tounicode(title)[:80] + '...'   title = hglib.toutf(title.replace('\n', ' '))   gtk.Dialog.__init__(self, title=title, flags=gtk.DIALOG_MODAL)   self.set_has_separator(False)