Skip to content

Commit a807550

Browse files
committed
Regression: Fix 2 issues with literal_at() refactoring
1 parent 242462e commit a807550

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/markdown.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ inline size_t isNewline(std::string_view data)
209209
// normal newline
210210
if (data[0] == '\n') return 1;
211211
// artificial new line from ^^ in ALIASES
212-
if (literal_at(data,"\\ilinebr ")) return 8;
212+
if (literal_at(data,"\\ilinebr"))
213+
{
214+
return (data.size()>8 && data[8]==' ') ? 9 : 8; // also count space after \ilinebr if present
215+
}
213216
return 0;
214217
}
215218

src/stringutil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ template <size_t N>
106106
bool literal_at(std::string_view data,const char (&str)[N])
107107
{
108108
size_t len = N-1; // exclude 0 terminator
109-
return len<data.size() && data[0]==str[0] && qstrncmp(data.data()+1,str+1,len-1)==0;
109+
return len<=data.size() && data[0]==str[0] && qstrncmp(data.data()+1,str+1,len-1)==0;
110110
}
111111

112112
#endif // STRINGUTIL_H

0 commit comments

Comments
 (0)