Browse Source

fix(textcursor): correct number of Up/Down movements (#512)

pull/518/head
slook 4 months ago committed by GitHub
parent
commit
6410b77f51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      libs/pyTermTk/TermTk/TTkGui/textcursor.py

4
libs/pyTermTk/TermTk/TTkGui/textcursor.py

@ -315,11 +315,11 @@ class TTkTextCursor():
elif p.line > 0:
self.setPosition(p.line-1, len(self._document._dataLines[p.line-1]) , moveMode, cID=cID)
def moveUpDown(offset):
def _moveUpDown(cID,p,n):
def _moveUpDown(cID,p,_n):
if not textWrap:
raise ValueError("textWrap is required for the Up,Down movement")
cx, cy = textWrap.dataToScreenPosition(p.line, p.pos)
x, y = textWrap.normalizeScreenPosition(cx,cy+offset*n)
x, y = textWrap.normalizeScreenPosition(cx,cy+offset)
line, pos = textWrap.screenToDataPosition(x,y)
self.setPosition(line, pos, moveMode, cID=cID)
return _moveUpDown

Loading…
Cancel
Save