First make sure smart indent turned on (Settings → Editor → Smart Indent).
It still didn't work for me on Ubuntu, but installing the codeblocks-contrib package with
sudo apt-get install codeblocks-contrib
fixed some problems. He fixed smart indentation for if , while , for , but not for classes and functions. If anyone knows how to fix the rest of the problem, please let me know.
source share