Lines increasing and decreasing indent no longer go below zero

Normally a line matched by both patterns will be decreased by one unit compared to the non-ignored lines immediately above and below. If however the line above was not indented, the line would in theory be decreased to -1 and thus just go back to zero indent for the line following it.
This commit is contained in:
Allan Odgaard
2013-11-08 00:38:25 +01:00
parent 8f90f8f602
commit d843225d81

View File

@@ -116,7 +116,7 @@ namespace indent
{
if(type & (kIncrease | kDecrease))
_carry = 0;
if(type & kDecrease)
if(type & kDecrease && (!(type & kIncrease) || _level > 0))
_level -= _indent_size;
res = _level + _carry;