Skip to content

Commit 8a5cf84

Browse files
notes: fix inlineStyle length
1 parent b5339bf commit 8a5cf84

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/views/notes.nim

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ proc renderNoteParagraph(articleParagraph: ArticleParagraph; article: Article; t
7171

7272
proc flushInternal(start: int, len: int, style: int): void =
7373
let content = text.runeSubStr(start, len).replaceHashtagsAndMentions
74-
echo content, ", ", style
7574
if style == 0:
7675
target.add text content
7776
else:
@@ -108,11 +107,13 @@ proc renderNoteParagraph(articleParagraph: ArticleParagraph; article: Article; t
108107
else: discard
109108

110109
if style != lastStyle:
111-
flushInternal(lastStart, i - lastStart, lastStyle)
112-
110+
if i > lastStart:
111+
flushInternal(lastStart, i - lastStart - 1, lastStyle)
112+
lastStart = i - 1
113+
else:
114+
lastStart = i
113115
lastStyle = style
114-
lastStart = i
115-
116+
116117
if lastStart < len:
117118
flushInternal(lastStart, len - lastStart, lastStyle)
118119

0 commit comments

Comments
 (0)