From 95e7070b326a097e9f3c335fa172cc05bc830c6e Mon Sep 17 00:00:00 2001 From: Andrew Kassen Date: Tue, 27 Feb 2018 15:29:25 -0700 Subject: [PATCH] Extend minimap to the top/bottom of screen (#56) --- autoload/minimap.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/autoload/minimap.py b/autoload/minimap.py index 8536900..1d8079f 100644 --- a/autoload/minimap.py +++ b/autoload/minimap.py @@ -67,7 +67,6 @@ def toggleminimap(): showminimap() def showminimap(): - minimap = getmmwindow() # If the minimap window does not yet exist, create it @@ -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()))