mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-21 19:15:44 +01:00
Make Statusline#updateBufferPosition a little more readable.
This commit is contained in:
@@ -231,25 +231,25 @@ const StatusLine = Module("statusline", {
|
|||||||
let win = document.commandDispatcher.focusedWindow;
|
let win = document.commandDispatcher.focusedWindow;
|
||||||
if (!win)
|
if (!win)
|
||||||
return;
|
return;
|
||||||
win.scrollY;
|
win.scrollY; // intentional - see Kris
|
||||||
percent = win.scrollY == 0 ? 0 : // This prevents a forced rendering
|
percent = win.scrollY == 0 ? 0 : // This prevents a forced rendering
|
||||||
win.scrollMaxY == 0 ? -1 : win.scrollY / win.scrollMaxY;
|
win.scrollMaxY == 0 ? -1 : win.scrollY / win.scrollMaxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
let bufferPositionStr = "";
|
|
||||||
percent = Math.round(percent * 100);
|
percent = Math.round(percent * 100);
|
||||||
if (percent < 0)
|
|
||||||
bufferPositionStr = "All";
|
|
||||||
else if (percent == 0)
|
|
||||||
bufferPositionStr = "Top";
|
|
||||||
else if (percent >= 100)
|
|
||||||
bufferPositionStr = "Bot";
|
|
||||||
else if (percent < 10)
|
|
||||||
bufferPositionStr = " " + percent + "%";
|
|
||||||
else
|
|
||||||
bufferPositionStr = percent + "%";
|
|
||||||
|
|
||||||
this.widgets.bufferposition.value = bufferPositionStr;
|
if (percent < 0)
|
||||||
|
var position = "All";
|
||||||
|
else if (percent == 0)
|
||||||
|
position = "Top";
|
||||||
|
else if (percent >= 100)
|
||||||
|
position = "Bot";
|
||||||
|
else if (percent < 10)
|
||||||
|
position = " " + percent + "%";
|
||||||
|
else
|
||||||
|
position = percent + "%";
|
||||||
|
|
||||||
|
this.widgets.bufferposition.value = position;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user