Details
-
Bug
-
Resolution: Duplicate
-
P3: Somewhat important
-
None
-
Qt Creator 4.2.1, Qt Creator 4.3.0-rc1
-
None
-
Qt Creator 4.2.1 Based on Qt 5.8.0 (GCC 6.3.1 20170306, 64 bit) on Linux 4.10.10-1-ARCH
Description
void foobar() { char foo[2] = {'a', 'b'}; char bar = char{foo[0]};/*POS1*/ /*POS2*/ //Same goes for already declared variables: bar = char{foo[1]};/*POS1*/ /*POS2*/ //Without operator= this does not happen: char bar2{foo[0]};/*POS1*/ /*POS2*/ //Without {}-initializer lists this does not happen as well: bar2 = char(foo[0]);/*POS1*/ /*POS2*/ }
If you insert a linebreak (press Enter) at the marked position (POS1) your cursor will end up in POS2 (without auto-indentation). This happens regardless of codestyle.
For now, I could only reproduce this by using a operator[] inside a (curly brace) initializer.
With a line like the fifth in this code snippet, the indentation for the entire scope gets broken.
Auto formating is affected as well.
Edit, found something WEIRD:
For every indentation breaking line in a scope, the auto-indent misses one indentation.
When the start of the line is reached, the auto-indent works again:
namespace whatever { void foobar2() { char foo[2] = {'a', 'b'}; char bar = char{foo[0]};/*POS1*/ /*POS2*/ bar = char{foo[2]};/*POS1*/ /*POS2*/ bar = char{foo[2]};/*POS1*/ /*POS2*/ bar = char{foo[2]};/*POS1*/ /*POS2*/ } }
Attachments
Issue Links
- duplicates
-
QTCREATORBUG-20824 Wrong indentation after assignation : x[y=z]
- Closed