Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
TextMate support for Source
Branch: master
Pull request Compare This branch is 46 commits behind textmate:master.

Fixed a problem with rubywrap wrapping separate blocks together

If a long comment block had two paragraphs in it, like this

% Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
% Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
%
% Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
% Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

rubywrap would incorrectly wrap it all together into one paragraph, like this

% Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod Lorem
% ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod Lorem ipsum
% dolor sit amet, consectetur adipisicing elit, sed do eiusmod Lorem ipsum dolor
% sit amet, consectetur adipisicing elit, sed do eiusmod

Now, it keeps the paragraphs separate, like this

% Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod Lorem
% ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
%
% Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod Lorem
% ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

This happened because the code to loop through lines until reaching the end of a block was comparing the length of a line to the preindent plus postindent plus length of the comment prefix. In the example above, when rubywrap examines the empty comment line, the preindent is zero, post indent is zero, and length of the comment prefix is two ('% '). The length of the entire line is *three*, because the newline character at the end also counts; since the length of the line is greater than the sum, rubywrap thinks this line belongs to the same block. Instead, we now compare the sum to the length of the line minus 1.

In the unusual case that an empty comment line appears at the end of the file with no newline character at the end, this line will also be split into its own block, since its length is one less than expected.
latest commit 382ac92f39
Daniel Grady authored infininight committed
Something went wrong with that request. Please try again.