Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

annotate: perform model fill in two passes, fixes row colors

Changeset d24ca6564472

Parent 67650c5ac7c5

by Steve Borho

Changes to one file · Browse files at d24ca6564472 Showing diff from parent 67650c5ac7c5 Diff from another changeset...

 
117
118
119
120
121
 
 
122
123
124
125
 
 
 
 
 
 
 
 
 
 
 
 
126
127
128
129
130
131
132
133
 
 
 
134
135
136
137
138
139
140
 
141
142
143
 
117
118
119
 
 
120
121
122
 
 
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
 
 
142
143
144
145
 
146
 
 
 
 
147
148
149
150
@@ -117,27 +117,34 @@
  return super(AnnotateView, self).keyPressEvent(event)     def fillModel(self, data): - sels = [] - revs = [] + revs, lines, lpos, sels = [], [], [], [] + pos = 0   for fctx, origline, text in data: - self.edit.appendPlainText(text[:-1]) - self.edit.moveCursor(QTextCursor.NextBlock)   rev = fctx.linkrev() + lines.append(text) + lpos.append(pos) + revs.append(str(rev)) + pos += len(text) + + self.edit.setPlainText(''.join(lines)) + self.edit.revs = revs + width = max([len(r) for r in revs]) * self.edit.charwidth + 3 + self.revarea.width = width + self.revarea.setFixedWidth(width) + + for i, rev in enumerate(revs):   ctx = self.repo[rev]   rgb = self.cm.get_color(ctx, self.curdate)   sel = QTextEdit.ExtraSelection()   sel.bgcolor = QColor(rgb) # save a reference   sel.format.setBackground(sel.bgcolor)   sel.format.setProperty(QTextFormat.FullWidthSelection, True) - sel.cursor = self.edit.textCursor() - sel.cursor.select(QTextCursor.LineUnderCursor) + sel.cursor = QTextCursor(self.edit.document()) + sel.cursor.setPosition(lpos[i]) + sel.cursor.clearSelection()   sels.append(sel) - revs.append(str(rev))   self.colorsels = sels - width = max([len(r) for r in revs]) * self.edit.charwidth + 3 - self.revarea.width = width - self.revarea.setFixedWidth(width) - self.edit.revs = revs +   self.edit.setExtraSelections(self.colorsels)   self.edit.verticalScrollBar().setValue(0)