Skip to content

Unicode not handled properly when specifying -offset and -length #35

@lassiniemisto

Description

@lassiniemisto

When user selects a snippet in Eclipse editor and uses Ctrl+Shift+F to run clang-format for it, the location of the snippet is specified to clang-format using -offset and -length command line arguments.

Problem is that while clang-format expects them as bytes, CppStyle uses character counts. Considering Unicode characters, this goes easily wrong and the snippet selection becomes unreliable.

One way to tackle this is to use -lines instead of -offset/-length since clang-format also translates the -offset/-length into line numbers internally (no additional accuracy boost from using the byte definitions).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions