aboutsummaryrefslogtreecommitdiffstats
path: root/epy.py
diff options
context:
space:
mode:
authorwustho <benawiadha@gmail.com>2020-04-19 10:10:03 +0700
committerwustho <benawiadha@gmail.com>2020-04-19 10:10:03 +0700
commit93e387028d3e7a06e8cd0d084ff78b0ac66e6b71 (patch)
tree9f589464bac0ec48955ba756f7b7225b8a365dfd /epy.py
parent01b04412aa8277cc9b772683aab68c23e1afe649 (diff)
downloadepy-93e387028d3e7a06e8cd0d084ff78b0ac66e6b71.tar.gz
Add visual line indicator when screen scrolled partially.
Diffstat (limited to 'epy.py')
-rwxr-xr-xepy.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/epy.py b/epy.py
index a12b812..514e9c1 100755
--- a/epy.py
+++ b/epy.py
@@ -1109,6 +1109,7 @@ def reader(ebook, index, width, y, pctg, sect):
y = toc_secid.get(sect, 0)
countstring = ""
+ svline = "dontsave"
try:
while True:
if countstring == "":
@@ -1125,6 +1126,8 @@ def reader(ebook, index, width, y, pctg, sect):
savestate(ebook.path, index, width, y, y/totlines)
sys.exit()
elif k in K["ScrollUp"]:
+ if count > 1:
+ svline = y - 1
if y >= count:
y -= count
elif y == 0 and index != 0:
@@ -1137,6 +1140,8 @@ def reader(ebook, index, width, y, pctg, sect):
else:
y = pgup(y, rows, LINEPRSRV, count)
elif k in K["ScrollDown"]:
+ if count > 1:
+ svline = y + rows - 1
if y + count <= totlines - rows:
y += count
elif y == totlines - rows and index != len(contents)-1:
@@ -1374,6 +1379,9 @@ def reader(ebook, index, width, y, pctg, sect):
PROGRESS = (TOTALLOCALPCTG + sum(LOCALPCTG[:y+rows-1])) / TOTALPCTG
PROGRESSTR = "{}%".format(int(PROGRESS*100))
+ if svline != "dontsave":
+ pad.chgat(svline, 0, width, curses.A_UNDERLINE)
+
try:
SCREEN.clear()
SCREEN.addstr(0, 0, countstring)
@@ -1387,6 +1395,10 @@ def reader(ebook, index, width, y, pctg, sect):
except curses.error:
pass
k = pad.getch()
+
+ if svline != "dontsave":
+ pad.chgat(svline, 0, width, curses.A_NORMAL)
+ svline = "dontsave"
except KeyboardInterrupt:
savestate(ebook.path, index, width, y, y/totlines)
sys.exit()