qfish / XAlign

An amazing Xcode Source Editor extension to align regular code. It can align anything in any way you want.
MIT License
2.88k stars 385 forks source link

Aligned text block introduces extra newlines. #34

Open DominikDeak opened 10 years ago

DominikDeak commented 10 years ago

When I apply the align command on the following block:

  const API::Resource::Key Version = API::Resource::Key::Generate("Core::Version");
  const API::Resource::Key ProductName = API::Resource::Key::Generate("Core::ProductName");
  const API::Resource::Key AuthorName = API::Resource::Key::Generate("Core::AuthorName");
  const API::Resource::Key OrganisationName = API::Resource::Key::Generate("Core::OrganisationName");

The resulting aligned block will have extra newlines inserted:

  const API::Resource::Key Version          = API::Resource::Key::Generate("Core::Version");

  const API::Resource::Key ProductName      = API::Resource::Key::Generate("Core::ProductName");

  const API::Resource::Key AuthorName       = API::Resource::Key::Generate("Core::AuthorName");

  const API::Resource::Key OrganisationName = API::Resource::Key::Generate("Core::OrganisationName");

The source file in question is in UTF-8 format, with Windows (CRLF) encoding.

qfish commented 10 years ago

Maybe this line is too long ?
const API::Resource::Key OrganisationName = API::Resource::Key::Generate("Core::OrganisationName");

The following may help: Cancel the line-wrapping in Preferences -> Text Editing -> Indentation -> Line wrapping, then try again.

jstuth commented 10 years ago

i've got the same issue.... canceling line-wrap did not help i even get some extra lines when aligning short code lines

this defines:

#define make_int2 (int2)
#define make_float4 (float4)
#define make_float2 (float2)
#define make_ushort4 (ushort4)
#define make_float3 (float3)
#define make_ushort3 (ushort3)

become:

#define make_int2    (int2)

#define make_float4  (float4)

#define make_float2  (float2)

#define make_ushort4 (ushort4)

#define make_float3  (float3)

#define make_ushort3 (ushort3)
DominikDeak commented 9 years ago

This is still an ongoing problem in the latest version.

Test file: https://www.dropbox.com/s/bbnnv3t54e25b77/test.zip?dl=0