Bug 321965

Summary: Highlighting broken by previous multibyte characters
Product: [Applications] kdevelop Reporter: Rolf Eike Beer <kde>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: RESOLVED DUPLICATE    
Severity: normal CC: craftplace.ms, igorkuo, olaf.the.lost.viking
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rolf Eike Beer 2013-07-04 19:33:10 UTC
A multibyte character in a line will shift the highlighting by of later e.g. variable names by one character.

Reproducible: Always

Steps to Reproduce:
void test() {
        double celsius = -30.0;
 
        qDebug() << "it's freaking cold at" /* (in °C) */ << celsius;
}

Actual Results:  
The "c" of "celsius" is not colored as the rest of the word.
Comment 1 Milian Wolff 2013-07-06 12:18:31 UTC
Confirmed and would be fixed by moving our code to QString instead of QByteArray, something which I already started investigating in the indexedstring-ng branch.
Comment 2 Andrey Cygankov 2016-01-23 23:58:20 UTC
I tried to reproduce the bug in KDevelop 5 - colored word displayed normal.
http://i.imgur.com/PiBoub6.png
Probably it is necessary to close.
Comment 3 Milian Wolff 2016-01-24 12:19:21 UTC
it's still valid in my testing.
Comment 4 Milian Wolff 2016-01-24 12:43:02 UTC
void test() {
    char c = 0;
    /* ümlaut */ c++;
}

Highlighting and context browsing shows the first '+' as the use location of 'c', due to the 'ü' in the comment before.
Comment 5 Milian Wolff 2016-01-24 13:54:29 UTC
We need to figure out how to efficiently translate the UTF-8 code points returned by the clang API to UTF-16 code points expected by KTextEditor::Cursor.

I just sent a mail to the clang ML asking for input on how to handle this situation.
Comment 6 Igor Kushnir 2022-01-13 15:00:20 UTC

*** This bug has been marked as a duplicate of bug 274430 ***