Skip to content

Commit d184092

Browse files
committed
Show emoji in HTML treeview
Show emoji in the HTML treeview as emoji and not as text
1 parent 1cbe096 commit d184092

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

src/textdocvisitor.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,29 @@ void TextDocVisitor::operator()(const DocSymbol &s)
3939

4040
void TextDocVisitor::operator()(const DocEmoji &s)
4141
{
42-
const char *res = EmojiEntityMapper::instance().name(s.index());
42+
// the TextDocVisitor is only invokated for the JS part of the HTML output
43+
const char *res = EmojiEntityMapper::instance().unicode(s.index());
4344
if (res)
4445
{
45-
filter(res);
46+
const char *p = res;
47+
while (*p)
48+
{
49+
switch(*p)
50+
{
51+
case '&': case '#':
52+
break;
53+
case 'x':
54+
m_t << "\\u{";
55+
break;
56+
case ';':
57+
m_t << "}";
58+
break;
59+
default:
60+
m_t << *p;
61+
break;
62+
}
63+
p++;
64+
}
4665
}
4766
else
4867
{

src/util.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4313,7 +4313,9 @@ QCString convertToJSString(const QCString &s)
43134313
switch (c)
43144314
{
43154315
case '"': growBuf.addStr("\\\""); break;
4316-
case '\\': growBuf.addStr("\\\\"); break;
4316+
case '\\': if (*p=='u' && *(p+1)=='{') growBuf.addStr("\\");
4317+
else growBuf.addStr("\\\\");
4318+
break;
43174319
default: growBuf.addChar(c); break;
43184320
}
43194321
}
@@ -5635,7 +5637,8 @@ QCString parseCommentAsText(const Definition *scope,const MemberDef *md,
56355637
if (result.at(i)==',' ||
56365638
result.at(i)=='.' ||
56375639
result.at(i)=='!' ||
5638-
result.at(i)=='?')
5640+
result.at(i)=='?' ||
5641+
result.at(i)=='}') // good for UTF-16 characters and } otherwise also hood point to stop string
56395642
{
56405643
i++; // we want to be "behind" last inspected character
56415644
break;

0 commit comments

Comments
 (0)