Bug 321965 - Highlighting broken by previous multibyte characters
Summary: Highlighting broken by previous multibyte characters
Status: RESOLVED DUPLICATE of bug 274430
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: git master
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-04 19:33 UTC by Rolf Eike Beer
Modified: 2022-01-13 15:00 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***