Handle n+1 characters in the scrolling decorator
This commit is contained in:
parent
3bb2fb8247
commit
a8df4a5f9d
3 changed files with 19 additions and 2 deletions
|
@ -1,6 +1,10 @@
|
|||
import difflib
|
||||
import logging
|
||||
|
||||
import util.format
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def never(init):
|
||||
def call_init(obj, *args, **kwargs):
|
||||
|
@ -49,9 +53,10 @@ def scrollable(func):
|
|||
direction = widget.get("scrolling.direction", "right")
|
||||
|
||||
if direction == "left":
|
||||
scroll_speed = -scroll_speed
|
||||
if start + scroll_speed <= 0: # bounce back
|
||||
if start - scroll_speed < 0: # bounce back
|
||||
widget.set("scrolling.direction", "right")
|
||||
else:
|
||||
scroll_speed = -scroll_speed
|
||||
|
||||
next_start = start + scroll_speed
|
||||
if next_start + width > len(text):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue