diff options
author | benadha <benawiadha@gmail.com> | 2021-01-30 10:11:23 +0700 |
---|---|---|
committer | benadha <benawiadha@gmail.com> | 2021-01-30 10:11:23 +0700 |
commit | 707ae0a81cf1ce4cbe011477151aebe11bf483d0 (patch) | |
tree | 78dbb5ed53442acf4086be3829b3913de6d37e0d /epy.py | |
parent | 0c4e98804f270162ba09ae858b9a1a18f911f728 (diff) | |
download | epy-707ae0a81cf1ce4cbe011477151aebe11bf483d0.tar.gz |
Minor fix: inline format
Diffstat (limited to 'epy.py')
-rwxr-xr-x | epy.py | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -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) |