Fixed problem with indentation when auto-indent is turned off
Fixed problem with indentation when auto-indent is turned off

When auto-indent is turned off, Qt Creator uses a simplistic approach of
copying the indentation string from the previous line. This was broken
when the cursor was positioned inside the indentation, since this caused
part of the indentation to go to the next line, which was then prepended
with the copied indentation, in effect increasing the indentation for
each new line.

The solution here was to copy the indentation from the previous block
only after inserting the new block, which causes the indentation of the
previous line to be cut off by exactly the right amount to keep the
indentation constant.

Task-number: QTCREATORBUG-396
Reviewed-by: mae

richardmg/qtcreator,KDE/android-qt-creator,darksylinc/qt-creator,hdweiss/qt-creator-visualizer,renatofilho/QtCreator,Distrotech/qtcreator,bakaiadam/collaborative_qt_creator,kuba1/qtcreator,colede/qtcreator,kuba1/qtcreator,farseerri/git_code,jonnor/qt-creator,AltarBeastiful/qt-creator,jonnor/qt-creator,xianian/qt-creator,hdweiss/qt-creator-visualizer,amyvmiwei/qt-creator,martyone/sailfish-qtcreator,Distrotech/qtcreator,pcacjr/qt-creator,farseerri/git_code,martyone/sailfish-qtcreator,farseerri/git_code,ostash/qt-creator-i18n-uk,azat/qtcreator,ostash/qt-creator-i18n-uk,KDE/android-qt-creator,AltarBeastiful/qt-creator,richardmg/qtcreator,pcacjr/qt-creator,AltarBeastiful/qt-creator,yinyunqiao/qtcreator,richardmg/qtcreator,AltarBeastiful/qt-creator,dmik/qt-creator-os2,bakaiadam/collaborative_qt_creator,azat/qtcreator,ostash/qt-creator-i18n-uk,darksylinc/qt-creator,KDE/android-qt-creator,martyone/sailfish-qtcreator,sandsmark/qtcreator-minimap,enricoros/k-qt-creator-inspector,KDAB/KDAB-Creator,kuba1/qtcreator,malikcjm/qtcreator,enricoros/k-qt-creator-inspector,hdweiss/qt-creator-visualizer,KDE/android-qt-creator,omniacreator/qtcreator,malikcjm/qtcreator,malikcjm/qtcreator,amyvmiwei/qt-creator,omniacreator/qtcreator,KDE/android-qt-creator,colede/qtcreator,darksylinc/qt-creator,martyone/sailfish-qtcreator,sandsmark/qtcreator-minimap,omniacreator/qtcreator,AltarBeastiful/qt-creator,danimo/qt-creator,farseerri/git_code,yinyunqiao/qtcreator,KDAB/KDAB-Creator,azat/qtcreator,martyone/sailfish-qtcreator,omniacreator/qtcreator,dmik/qt-creator-os2,sandsmark/qtcreator-minimap,KDAB/KDAB-Creator,enricoros/k-qt-creator-inspector,danimo/qt-creator,martyone/sailfish-qtcreator,dmik/qt-creator-os2,jonnor/qt-creator,xianian/qt-creator,jonnor/qt-creator,azat/qtcreator,danimo/qt-creator,xianian/qt-creator,omniacreator/qtcreator,kuba1/qtcreator,kuba1/qtcreator,KDE/android-qt-creator,yinyunqiao/qtcreator,bakaiadam/collaborative_qt_creator,KDAB/KDAB-Creator,bakaiadam/collaborative_qt_creator,KDAB/KDAB-Creator,hdweiss/qt-creator-visualizer,danimo/qt-creator,malikcjm/qtcreator,duythanhphan/qt-creator,richardmg/qtcreator,yinyunqiao/qtcreator,colede/qtcreator,duythanhphan/qt-creator,renatofilho/QtCreator,AltarBeastiful/qt-creator,syntheticpp/qt-creator,enricoros/k-qt-creator-inspector,danimo/qt-creator,xianian/qt-creator,renatofilho/QtCreator,omniacreator/qtcreator,duythanhphan/qt-creator,xianian/qt-creator,sandsmark/qtcreator-minimap,azat/qtcreator,danimo/qt-creator,xianian/qt-creator,amyvmiwei/qt-creator,farseerri/git_code,martyone/sailfish-qtcreator,enricoros/k-qt-creator-inspector,richardmg/qtcreator,maui-packages/qt-creator,farseerri/git_code,KDE/android-qt-creator,malikcjm/qtcreator,KDAB/KDAB-Creator,colede/qtcreator,Distrotech/qtcreator,maui-packages/qt-creator,amyvmiwei/qt-creator,kuba1/qtcreator,enricoros/k-qt-creator-inspector,pcacjr/qt-creator,renatofilho/QtCreator,danimo/qt-creator,bakaiadam/collaborative_qt_creator,AltarBeastiful/qt-creator,yinyunqiao/qtcreator,darksylinc/qt-creator,amyvmiwei/qt-creator,kuba1/qtcreator,renatofilho/QtCreator,farseerri/git_code,yinyunqiao/qtcreator,maui-packages/qt-creator,sandsmark/qtcreator-minimap,darksylinc/qt-creator,dmik/qt-creator-os2,xianian/qt-creator,hdweiss/qt-creator-visualizer,syntheticpp/qt-creator,jonnor/qt-creator,amyvmiwei/qt-creator,yinyunqiao/qtcreator,syntheticpp/qt-creator,duythanhphan/qt-creator,pcacjr/qt-creator,azat/qtcreator,ostash/qt-creator-i18n-uk,xianian/qt-creator,maui-packages/qt-creator,maui-packages/qt-creator,ostash/qt-creator-i18n-uk,omniacreator/qtcreator,colede/qtcreator,enricoros/k-qt-creator-inspector,richardmg/qtcreator,sandsmark/qtcreator-minimap,martyone/sailfish-qtcreator,duythanhphan/qt-creator,dmik/qt-creator-os2,ostash/qt-creator-i18n-uk,syntheticpp/qt-creator,jonnor/qt-creator,Distrotech/qtcreator,xianian/qt-creator,colede/qtcreator,Distrotech/qtcreator,farseerri/git_code,kuba1/qtcreator,amyvmiwei/qt-creator,pcacjr/qt-creator,danimo/qt-creator,syntheticpp/qt-creator,dmik/qt-creator-os2,richardmg/qtcreator,maui-packages/qt-creator,danimo/qt-creator,ostash/qt-creator-i18n-uk,darksylinc/qt-creator,kuba1/qtcreator,colede/qtcreator,AltarBeastiful/qt-creator,Distrotech/qtcreator,hdweiss/qt-creator-visualizer,malikcjm/qtcreator,duythanhphan/qt-creator,pcacjr/qt-creator,renatofilho/QtCreator,duythanhphan/qt-creator,maui-packages/qt-creator,amyvmiwei/qt-creator,dmik/qt-creator-os2,darksylinc/qt-creator,martyone/sailfish-qtcreator,syntheticpp/qt-creator,darksylinc/qt-creator,KDE/android-qt-creator,Distrotech/qtcreator,syntheticpp/qt-creator,bakaiadam/collaborative_qt_creator,pcacjr/qt-creator,malikcjm/qtcreator,bakaiadam/collaborative_qt_creator