forked from qt-creator/qt-creator
LanguageClient: Fix semantic token highlight
Ignore unknown modifiers when building up and accessing the text char format hash. Change-Id: I7e11e3fb6f4240083045368daec54e417416efa9 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -80,8 +80,11 @@ static int convertModifiers(int modifiersData, const QList<int> &tokenModifiers)
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (int i = 0; i < tokenModifiers.size() && modifiersData > 0; ++i) {
|
for (int i = 0; i < tokenModifiers.size() && modifiersData > 0; ++i) {
|
||||||
if (modifiersData & 0x1)
|
if (modifiersData & 0x1) {
|
||||||
result |= tokenModifiers[i];
|
const int modifier = tokenModifiers[i];
|
||||||
|
if (modifier > 0)
|
||||||
|
result |= modifier;
|
||||||
|
}
|
||||||
modifiersData = modifiersData >> 1;
|
modifiersData = modifiersData >> 1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -254,7 +254,9 @@ void addModifiers(int key,
|
|||||||
if (tokenModifiers.isEmpty())
|
if (tokenModifiers.isEmpty())
|
||||||
return;
|
return;
|
||||||
int modifier = tokenModifiers.takeLast();
|
int modifier = tokenModifiers.takeLast();
|
||||||
auto addModifier = [&](TextStyle style){
|
if (modifier < 0)
|
||||||
|
return;
|
||||||
|
auto addModifier = [&](TextStyle style) {
|
||||||
if (key & modifier) // already there don't add twice
|
if (key & modifier) // already there don't add twice
|
||||||
return;
|
return;
|
||||||
key = key | modifier;
|
key = key | modifier;
|
||||||
|
|||||||
Reference in New Issue
Block a user