Patchwork [2,of,2] py3: use integer division in curseschunkselector.printstring()

login
register
mail settings
Submitter Denis Laxalde
Date Oct. 10, 2019, 10:34 a.m.
Message ID <fa7d08d7cc0ac6e2ffb0.1570703676@steppe.local>
Download mbox | patch
Permalink /patch/42183/
State Accepted
Headers show

Comments

Denis Laxalde - Oct. 10, 2019, 10:34 a.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1570702935 -7200
#      Thu Oct 10 12:22:15 2019 +0200
# Node ID fa7d08d7cc0ac6e2ffb02864ea7df614bbb193a0
# Parent  d1e7685793ec19e649370c77965d492a71aed30c
py3: use integer division in curseschunkselector.printstring()

This fixes a crash when scrolling in curses UI when refresh() is called
when a float value (namely 'self.firstlineofpadtoprint', taking its
value indirectly from 'self.linesprintedtopadsofar').

Patch

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
index 32f77d8..e206e72 100644
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -1156,7 +1156,7 @@  class curseschunkselector(object):
 
         # is reset to 0 at the beginning of printitem()
 
-        linesprinted = (xstart + len(t)) / self.xscreensize
+        linesprinted = (xstart + len(t)) // self.xscreensize
         self.linesprintedtopadsofar += linesprinted
         return t