CppStyle icon indicating copy to clipboard operation
CppStyle copied to clipboard

Unicode not handled properly when specifying -offset and -length

Open lassiniemisto opened this issue 7 years ago • 1 comments

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).

lassiniemisto avatar Sep 03 '18 12:09 lassiniemisto

This occurs on the 1.5.x version on Eclipse Mars (And yes I am particularly interested in getting this fixed for Mars..)

lassiniemisto avatar Sep 03 '18 12:09 lassiniemisto