From ca1e7810c7a16b4ebf1f3cd392b3738b64cf2f37 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Thu, 31 Mar 2016 20:17:53 +0800 Subject: [PATCH] fix label escape character issue --- .../widgets/skeletons/text_token_stream.hpp | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/include/nana/gui/widgets/skeletons/text_token_stream.hpp b/include/nana/gui/widgets/skeletons/text_token_stream.hpp index c5d5a5e7..fea7cbf8 100644 --- a/include/nana/gui/widgets/skeletons/text_token_stream.hpp +++ b/include/nana/gui/widgets/skeletons/text_token_stream.hpp @@ -194,13 +194,24 @@ namespace nana{ namespace widgets{ namespace skeletons return token::tag_begin; } + //Escape - if(ch == '\\') + if(this->format_enabled_ && (ch == '\\')) { if(iptr_ + 1 < endptr_) { ch = *(iptr_ + 1); - iptr_ += 2; + + if ('<' == ch || '>' == ch) //two characters need to be escaped. + { + iptr_ += 2; + } + else + { + //ignore escape + ch = '\\'; + iptr_++; + } } else { @@ -208,8 +219,8 @@ namespace nana{ namespace widgets{ namespace skeletons return token::eof; } } - - ++iptr_; + else + ++iptr_; idstr_.clear(); idstr_.append(1, ch); @@ -277,6 +288,8 @@ namespace nana{ namespace widgets{ namespace skeletons return token::eof; } + + if(('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z') || '_' == ch) { --iptr_;