rosshemsley / SublimeClangFormat

A C++ code formatter based on Clang Format, for beautiful code with minimal effort in Sublime Text 3
Other
185 stars 52 forks source link

Fixed removing tabs in non-formatted code #52

Closed reicrof closed 6 years ago

reicrof commented 7 years ago

When using the translate_tabs_to_spaces settings, all of the tabs of a file would be translated to spaces even if they were not part of the formatted code. This could be annoying with bigger file containing both spaces and tabs for formatting.

The issue comes from the fact that we overwrite all of the file even when formatting selected text. Therefore Sublime would translate the copied tabs to spaces even when not part of the formatted code.

To fix this, we simply temporarily disable the translate_tabs_to_spaces setting and set it back once the code has been copied.

rosshemsley commented 6 years ago

Thanks @sailormoon