• Mitch Curtis's avatar
    CPP, QmlJs editors: don't indent when moving commented lines up/down. · e53ae818
    Mitch Curtis authored
    Currently, pressing Ctrl + Shift + Up/Down with a commented block of
    text selected will indent that block if the line two lines above the
    block is indented. This is undesirable, because the indenting for that
    block is incorrect when it is uncommented. See the following example:
    
    Step 1:
    void f()
    {
        int x;
    
    //    int y;
    }
    
    Step 2 - After Ctrl + Shift + Up:
    void f()
    {
        int x;
        //    int y;
    
    }
    
    Step 3 - After uncommenting the block:
    void f()
    {
        int x;
            int y;
    
    }
    
    This patch tells the CPP and QmlJs editors not to indent commented
    blocks when moving them. Blocks that are not entirely within comments
    (excluding whitespace) are not affected.
    
    Tested with (C++ and JavaScript, respectively):
    http://paste.kde.org/688778/
    http://paste.kde.org/688784/
    
    Change-Id: I35414e6dfd5a1084fd997594e711ea9932231981
    Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
    e53ae818
cppeditor.cpp 86.9 KB