Skip to content

Commit

Permalink
Extend minimap to the top/bottom of screen (severin-lemaignan#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonwell committed Feb 27, 2018
1 parent 21b4db0 commit 95e7070
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions autoload/minimap.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def toggleminimap():
showminimap()

def showminimap():

minimap = getmmwindow()

# If the minimap window does not yet exist, create it
Expand Down Expand Up @@ -163,8 +162,16 @@ def draw(lengths,indents, startline=0):
lengths = []
indents = []

first = max(1, topline - 80)
last = min(bottomline + 80, len(src.buffer))
bufferlen = len(src.buffer)
more_on_top = 0
more_on_bottom = 0
if bufferlen > 160 + bottomline - topline:
if topline < 80:
more_on_bottom = 80 - topline
if bottomline + 80 > bufferlen:
more_on_top = bottomline + 80 - bufferlen
first = max(topline - 80 - more_on_top, 1)
last = min(bottomline + 80 + more_on_bottom, bufferlen)
for line in range(first, last):
linestring = src.buffer[line]
indents.append(len(linestring) - len(linestring.lstrip()))
Expand Down

0 comments on commit 95e7070

Please sign in to comment.