• 
      

    Improve indentation support when converting some tabs to spaces.

    Review Request #5568 — Created March 2, 2014 and submitted

    Information

    Review Board
    release-2.0.x
    3a55a25...

    Reviewers

    A diff was found where a line with 3 tabs was unindented 1 tab, had
    1 tab removed, and had the last tab replaced with spaces. This caused
    the unindentation to show 3 tabs removed, which was wrong.

    To fix this, we have to have a little more state. We needed to know not
    only the raw number of indentation characters that changed, but also the
    normalized (tabs to spaces) difference in indentation between the lines.

    With this information, the serializers could figure out when we've
    actually hit the number of indentation normalized to spaces, in order to
    stop processing the string. They then needed to be modified to return
    the remaining portion along with the serialized version.

    After this change, a more complex indentation change like
    \t\t\t to \t<8 spaces> will show the right thing.

    Tested with a repro case based on a diff found in the wild. Before this
    change, it showed the wrong number of unindented tabs. After, it showed
    the correct number.

    Added a couple unit tests, which passed.

    All other unit tests passed as well. I had to modify the parameters going into
    some functions, but I set them based on what I expected the values to be, rather
    than what the unit tests failed with, and they matched what the code actually
    computed.

    david
    1. Ship It!

    2. 
        
    chipx86
    Review request changed
    Status:
    Completed