aboutsummaryrefslogtreecommitdiffstats
path: root/epy.py
diff options
context:
space:
mode:
authorbenadha <benawiadha@gmail.com>2021-01-30 09:40:32 +0700
committerbenadha <benawiadha@gmail.com>2021-01-30 09:40:32 +0700
commit0c4e98804f270162ba09ae858b9a1a18f911f728 (patch)
tree44ee2c84a1dacb8bcb717d6eafadef4d8395042b /epy.py
parent5ccbf846984a97d7c30149c7f44d00d265284dbb (diff)
downloadepy-0c4e98804f270162ba09ae858b9a1a18f911f728.tar.gz
Minor fix: inline format
Diffstat (limited to 'epy.py')
-rwxr-xr-xepy.py45
1 files changed, 33 insertions, 12 deletions
diff --git a/epy.py b/epy.py
index e759e4f..2a81ac7 100755
--- a/epy.py
+++ b/epy.py
@@ -589,11 +589,18 @@ class HTMLtoLines(HTMLParser):
tmp_count = 0
# for k in text[startline:endline]:
for k in range(startline, endline):
- if tmp_count <= j[1]:
- tmp_start = [k, j[1]-tmp_count]
- if tmp_count <= j[1]+j[2]:
- tmp_end = [k, j[1]+j[2]-tmp_count]
- tmp_count += len(text[k]) + 1
+ if n in self.idbull|self.idinde:
+ if tmp_count <= j[1]:
+ tmp_start = [k, j[1]-tmp_count+3]
+ if tmp_count <= j[1]+j[2]:
+ tmp_end = [k, j[1]+j[2]-tmp_count+3]
+ tmp_count += len(text[k]) - 2
+ else:
+ if tmp_count <= j[1]:
+ tmp_start = [k, j[1]-tmp_count]
+ if tmp_count <= j[1]+j[2]:
+ tmp_end = [k, j[1]+j[2]-tmp_count]
+ tmp_count += len(text[k]) + 1
if tmp_start[0] == tmp_end[0]:
formatting["italic"].append(tmp_start + [tmp_end[1]-tmp_start[1]])
elif tmp_start[0] == tmp_end[0]-1:
@@ -610,11 +617,18 @@ class HTMLtoLines(HTMLParser):
tmp_count = 0
# for k in text[startline:endline]:
for k in range(startline, endline):
- if tmp_count <= j[1]:
- tmp_start = [k, j[1]-tmp_count]
- if tmp_count <= j[1]+j[2]:
- tmp_end = [k, j[1]+j[2]-tmp_count]
- tmp_count += len(text[k]) + 1
+ if n in self.idbull|self.idinde:
+ if tmp_count <= j[1]:
+ tmp_start = [k, j[1]-tmp_count+3]
+ if tmp_count <= j[1]+j[2]:
+ tmp_end = [k, j[1]+j[2]-tmp_count+3]
+ tmp_count += len(text[k]) - 2
+ else:
+ if tmp_count <= j[1]:
+ tmp_start = [k, j[1]-tmp_count]
+ if tmp_count <= j[1]+j[2]:
+ tmp_end = [k, j[1]+j[2]-tmp_count]
+ tmp_count += len(text[k]) + 1
if tmp_start[0] == tmp_end[0]:
formatting["bold"].append(tmp_start + [tmp_end[1]-tmp_start[1]])
elif tmp_start[0] == tmp_end[0]-1:
@@ -650,9 +664,15 @@ class Board:
def format(self):
for i in self.formatting["italic"]:
- self.pad.chgat(i[0], i[1], i[2], curses.A_ITALIC)
+ try:
+ self.pad.chgat(i[0], i[1], i[2], curses.A_ITALIC)
+ except:
+ pass
for i in self.formatting["bold"]:
- self.pad.chgat(i[0], i[1], i[2], curses.A_BOLD)
+ try:
+ self.pad.chgat(i[0], i[1], i[2], curses.A_BOLD)
+ except:
+ pass
def getch(self):
return self.pad.getch()
@@ -695,6 +715,7 @@ class Board:
chunkidx = self.find_chunkidx(y)
if chunkidx != self.find_chunkidx(self.y):
self.paint_text(chunkidx)
+ self.format()
# TODO: not modulo by self.MAXCHUNKS but self.pad.height
self.pad.refresh(y % self.MAXCHUNKS, b, c, d, e, f)
self.y = y