aboutsummaryrefslogtreecommitdiffstats
path: root/epy.py
diff options
context:
space:
mode:
authorbenadha <benawiadha@gmail.com>2021-01-30 10:11:23 +0700
committerbenadha <benawiadha@gmail.com>2021-01-30 10:11:23 +0700
commit707ae0a81cf1ce4cbe011477151aebe11bf483d0 (patch)
tree78dbb5ed53442acf4086be3829b3913de6d37e0d /epy.py
parent0c4e98804f270162ba09ae858b9a1a18f911f728 (diff)
downloadepy-707ae0a81cf1ce4cbe011477151aebe11bf483d0.tar.gz
Minor fix: inline format
Diffstat (limited to 'epy.py')
-rwxr-xr-xepy.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/epy.py b/epy.py
index 2a81ac7..0b06f4b 100755
--- a/epy.py
+++ b/epy.py
@@ -663,14 +663,18 @@ class Board:
self.formatting = formatting
def format(self):
- for i in self.formatting["italic"]:
+ chunkidx = self.find_chunkidx(self.y)
+ start_chunk = 0 if chunkidx == 0 else self.chunks[chunkidx-1]+1
+ end_chunk = self.chunks[chunkidx]
+ # if y in range(start_chunk, end_chunk+1):
+ for i in [j for j in self.formatting["italic"] if start_chunk <= j[0] and j[0] <= end_chunk]:
try:
- self.pad.chgat(i[0], i[1], i[2], curses.A_ITALIC)
+ self.pad.chgat(i[0] % self.MAXCHUNKS, i[1], i[2], curses.A_ITALIC)
except:
pass
- for i in self.formatting["bold"]:
+ for i in [j for j in self.formatting["bold"] if start_chunk <= j[0] and j[0] <= end_chunk]:
try:
- self.pad.chgat(i[0], i[1], i[2], curses.A_BOLD)
+ self.pad.chgat(i[0] % self.MAXCHUNKS, i[1], i[2], curses.A_BOLD)
except:
pass
@@ -715,6 +719,7 @@ class Board:
chunkidx = self.find_chunkidx(y)
if chunkidx != self.find_chunkidx(self.y):
self.paint_text(chunkidx)
+ self.y = y
self.format()
# TODO: not modulo by self.MAXCHUNKS but self.pad.height
self.pad.refresh(y % self.MAXCHUNKS, b, c, d, e, f)