reduce regex calls in name highlighting
This commit is contained in:
parent
d17d9ccf09
commit
070ed21dde
6
bink.py
6
bink.py
@ -142,10 +142,12 @@ class App():
|
||||
post_user = post["user"]
|
||||
time_seconds = post["time"] / 1_000_000_000
|
||||
stamp = datetime.datetime.fromtimestamp(time_seconds)
|
||||
if current_user != post_user and name_re.search(body):
|
||||
if current_user != post_user:
|
||||
search = name_re.finditer(body)
|
||||
if search:
|
||||
widget_body = []
|
||||
index = 0
|
||||
for match in name_re.finditer(body):
|
||||
for match in search:
|
||||
start, end = match.span()
|
||||
before = body[index:start]
|
||||
highlight = body[start:end]
|
||||
|
Loading…
x
Reference in New Issue
Block a user