Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

fileview: on the default branch, lastScrollPosition can be a local variable

Changeset 099d368ba54e

Parent 49a7fdad2994

by Steve Borho

Changes to one file · Browse files at 099d368ba54e Showing diff from parent 49a7fdad2994 Diff from another changeset...

 
142
143
144
145
146
147
148
 
308
309
310
311
312
313
314
 
327
328
329
330
 
331
332
333
 
334
335
336
 
401
402
403
404
405
406
407
408
409
410
411
412
413
 
416
417
418
419
420
421
422
423
424
 
 
 
 
 
425
426
427
 
142
143
144
 
145
146
147
 
307
308
309
 
310
311
312
 
325
326
327
 
328
329
330
 
331
332
333
334
 
399
400
401
 
 
 
 
 
 
 
402
403
404
 
407
408
409
 
 
 
 
 
 
410
411
412
413
414
415
416
417
@@ -142,7 +142,6 @@
  self._parent = 0   self._lostMode = None   self._lastSearch = u'', False - self._lastScrollPosition = 0     self.actionDiffMode = QAction(qtlib.geticon('view-diff'),   _('View change as unified diff output'), @@ -308,7 +307,6 @@
  @pyqtSlot()   def clearDisplay(self):   self._filename = None - self._lastScrollPosition = 0   self.restrictModes(False, False, False)   self.sci.setMarginWidth(1, 0)   self.clearMarkup() @@ -327,10 +325,10 @@
  status = hglib.fromunicode(status)   if self._filename == filename:   # Get the last visible line to restore it after reloading the editor - self._lastScrollPosition = self.sci.firstVisibleLine() + lastScrollPosition = self.sci.firstVisibleLine()   else:   # Reset the scroll positions when the file is changed - self._lastScrollPosition = 0 + lastScrollPosition = 0   self._filename, self._status = filename, status     self.clearMarkup() @@ -401,13 +399,6 @@
  return   elif self._mode == AnnMode:   self.sci.setSource(filename, self._ctx.rev()) - - # Recover the last scroll position - # Make sure that _lastScrollPosition never exceeds the amount of - # lines on the editor - self._lastScrollPosition = min(self._lastScrollPosition, \ - self.sci.lines() - 1) - self.sci.verticalScrollBar().setValue(self._lastScrollPosition)   else:   lexer = lexers.get_lexer(filename, fd.contents, self)   self.sci.setLexer(lexer) @@ -416,12 +407,11 @@
  self.sci.setText(fd.contents)   self.sci._updatemarginwidth()   - # Recover the last scroll position - # Make sure that _lastScrollPosition never exceeds the amount of - # lines on the editor - self._lastScrollPosition = min(self._lastScrollPosition, \ - self.sci.lines() - 1) - self.sci.verticalScrollBar().setValue(self._lastScrollPosition) + # Recover the last scroll position + # Make sure that lastScrollPosition never exceeds the amount of + # lines on the editor + lastScrollPosition = min(lastScrollPosition, self.sci.lines() - 1) + self.sci.verticalScrollBar().setValue(lastScrollPosition)     self.highlightText(*self._lastSearch)   uf = hglib.tounicode(self._filename)