diff-edit: Allow negative scroll positions in portals
This commit is contained in:
parent
f9c5399ab9
commit
244dc5897d
2 changed files with 17 additions and 4 deletions
|
|
@ -229,12 +229,18 @@ class Portal:
|
|||
width, height = dimensions
|
||||
x, y = self.position
|
||||
try:
|
||||
appearance = self.widget.appearance_interval((y, y+height))
|
||||
appearance = self.widget.appearance_interval((max(y, 0), y+height))
|
||||
except AttributeError:
|
||||
appearance = self.widget.appearance()[y:y+height]
|
||||
appearance = self.widget.appearance()[max(y, 0):y+height]
|
||||
self.last_dimensions = dimensions
|
||||
return appearance_resize([row[x:x+width] for row in appearance],
|
||||
dimensions, self.background_char)
|
||||
top = [self.background_char * width] * -y if y < 0 else []
|
||||
bottom = appearance_resize([row[max(x, 0):x+width] for row in appearance],
|
||||
(width + min(x, 0), height + min(y, 0)),
|
||||
self.background_char)
|
||||
if x < 0:
|
||||
padding = self.background_char * -x
|
||||
bottom = [padding + line for line in bottom]
|
||||
return top + bottom
|
||||
|
||||
|
||||
class View:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue