Bugs item #1530313, was opened at 2006-07-28 13:02
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1530313&group_id=2439

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Scintilla
Group: Bug
Status: Open
Resolution: None
Priority: 5
Submitted By: Nicola Civran (nyk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Unexpected result of funcition StyleContext::Match()

Initial Comment:
I think there is a bug in all StyleContext::Match()
functions, when testing characters with ASCII code >
127. In my lexer, I need to use sc.Match('°'), but this
call always returns false, even when sc.ch IS '°'.

It happens that StyleContext's ctor (and
StyleContext::GetNextChar() as well) gets characters
from its styler as char, casts them to unsigned and
stores them as int. So, a character like '°' (0xB0)
will be stored in sc.ch as 176 (0x000000B0), but when
used as parameter in sc.Match('°') its value is -80,
that promoted to int become 0xFFFFFFB0.

I can overcome the problem simply writing:
sc.ch == static_cast<unsigned char>('°')
but perhaps will be more useful to change the Match
functions all together, so I post a possible fix.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1530313&group_id=2439
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to